vecmat.c file
Functions
-
auto deg_to_rad(vm_
float_ t degrees) -> vm_ float_ t - Converts degrees to radians.
-
auto rad_to_deg(vm_
float_ t radians) -> vm_ float_ t - Converts radians to degrees.
- auto vec2_eq(vector2 a, vector2 b) -> bool
- Returns true if two vectors are equal within
VECMAT_.EPSILON - auto vec3_eq(vector3 a, vector3 b) -> bool
- Returns true if two vectors are equal within
VECMAT_.EPSILON - auto vec4_eq(vector4 a, vector4 b) -> bool
- Returns true if two vectors are equal within
VECMAT_.EPSILON - auto mat2_eq(matrix2 a, matrix2 b) -> bool
- Returns true if two matrices are equal within
VECMAT_.EPSILON - auto mat3_eq(matrix3 a, matrix3 b) -> bool
- Returns true if two matrices are equal within
VECMAT_.EPSILON - auto mat4_eq(matrix4 a, matrix4 b) -> bool
- Returns true if two matrices are equal within
VECMAT_.EPSILON - auto quat_eq(quaternion a, quaternion b) -> bool
- Returns true if two quaternions are equal within
VECMAT_.EPSILON -
auto vec2(vm_
float_ t x, vm_ float_ t y) -> vector2 - Constructs a vector2 from x and y.
- void vec2_assign(vector2* dest, const vector2* src)
- Copies src into dest.
-
void vec2_assign_xy(vector2* dest,
vm_
float_ t x, vm_ float_ t y) - Assigns x and y to dest.
- void vec2_add_assign(vector2* dest, const vector2* src)
- Adds src to dest in place.
- auto vec2_from(const vector2i* v) -> vector2
- Converts a
vector2ito avector2. - auto vec2i_from(const vector2* v) -> vector2i
- Converts a
vector2to avector2iby truncation. - auto vec2i_from_floored(const vector2* v) -> vector2i
- Converts a
vector2to avector2iby flooring each component. - auto vec2i_from_rounded(const vector2* v) -> vector2i
- Converts a
vector2to avector2iby rounding each component. -
auto vec3(vm_
float_ t x, vm_ float_ t y, vm_ float_ t z) -> vector3 - Constructs a
vector3from x, y, and z. - void vec3_assign(vector3* dest, const vector3* src)
- Copies src into dest.
-
void vec3_assign_xyz(vector3* dest,
vm_
float_ t x, vm_ float_ t y, vm_ float_ t z) - Assigns x, y, and z to dest.
- void vec3_add_assign(vector3* dest, const vector3* src)
- Adds src to dest in place.
- auto vec3_from(const vector3i* v) -> vector3
- Converts a vector3i to a vector3.
- auto vec3i_from(const vector3* v) -> vector3i
- Converts a
vector3to avector3iby truncation. - auto vec3i_from_floored(const vector3* v) -> vector3i
- Converts a
vector3to avector3iby flooring each component. - auto vec3i_from_rounded(const vector3* v) -> vector3i
- Converts a
vector3to avector3iby rounding each component.
Function documentation
vm_ float_ t deg_to_rad(vm_ float_ t degrees)
Converts degrees to radians.
| Parameters | |
|---|---|
| degrees | Angle in degrees. |
| Returns | The angle in radians. |
vm_ float_ t rad_to_deg(vm_ float_ t radians)
Converts radians to degrees.
| Parameters | |
|---|---|
| radians | Angle in radians. |
| Returns | The angle in degrees. |
bool vec2_eq(vector2 a, vector2 b)
Returns true if two vectors are equal within VECMAT_.
| Parameters | |
|---|---|
| a | First vector. |
| b | Second vector. |
| Returns | True if a and b are approximately equal. |
bool vec3_eq(vector3 a, vector3 b)
Returns true if two vectors are equal within VECMAT_.
| Parameters | |
|---|---|
| a | First vector. |
| b | Second vector. |
| Returns | True if a and b are approximately equal. |
bool vec4_eq(vector4 a, vector4 b)
Returns true if two vectors are equal within VECMAT_.
| Parameters | |
|---|---|
| a | First vector. |
| b | Second vector. |
| Returns | True if a and b are approximately equal. |
bool mat2_eq(matrix2 a, matrix2 b)
Returns true if two matrices are equal within VECMAT_.
| Parameters | |
|---|---|
| a | First matrix. |
| b | Second matrix. |
| Returns | True if a and b are approximately equal. |
bool mat3_eq(matrix3 a, matrix3 b)
Returns true if two matrices are equal within VECMAT_.
| Parameters | |
|---|---|
| a | First matrix. |
| b | Second matrix. |
| Returns | True if a and b are approximately equal. |
bool mat4_eq(matrix4 a, matrix4 b)
Returns true if two matrices are equal within VECMAT_.
| Parameters | |
|---|---|
| a | First matrix. |
| b | Second matrix. |
| Returns | True if a and b are approximately equal. |
bool quat_eq(quaternion a, quaternion b)
Returns true if two quaternions are equal within VECMAT_.
| Parameters | |
|---|---|
| a | First quaternion. |
| b | Second quaternion. |
| Returns | True if a and b are approximately equal. |
vector2 vec2(vm_ float_ t x,
vm_ float_ t y)
Constructs a vector2 from x and y.
| Parameters | |
|---|---|
| x | X component. |
| y | Y component. |
| Returns | The resulting vector2. |
void vec2_assign(vector2* dest, const vector2* src)
Copies src into dest.
| Parameters | |
|---|---|
| dest | Destination vector. |
| src | Source vector. |
void vec2_assign_xy(vector2* dest,
vm_ float_ t x,
vm_ float_ t y)
Assigns x and y to dest.
| Parameters | |
|---|---|
| dest | Destination vector. |
| x | X component. |
| y | Y component. |
void vec2_add_assign(vector2* dest, const vector2* src)
Adds src to dest in place.
| Parameters | |
|---|---|
| dest | Destination vector. |
| src | Vector to add. |
vector3 vec3(vm_ float_ t x,
vm_ float_ t y,
vm_ float_ t z)
Constructs a vector3 from x, y, and z.
| Parameters | |
|---|---|
| x | X component. |
| y | Y component. |
| z | Z component. |
| Returns | The resulting vector3. |
void vec3_assign(vector3* dest, const vector3* src)
Copies src into dest.
| Parameters | |
|---|---|
| dest | Destination vector. |
| src | Source vector. |
void vec3_assign_xyz(vector3* dest,
vm_ float_ t x,
vm_ float_ t y,
vm_ float_ t z)
Assigns x, y, and z to dest.
| Parameters | |
|---|---|
| dest | Destination vector. |
| x | X component. |
| y | Y component. |
| z | Z component. |
void vec3_add_assign(vector3* dest, const vector3* src)
Adds src to dest in place.
| Parameters | |
|---|---|
| dest | Destination vector. |
| src | Vector to add. |