vector3_ptr.c file
Functions
- void vec3_add_ptr(vector3* res, const vector3* a, const vector3* b)
- Component-wise addition of two vectors.
- void vec3_sub_ptr(vector3* res, const vector3* a, const vector3* b)
- Component-wise subtraction of two vectors.
-
void vec3_mul_scalar_ptr(vector3* res,
const vector3* v,
const vm_
float_ t s) - Component-wise multiplication of vector by scalar.
-
void vec3_div_scalar_ptr(vector3* res,
const vector3* v,
const vm_
float_ t s) - Component-wise division of vector by scalar.
- void vec3_mul_ptr(vector3* res, const vector3* a, const vector3* b)
- Component-wise multiplication of two vectors.
- void vec3_neg_ptr(vector3* res, const vector3* v)
- Negation of a vector.
- void vec3_abs_ptr(vector3* res, const vector3* v)
- Computes the absolute value per component of a
vector3. - void vec3_normalize_ptr(vector3* res, const vector3* v)
- Normalize a vector to unit length.
- void vec3_cross_ptr(vector3* res, const vector3* a, const vector3* b)
- Compute cross-product of two vectors.
- void vec3_min_ptr(vector3* res, const vector3* a, const vector3* b)
- Component-wise minimum of two vectors.
- void vec3_max_ptr(vector3* res, const vector3* a, const vector3* b)
- Component-wise maximum of two vectors.
- void vec3_sign_ptr(vector3* res, const vector3* v)
- Component-wise sign of a vector.
- void vec3_floor_ptr(vector3* res, const vector3* v)
- Component-wise floor of a vector.
- void vec3_ceil_ptr(vector3* res, const vector3* v)
- Component-wise ceil of a vector.
- void vec3_round_ptr(vector3* res, const vector3* v)
- Component-wise round of a vector.
- void vec3_reflect_ptr(vector3* res, const vector3* incident, const vector3* normal)
- Compute reflection of the incident vector over normal.
-
void vec3_refract_ptr(vector3* res,
const vector3* incident,
const vector3* normal,
const vm_
float_ t eta) - Compute refraction of the incident vector through normal with eta.
-
void vec3_lerp_ptr(vector3* res,
const vector3* a,
const vector3* b,
const vm_
float_ t t) - Linear interpolation between two vectors.
- void vec3_clamp_ptr(vector3* res, const vector3* v, const vector3* min, const vector3* max)
- Clamp vector components between min and max.
-
void vec3_scale_ptr(vector3* res,
const vector3* v,
const vm_
float_ t s) - Scales the vector by a scalar.
- void vec3_div_ptr(vector3* res, const vector3* a, const vector3* b)
- Divides two vectors component-wise.
-
void vec3_add_scalar_ptr(vector3* res,
const vector3* v,
const vm_
float_ t s) - Adds a scalar to each component.
-
void vec3_sub_scalar_ptr(vector3* res,
const vector3* v,
const vm_
float_ t s) - Subtracts a scalar from each component.
-
void vec3_clamp_scalar_ptr(vector3* res,
const vector3* v,
const vm_
float_ t min, const vm_ float_ t max) - Clamps each component to the scalar range [min, max].
- void vec3_saturate_ptr(vector3* res, const vector3* v)
- Clamps each component to the range [0, 1].
- void vec3_fract_ptr(vector3* res, const vector3* v)
- Returns the fractional part of each component.
- void vec3_project_ptr(vector3* res, const vector3* a, const vector3* b)
- Projects a onto b.
- void vec3_slide_ptr(vector3* res, const vector3* v, const vector3* normal)
- Removes the component of v along normal.
- void vec3_reject_ptr(vector3* res, const vector3* a, const vector3* b)
- Returns the component of a orthogonal to b.
-
void vec3_rotate_axis_ptr(vector3* res,
const vector3* v,
const vector3* axis,
const vm_
float_ t radians) - Rotates v around axis by angle radians.
-
void vec3_rotate_axis_deg_ptr(vector3* res,
const vector3* v,
const vector3* axis,
const vm_
float_ t degrees) - Component-wise rotation of a vector around an axis by a given angle in degrees.
-
void vec3_from_vec2_ptr(vector3* res,
const vector2* v,
const vm_
float_ t z) - Builds a higher-dimension vector from a vector2.
- void vec3_xy_ptr(vector2* res, const vector3* v)
- Returns the x and y components as a 2D vector.
-
void vec3_move_toward_ptr(vector3* res,
const vector3* current,
const vector3* target,
const vm_
float_ t max_delta) - Moves current toward target by at most max_delta.
-
void vec3_limit_length_ptr(vector3* res,
const vector3* v,
const vm_
float_ t max_len) - Clamps the vector length to max_len.
- void vec3_orthonormal_basis_ptr(const vector3* n, vector3* t, vector3* b)
- Builds a tangent and bitangent orthonormal to n.
Function documentation
void vec3_add_ptr(vector3* res, const vector3* a, const vector3* b)
Component-wise addition of two vectors.
| Parameters | |
|---|---|
| res | Result vector. |
| a | First vector. |
| b | Second vector. |
void vec3_sub_ptr(vector3* res, const vector3* a, const vector3* b)
Component-wise subtraction of two vectors.
| Parameters | |
|---|---|
| res | Result vector. |
| a | First vector. |
| b | Second vector. |
void vec3_mul_scalar_ptr(vector3* res,
const vector3* v,
const vm_ float_ t s)
Component-wise multiplication of vector by scalar.
| Parameters | |
|---|---|
| res | Result vector. |
| v | Vector. |
| s | Scalar. |
void vec3_div_scalar_ptr(vector3* res,
const vector3* v,
const vm_ float_ t s)
Component-wise division of vector by scalar.
| Parameters | |
|---|---|
| res | Result vector. |
| v | Vector. |
| s | Scalar. |
void vec3_mul_ptr(vector3* res, const vector3* a, const vector3* b)
Component-wise multiplication of two vectors.
| Parameters | |
|---|---|
| res | Result vector. |
| a | First vector. |
| b | Second vector. |
void vec3_neg_ptr(vector3* res, const vector3* v)
Negation of a vector.
| Parameters | |
|---|---|
| res | Result vector. |
| v | Vector. |
void vec3_abs_ptr(vector3* res, const vector3* v)
Computes the absolute value per component of a vector3.
| Parameters | |
|---|---|
| res | Result vector. |
| v | Vector. |
void vec3_normalize_ptr(vector3* res, const vector3* v)
Normalize a vector to unit length.
| Parameters | |
|---|---|
| res | Result vector. |
| v | Vector. |
void vec3_cross_ptr(vector3* res, const vector3* a, const vector3* b)
Compute cross-product of two vectors.
| Parameters | |
|---|---|
| res | Result vector. |
| a | First vector. |
| b | Second vector. |
void vec3_min_ptr(vector3* res, const vector3* a, const vector3* b)
Component-wise minimum of two vectors.
| Parameters | |
|---|---|
| res | Result vector. |
| a | First vector. |
| b | Second vector. |
void vec3_max_ptr(vector3* res, const vector3* a, const vector3* b)
Component-wise maximum of two vectors.
| Parameters | |
|---|---|
| res | Result vector. |
| a | First vector. |
| b | Second vector. |
void vec3_sign_ptr(vector3* res, const vector3* v)
Component-wise sign of a vector.
| Parameters | |
|---|---|
| res | Result vector. |
| v | Vector. |
void vec3_floor_ptr(vector3* res, const vector3* v)
Component-wise floor of a vector.
| Parameters | |
|---|---|
| res | Result vector. |
| v | Vector. |
void vec3_ceil_ptr(vector3* res, const vector3* v)
Component-wise ceil of a vector.
| Parameters | |
|---|---|
| res | Result vector. |
| v | Vector. |
void vec3_round_ptr(vector3* res, const vector3* v)
Component-wise round of a vector.
| Parameters | |
|---|---|
| res | Result vector. |
| v | Vector. |
void vec3_reflect_ptr(vector3* res, const vector3* incident, const vector3* normal)
Compute reflection of the incident vector over normal.
| Parameters | |
|---|---|
| res | Result vector. |
| incident | Incident vector. |
| normal | Normal vector. |
void vec3_refract_ptr(vector3* res,
const vector3* incident,
const vector3* normal,
const vm_ float_ t eta)
Compute refraction of the incident vector through normal with eta.
| Parameters | |
|---|---|
| res | Result vector. |
| incident | Incident vector. |
| normal | Normal vector. |
| eta | Refraction index ratio. |
void vec3_lerp_ptr(vector3* res,
const vector3* a,
const vector3* b,
const vm_ float_ t t)
Linear interpolation between two vectors.
| Parameters | |
|---|---|
| res | Result vector. |
| a | Start vector. |
| b | End vector. |
| t | Interpolation factor. |
void vec3_clamp_ptr(vector3* res, const vector3* v, const vector3* min, const vector3* max)
Clamp vector components between min and max.
| Parameters | |
|---|---|
| res | Result vector. |
| v | Vector. |
| min | Minimum bounds. |
| max | Maximum bounds. |
void vec3_scale_ptr(vector3* res,
const vector3* v,
const vm_ float_ t s)
Scales the vector by a scalar.
| Parameters | |
|---|---|
| res | Output vector. |
| v | Input vector. |
| s | Scalar value. |
void vec3_div_ptr(vector3* res, const vector3* a, const vector3* b)
Divides two vectors component-wise.
| Parameters | |
|---|---|
| res | Output vector. |
| a | First input vector. |
| b | Second input vector. |
void vec3_add_scalar_ptr(vector3* res,
const vector3* v,
const vm_ float_ t s)
Adds a scalar to each component.
| Parameters | |
|---|---|
| res | Output vector. |
| v | Input vector. |
| s | Scalar value. |
void vec3_sub_scalar_ptr(vector3* res,
const vector3* v,
const vm_ float_ t s)
Subtracts a scalar from each component.
| Parameters | |
|---|---|
| res | Output vector. |
| v | Input vector. |
| s | Scalar value. |
void vec3_clamp_scalar_ptr(vector3* res,
const vector3* v,
const vm_ float_ t min,
const vm_ float_ t max)
Clamps each component to the scalar range [min, max].
| Parameters | |
|---|---|
| res | Output vector. |
| v | Input vector. |
| min | Lower bound. |
| max | Upper bound. |
void vec3_saturate_ptr(vector3* res, const vector3* v)
Clamps each component to the range [0, 1].
| Parameters | |
|---|---|
| res | Output vector. |
| v | Input vector. |
void vec3_fract_ptr(vector3* res, const vector3* v)
Returns the fractional part of each component.
| Parameters | |
|---|---|
| res | Output vector. |
| v | Input vector. |
void vec3_project_ptr(vector3* res, const vector3* a, const vector3* b)
Projects a onto b.
| Parameters | |
|---|---|
| res | Output vector. |
| a | First input vector. |
| b | Second input vector. |
void vec3_slide_ptr(vector3* res, const vector3* v, const vector3* normal)
Removes the component of v along normal.
| Parameters | |
|---|---|
| res | Output vector. |
| v | Input vector. |
| normal | Surface normal. |
void vec3_reject_ptr(vector3* res, const vector3* a, const vector3* b)
Returns the component of a orthogonal to b.
| Parameters | |
|---|---|
| res | Output vector. |
| a | First input vector. |
| b | Second input vector. |
void vec3_rotate_axis_ptr(vector3* res,
const vector3* v,
const vector3* axis,
const vm_ float_ t radians)
Rotates v around axis by angle radians.
| Parameters | |
|---|---|
| res | Output vector. |
| v | Input vector. |
| axis | Rotation axis. |
| radians | Angle in radians. |
void vec3_rotate_axis_deg_ptr(vector3* res,
const vector3* v,
const vector3* axis,
const vm_ float_ t degrees)
Component-wise rotation of a vector around an axis by a given angle in degrees.
| Parameters | |
|---|---|
| res | Result vector. |
| v | Vector to rotate. |
| axis | Rotation axis. |
| degrees | Angle in degrees. |
void vec3_from_vec2_ptr(vector3* res,
const vector2* v,
const vm_ float_ t z)
Builds a higher-dimension vector from a vector2.
| Parameters | |
|---|---|
| res | Output vector. |
| v | Input vector. |
| z | Z component. |
void vec3_xy_ptr(vector2* res, const vector3* v)
Returns the x and y components as a 2D vector.
| Parameters | |
|---|---|
| res | Output vector. |
| v | Input vector. |
void vec3_move_toward_ptr(vector3* res,
const vector3* current,
const vector3* target,
const vm_ float_ t max_delta)
Moves current toward target by at most max_delta.
| Parameters | |
|---|---|
| res | Output vector. |
| current | Current position. |
| target | Target position. |
| max_delta | Maximum distance to move. |
void vec3_limit_length_ptr(vector3* res,
const vector3* v,
const vm_ float_ t max_len)
Clamps the vector length to max_len.
| Parameters | |
|---|---|
| res | Output vector. |
| v | Input vector. |
| max_len | Maximum length. |
void vec3_orthonormal_basis_ptr(const vector3* n, vector3* t, vector3* b)
Builds a tangent and bitangent orthonormal to n.
| Parameters | |
|---|---|
| n | Unit normal. |
| t | Output tangent. |
| b | Output bitangent. |