AcousticTracer 0.1.0
An acoustic raytracing library.
Loading...
Searching...
No Matches
Vector Math

Data Structures

union  AT_Vec3
 Groups three floats to represent a vector of size 3. More...
struct  AT_Vec3i
 Groups three integers to represent a vector of size 3. More...

Functions

static AT_Vec3 AT_vec3 (float x, float y, float z)
 AT_Vec3 constructor for a given point.
static AT_Vec3 AT_vec3_zero (void)
 AT_Vec3 constructor for a zero initialised vector.
static AT_Vec3 AT_vec3_add (AT_Vec3 a, AT_Vec3 b)
 Adds two AT_Vec3.
static AT_Vec3 AT_vec3_sub (AT_Vec3 a, AT_Vec3 b)
 Subtracts two AT_Vec3.
static AT_Vec3 AT_vec3_mul (AT_Vec3 a, AT_Vec3 b)
 Product of two AT_Vec3.
static AT_Vec3 AT_vec3_inv (AT_Vec3 v)
 Calculates the inverse of a vector.
static AT_Vec3 AT_vec3_scale (AT_Vec3 v, float s)
 Scales an AT_Vec3 by a given scalar.
static float AT_vec3_dot (AT_Vec3 a, AT_Vec3 b)
 Performs vector dot operation on two given AT_Vec3.
static AT_Vec3 AT_vec3_cross (AT_Vec3 a, AT_Vec3 b)
 Performs vector cross multiplication on two given AT_Vec3.
static float AT_vec3_length (AT_Vec3 v)
 Calculate the length of an AT_Vec3.
static AT_Vec3 AT_vec3_normalize (AT_Vec3 v)
 Normalise a given vector to be within 0.0 -> 1.0.
static float AT_vec3_distance (AT_Vec3 a, AT_Vec3 b)
 Calculates the distance between two AT_Vec3's.
static float AT_vec3_distance_sq (AT_Vec3 a, AT_Vec3 b)
 Calculates the squared distance between two AT_Vec3's.

Detailed Description

Function Documentation

◆ AT_vec3()

AT_Vec3 AT_vec3 ( float x,
float y,
float z )
related

AT_Vec3 constructor for a given point.

Parameters
xx coord in world coordinates.
yy coord in world coordinates.
zz coord in world coordinates.
Return values
AT_Vec3Vector with coordinate values of those given in function call.

◆ AT_vec3_add()

AT_Vec3 AT_vec3_add ( AT_Vec3 a,
AT_Vec3 b )
related

Adds two AT_Vec3.

Parameters
aFirst vector in the addition.
bSecond vector in the addition.
Return values
AT_Vec3The result of the vector addition.

◆ AT_vec3_cross()

AT_Vec3 AT_vec3_cross ( AT_Vec3 a,
AT_Vec3 b )
related

Performs vector cross multiplication on two given AT_Vec3.

Parameters
aFirst vector in the cross multiplication.
bSecond vector in the cross multiplication.
Return values
AT_Vec3The result of the vector cross multiplication.

◆ AT_vec3_distance()

float AT_vec3_distance ( AT_Vec3 a,
AT_Vec3 b )
related

Calculates the distance between two AT_Vec3's.

Parameters
aFirst point on the distance line.
bSecond point on the distance line.
Return values
floatThe distance between two AT_Vec3's.

◆ AT_vec3_distance_sq()

float AT_vec3_distance_sq ( AT_Vec3 a,
AT_Vec3 b )
related

Calculates the squared distance between two AT_Vec3's.

Parameters
aFirst point on the distance line.
bSecond point on the distance line.
Return values
floatThe squared distance between two AT_Vec3's.

◆ AT_vec3_dot()

float AT_vec3_dot ( AT_Vec3 a,
AT_Vec3 b )
related

Performs vector dot operation on two given AT_Vec3.

Parameters
aFirst vector in the dot operation.
bSecond vector in the dot operation.
Return values
floatThe result of the vector dot operation.

◆ AT_vec3_inv()

AT_Vec3 AT_vec3_inv ( AT_Vec3 v)
related

Calculates the inverse of a vector.

Parameters
vVector to be inverted.
Return values
AT_Vec3The inverse of the input vector.

◆ AT_vec3_length()

float AT_vec3_length ( AT_Vec3 v)
related

Calculate the length of an AT_Vec3.

Parameters
vVector whose length is to be returned.
Return values
floatThe length of the given AT_Vec3.

◆ AT_vec3_mul()

AT_Vec3 AT_vec3_mul ( AT_Vec3 a,
AT_Vec3 b )
related

Product of two AT_Vec3.

Parameters
aFirst vector in the multiplication.
bSecond vector in the multiplication.
Return values
AT_Vec3The result of the vector multiplication.

◆ AT_vec3_normalize()

AT_Vec3 AT_vec3_normalize ( AT_Vec3 v)
related

Normalise a given vector to be within 0.0 -> 1.0.

Parameters
vVector to be normalised.
Return values
AT_Vec3A normalised AT_Vec3.

◆ AT_vec3_scale()

AT_Vec3 AT_vec3_scale ( AT_Vec3 v,
float s )
related

Scales an AT_Vec3 by a given scalar.

Parameters
vThe AT_Vec3 to be scaled.
sThe scalar multiple.
Return values
AT_Vec3The result of the scaling the vector by s.

◆ AT_vec3_sub()

AT_Vec3 AT_vec3_sub ( AT_Vec3 a,
AT_Vec3 b )
related

Subtracts two AT_Vec3.

Parameters
aFirst vector in the subtraction.
bSecond vector in the subtraction.
Return values
AT_Vec3The result of the vector subtraction.

◆ AT_vec3_zero()

AT_Vec3 AT_vec3_zero ( void )
related

AT_Vec3 constructor for a zero initialised vector.

Return values
AT_Vec3Vector with all values initialised at 0.