Euphoria
eu Namespace Reference

Namespaces

namespace  assertlib
namespace  hues
namespace  colors
namespace  kk
namespace  core
namespace  imgui
namespace  render
namespace  io
namespace  kdl
namespace  log
namespace  mrgui

Classes

struct  An
 An angle in both degrees and radians. More...
struct  AA
 Axis + Angle. More...
struct  Ypr
 yaw + pitch + roll More...
struct  Rgb
 Represents color in gamma (non-linear) space (aka sRGB). More...
struct  Lin_rgb
 Represents a linear sRGB color. More...
struct  OkHsv
 Represents a color in the OKhsv color space. More...
struct  OkHsl
 Represents a color in the OKhsl color space. More...
struct  Hsl
 Represents a color in the sRGB color space. More...
struct  OkLch
 Represents a color in the OKlch color space. More...
struct  OkLab
 Represents a color in the OKlab color space. More...
struct  Color
 Represents a color with an alpha component. The color is stored in gamma (non-linear) space (aka sRGB). More...
struct  Guid
 Represents a universally unique identifier. More...
struct  HshSt
struct  Hsh
 Hash of a non-owning string. More...
struct  HshO
 Hash of an owning string. More...
struct  m4
 4x4 matrix More...
struct  MemoryChunk
struct  MemoryChunkData
struct  Q
 A quaternion representing a rotation in 3d. More...
struct  R
 A (inclusive) range between two values. More...
struct  Lrtb
 offset from sides More...
struct  Rect
struct  Size
 a size More...
struct  v2
 a 2d vector More...
struct  n2
 a 2d unit (vector) More...
struct  v3
 a 3d vector More...
struct  n3
 a 3d unit (vector) More...
struct  v4
 A 4d vector. More...

Typedefs

using i8 = int8_t
using i16 = int16_t
using i32 = int32_t
using i64 = int64_t
using u8 = uint8_t
using u16 = uint16_t
using u32 = uint32_t
using u64 = uint64_t

Enumerations

enum class  RectCut { left , right , top , bottom }

Functions

float sin (const An &ang)
float cos (const An &ang)
float tan (const An &ang)
An asin (float v)
An acos (float v)
An atan (float v)
An atan2 (float y, float x)
An operator+ (const An &lhs, const An &rhs)
An operator- (const An &lhs, const An &rhs)
An operator* (const An &lhs, float rhs)
An operator/ (const An &lhs, float rhs)
An operator* (float rhs, const An &lhs)
std::string string_from (const An &a)
bool operator< (const An &lhs, const An &rhs)
bool operator<= (const An &lhs, const An &rhs)
bool operator> (const An &lhs, const An &rhs)
bool operator>= (const An &lhs, const An &rhs)
An lerp_angle (const An &from, float v, const An &to)
constexpr An operator""_deg (unsigned long long int d)
constexpr An operator""_deg (long double d)
constexpr An operator""_rad (long double r)
AA rha (const n3 &axis, const An &angle)
std::string string_from (const AA &aa)
std::string string_from (const Ypr &ypr)
constexpr float float_from_int (int i)
constexpr int int_from_float (float f)
constexpr std::size_t sizet_from_int (int i)
constexpr u32 u32_from_sizet (std::size_t i)
constexpr int int_from_sizet (std::size_t i)
constexpr int int_from_unsigned_int (unsigned int i)
float linear_from_srgb (float value, float gamma)
Lin_rgb linear_from_srgb (const Rgb &value, float gamma)
float linear_from_srgb (float value)
Lin_rgb linear_from_srgb (const Rgb &value)
float srgb_from_linear (float value)
Rgb srgb_from_linear (const Lin_rgb &value)
OkLab oklab_from_linear (const Lin_rgb &c)
Lin_rgb linear_from_oklab (const OkLab &c)
OkLch oklch_from_oklab (const OkLab &c)
OkLab oklab_from_oklch (const OkLch &c)
Lin_rgb gamut_clip_preserve_chroma (const Lin_rgb &rgb)
Lin_rgb gamut_clip_project_to_0_5 (const Lin_rgb &rgb)
Lin_rgb gamut_clip_project_to_l_cusp (const Lin_rgb &rgb)
Lin_rgb gamut_clip_adaptive_L0_0_5 (const Lin_rgb &rgb, float alpha=0.05f)
Lin_rgb gamut_clip_adaptive_l0_l_cusp (const Lin_rgb &rgb, float alpha=0.05f)
Rgb srgb_from_okhsv (const OkHsv &hsv)
OkHsv okhsv_from_srgb (const Rgb &rgb)
Rgb srgb_from_okhsl (const OkHsl &hsl)
OkHsl okhsl_from_srgb (const Rgb &rgb)
Rgb srgb_from_hsl (const Hsl &hsl)
Lin_rgb keep_within (Lin_rgb c)
template<typename E>
constexpr std::underlying_type_t< E > base_cast (E e) noexcept
template<typename E>
constexpr bool is_flag_set (E var, E flag)
bool operator== (const Guid &lhs, const Guid &rhs)
bool operator!= (const Guid &lhs, const Guid &rhs)
std::optional< Guidguid_from (const std::string &str)
 Parse a guid from a string.
std::string string_from (const Guid &g)
 Convert a guid to a string representation, prefer fmt.
constexpr u64 hash64 (const std::string_view str, u64 hash=0xcbf29ce484222325)
 fnv-1a hash.
 OP (==) OP(!
std::string string_from (const HshO &h)
std::string string_from (const m4 &m)
 Convert a matrix to a string representation, prefer fmt.
m4 operator+ (const m4 &lhs, const m4 &rhs)
m4 operator- (const m4 &lhs, const m4 &rhs)
m4 operator* (const m4 &lhs, const m4 &rhs)
v4 operator* (const m4 &lhs, const v4 &rhs)
MemoryChunkData chunk_from_file (const std::string &path)
constexpr float cabs (float r)
constexpr bool is_zero (float r, float epsilon=kk::epsilon)
constexpr bool is_equal (float lhs, float rhs, float epsilon=kk::epsilon)
int floor_to_int (float v)
int ceil_to_int (float v)
constexpr int get_sign (float r)
 Calculates the sign as a positive or a negative int.
constexpr float get_sign (bool b)
 Returns 1 if true or -1.
constexpr float lerp_float (float f, float scale, float t)
constexpr float square (float r)
 Return r * r.
constexpr float min (float lhs, float rhs)
constexpr float max (float lhs, float rhs)
constexpr float clamp_zero (float value, float def=0.0f, float epsilon=kk::epsilon)
 If the value is close to zero, def is returned.
constexpr float keep_within01 (float f)
float dot (const Q &lhs, const Q &rhs)
std::string string_from (const Q &v)
 Converts a quaternion to string, prefer fmt.
Q operator* (const Q &lhs, const Q &rhs)
Q operator* (float scale, const Q &q)
Q operator* (const Q &q, float scale)
template<typename T>
R< T > make_range (T min, T max)
 Create a range from min to max (inclusive).
template<typename T>
R< T > make_range (T max)
 Create a range from zero (0) to max (inclusive).
float from_01f (float lower_bound, float upper_bound, float value)
template<typename T>
from_01 (const R< T > &range, float value)
 Converts a value in 0-1 range to a custom range.
template<>
float from_01 (const R< float > &range, float value)
template<typename T>
float to01 (const R< T > &range, T value)
 Converts a value in a range to the 0-1 range.
template<typename T>
get360_angular (const R< T > &range, float value)
template<typename T, typename F>
remap_to (const R< F > &from, const R< T > &to, F value)
 Remaps a value from one range to another.
template<typename T>
bool is_within (const R< T > &range, T value)
 Returns true if a value is withing a range.
template<typename T>
keep_within (const R< T > &range, T value)
 Returns a value that is kept within the range.
template<typename T>
wrap (const R< T > &range, T value)
 Returns a value that wraps around the range.
v2 to_01 (const Rect &r, const v2 &from)
v2 from_01 (const Rect &r, const v2 &from)
bool is_within (const v2 &p, const Rect &r)
 is the point contained within the rect?
std::string to_string (const Rect &r)
constexpr bool operator== (const Size &lhs, const Size &rhs)
std::string string_from (const Size &v)
 converts a 2d unit vector to a string, prefer fmt
v2 operator+ (const v2 &lhs, const v2 &rhs)
v2 operator- (const v2 &lhs, const v2 &rhs)
v2 operator* (const v2 &lhs, float rhs)
v2 operator* (const v2 &lhs, const v2 &rhs)
v2 operator* (float lhs, const v2 &rhs)
v2 operator* (const n2 &lhs, float rhs)
v2 operator* (float lhs, const n2 &rhs)
v2 operator/ (const v2 &lhs, float rhs)
float dot (const v2 &lhs, const v2 &rhs)
v2 lerp_vec2f (const v2 &from, float v, const v2 &to)
std::string string_from (const v2 &v)
 converts a 2d vector to a string, prefer fmt
std::string string_from (const n2 &v)
 converts a 2d unit vector to a string, prefer fmt
v3 operator+ (const v3 &lhs, const v3 &rhs)
v3 operator- (const v3 &lhs, const v3 &rhs)
v3 operator* (float lhs, const v3 &rhs)
v3 operator* (const v3 &lhs, float rhs)
v3 operator/ (const v3 &lhs, float rhs)
v3 operator/ (float lhs, const v3 &rhs)
v3 lerp_v3 (const v3 &f, float v, const v3 &t)
std::string string_from (const v3 &v)
 convert a 3d vector to string, prefer fmt
std::string string_from (const n3 &v)
 converts a 3d unit vector to string, prefer fmt
constexpr v3 min (const v3 &lhs, const v3 &rhs)
 component wise min value
constexpr v3 max (const v3 &lhs, const v3 &rhs)
 component wise max value
std::string string_from (const v4 &v)
 converts a 4d vector to a string, prefer fmt

Variables

constexpr An one_turn = An::from_radians(pi * 2.0f)
constexpr An half_turn = An::from_radians(pi)
constexpr An quarter_turn = An::from_radians(pi / 2.0f)
constexpr An no_rotation = An::from_radians(0.0f)
constexpr Guid nil_guid
 A nil guid, all bits are set to 0.
constexpr m4 m4_identity = m4::from_scalar(1)
 The identity matrix.
constexpr float pi = 3.1415926535897932384626433832795f
constexpr Q q_identity = Q(1, v3(0, 0, 0))
 The identity quaternion.
constexpr R< float > r01 = { 0.0f, 1.0f}
 A range going from 0 to 1.
constexpr R< float > r11 = { -1.0f, 1.0}
constexpr v2 zero2f = v2{ 0, 0 }
constexpr v3 zero3f = v3{0.0f, 0.0f, 0.0f}

Typedef Documentation

◆ i16

using eu::i16 = int16_t

Definition at line 8 of file ints.h.

◆ i32

using eu::i32 = int32_t

Definition at line 9 of file ints.h.

◆ i64

using eu::i64 = int64_t

Definition at line 10 of file ints.h.

◆ i8

using eu::i8 = int8_t

Definition at line 7 of file ints.h.

◆ u16

using eu::u16 = uint16_t

Definition at line 13 of file ints.h.

◆ u32

using eu::u32 = uint32_t

Definition at line 14 of file ints.h.

◆ u64

using eu::u64 = uint64_t

Definition at line 15 of file ints.h.

◆ u8

using eu::u8 = uint8_t

Definition at line 12 of file ints.h.

Enumeration Type Documentation

◆ RectCut

enum class eu::RectCut
strong
Enumerator
left 
right 
top 
bottom 

Definition at line 14 of file rect.h.

Function Documentation

◆ base_cast()

template<typename E>
std::underlying_type_t< E > eu::base_cast ( E e)
constexprnoexcept

Definition at line 12 of file cpp.h.

◆ cabs()

float eu::cabs ( float r)
constexpr

Definition at line 16 of file numeric.h.

◆ chunk_from_file()

MemoryChunkData eu::chunk_from_file ( const std::string & path)

◆ float_from_int()

float eu::float_from_int ( int i)
constexpr

Definition at line 6 of file cint.h.

◆ from_01()

v2 eu::from_01 ( const Rect & r,
const v2 & from )
nodiscard

◆ gamut_clip_adaptive_L0_0_5()

Lin_rgb eu::gamut_clip_adaptive_L0_0_5 ( const Lin_rgb & rgb,
float alpha = 0.05f )

◆ gamut_clip_adaptive_l0_l_cusp()

Lin_rgb eu::gamut_clip_adaptive_l0_l_cusp ( const Lin_rgb & rgb,
float alpha = 0.05f )

◆ gamut_clip_preserve_chroma()

Lin_rgb eu::gamut_clip_preserve_chroma ( const Lin_rgb & rgb)

◆ gamut_clip_project_to_0_5()

Lin_rgb eu::gamut_clip_project_to_0_5 ( const Lin_rgb & rgb)

◆ gamut_clip_project_to_l_cusp()

Lin_rgb eu::gamut_clip_project_to_l_cusp ( const Lin_rgb & rgb)

◆ guid_from()

std::optional< Guid > eu::guid_from ( const std::string & str)
nodiscard

Parse a guid from a string.

◆ hash64()

u64 eu::hash64 ( const std::string_view str,
u64 hash = 0xcbf29ce484222325 )
constexpr

◆ int_from_float()

int eu::int_from_float ( float f)
constexpr

Definition at line 11 of file cint.h.

◆ int_from_sizet()

int eu::int_from_sizet ( std::size_t i)
constexpr

Definition at line 26 of file cint.h.

◆ int_from_unsigned_int()

int eu::int_from_unsigned_int ( unsigned int i)
constexpr

Definition at line 31 of file cint.h.

◆ is_flag_set()

template<typename E>
bool eu::is_flag_set ( E var,
E flag )
constexpr

Definition at line 18 of file cpp.h.

◆ is_within()

bool eu::is_within ( const v2 & p,
const Rect & r )

is the point contained within the rect?

Note
on the border is considered within

◆ keep_within()

Lin_rgb eu::keep_within ( Lin_rgb c)

◆ linear_from_oklab()

Lin_rgb eu::linear_from_oklab ( const OkLab & c)

◆ linear_from_srgb() [1/4]

Lin_rgb eu::linear_from_srgb ( const Rgb & value)

◆ linear_from_srgb() [2/4]

Lin_rgb eu::linear_from_srgb ( const Rgb & value,
float gamma )

◆ linear_from_srgb() [3/4]

float eu::linear_from_srgb ( float value)

◆ linear_from_srgb() [4/4]

float eu::linear_from_srgb ( float value,
float gamma )

◆ okhsl_from_srgb()

OkHsl eu::okhsl_from_srgb ( const Rgb & rgb)

◆ okhsv_from_srgb()

OkHsv eu::okhsv_from_srgb ( const Rgb & rgb)

◆ oklab_from_linear()

OkLab eu::oklab_from_linear ( const Lin_rgb & c)

◆ oklab_from_oklch()

OkLab eu::oklab_from_oklch ( const OkLch & c)

◆ oklch_from_oklab()

OkLch eu::oklch_from_oklab ( const OkLab & c)

◆ OP()

eu::OP ( )

◆ operator!=()

bool eu::operator!= ( const Guid & lhs,
const Guid & rhs )

◆ operator""_deg() [1/2]

An eu::operator""_deg ( long double d)
constexpr

Definition at line 128 of file angle.h.

◆ operator""_deg() [2/2]

An eu::operator""_deg ( unsigned long long int d)
constexpr

Definition at line 123 of file angle.h.

◆ operator""_rad()

An eu::operator""_rad ( long double r)
constexpr

Definition at line 134 of file angle.h.

◆ operator==()

bool eu::operator== ( const Guid & lhs,
const Guid & rhs )

◆ sizet_from_int()

std::size_t eu::sizet_from_int ( int i)
constexpr

Definition at line 16 of file cint.h.

◆ srgb_from_hsl()

Rgb eu::srgb_from_hsl ( const Hsl & hsl)

◆ srgb_from_linear() [1/2]

Rgb eu::srgb_from_linear ( const Lin_rgb & value)

◆ srgb_from_linear() [2/2]

float eu::srgb_from_linear ( float value)

◆ srgb_from_okhsl()

Rgb eu::srgb_from_okhsl ( const OkHsl & hsl)

◆ srgb_from_okhsv()

Rgb eu::srgb_from_okhsv ( const OkHsv & hsv)

◆ string_from() [1/2]

std::string eu::string_from ( const Guid & g)
nodiscard

Convert a guid to a string representation, prefer fmt.

◆ string_from() [2/2]

std::string eu::string_from ( const HshO & h)

◆ to_01()

v2 eu::to_01 ( const Rect & r,
const v2 & from )
nodiscard

◆ to_string()

std::string eu::to_string ( const Rect & r)

◆ u32_from_sizet()

u32 eu::u32_from_sizet ( std::size_t i)
constexpr

Definition at line 21 of file cint.h.

Variable Documentation

◆ nil_guid

Guid eu::nil_guid
constexpr
Initial value:
{
std::array<u8, 16>
{
0, 0, 0, 0,
0, 0,
0, 0,
0, 0,
0, 0, 0, 0, 0, 0
}
}
Represents a universally unique identifier.
Definition guid.h:14

A nil guid, all bits are set to 0.

Definition at line 69 of file guid.h.

◆ pi

float eu::pi = 3.1415926535897932384626433832795f
constexpr

Definition at line 13 of file numeric.h.