vector2i.c file
Functions
-
auto vec2i_div_scalar(vector2i v,
vm_
int_ t s) -> vector2i - Divides a vector by a scalar component-wise (float division, truncated to int).
- auto vec2i_normalize(vector2i v) -> vector2i
- Normalizes the vector to approximate unit length (float length, truncated to int).
-
auto vec2i_length(vector2i v) -> vm_
float_ t - Computes the length (magnitude) of the vector.
-
auto vec2i_distance(vector2i a,
vector2i b) -> vm_
float_ t - Computes the Euclidean distance between two vectors (treated as points).
-
auto vec2i_angle(vector2i a,
vector2i b) -> vm_
float_ t - Computes the signed angle between two vectors (in radians, range [-PI, PI]) using atan2(cross, dot).
-
auto vec2i_aspect_ratio(vector2i v) -> vm_
float_ t - Computes the aspect ratio of the vector (x / y).
-
auto vec2i_lerp(vector2i a,
vector2i b,
vm_
float_ t t) -> vector2i - Linearly interpolates from a to b by t.
- auto vec2i_normalize_to_vec2(vector2i v) -> vector2
- Converts to a unit-length vector2.
Function documentation
vector2i vec2i_div_scalar(vector2i v,
vm_ int_ t s)
Divides a vector by a scalar component-wise (float division, truncated to int).
| Parameters | |
|---|---|
| v | The input vector. |
| s | The scalar divisor (sets to zero vector if zero). |
| Returns | The divided vector2i. |
vector2i vec2i_normalize(vector2i v)
Normalizes the vector to approximate unit length (float length, truncated to int).
| Parameters | |
|---|---|
| v | The input vector. |
| Returns | The normalized vector2i (unchanged if zero length). |
vm_ float_ t vec2i_length(vector2i v)
Computes the length (magnitude) of the vector.
| Parameters | |
|---|---|
| v | The input vector. |
| Returns | The length scalar. |
vm_ float_ t vec2i_distance(vector2i a,
vector2i b)
Computes the Euclidean distance between two vectors (treated as points).
| Parameters | |
|---|---|
| a | The first point. |
| b | The second point. |
| Returns | The distance scalar. |
vm_ float_ t vec2i_angle(vector2i a,
vector2i b)
Computes the signed angle between two vectors (in radians, range [-PI, PI]) using atan2(cross, dot).
| Parameters | |
|---|---|
| a | The first vector. |
| b | The second vector. |
| Returns | The signed angle scalar. |
Returns 0.0f if either vector has zero length.
vm_ float_ t vec2i_aspect_ratio(vector2i v)
Computes the aspect ratio of the vector (x / y).
| Parameters | |
|---|---|
| v | The input vector. |
| Returns | The aspect ratio scalar. |
Returns 0.0f if y == 0.
vector2i vec2i_lerp(vector2i a,
vector2i b,
vm_ float_ t t)
Linearly interpolates from a to b by t.
| Parameters | |
|---|---|
| a | First input vector. |
| b | Second input vector. |
| t | Interpolation factor. |
| Returns | The resulting vector2i. |
vector2 vec2i_normalize_to_vec2(vector2i v)
Converts to a unit-length vector2.
| Parameters | |
|---|---|
| v | Input vector. |
| Returns | The resulting vector2. |