Swadge 2024 2.0.0
APIs to develop games for the Magfest Swadge
Loading...
Searching...
No Matches
vectorFl2d.c File Reference

Functions

vecFl_t addVecFl2d (vecFl_t left, vecFl_t right)
 Add two vectors and return the resulting vector.
 
vecFl_t subVecFl2d (vecFl_t left, vecFl_t right)
 Subtract two vectors and return the resulting vector.
 
vecFl_t mulVecFl2d (vecFl_t vector, float scalar)
 Multiply a vector by a scalar and return the result.
 
vecFl_t divVecFl2d (vecFl_t vector, float scalar)
 Divide a vector by a scalar and return the result.
 
float dotVecFl2d (vecFl_t left, vecFl_t right)
 Find the dot product of two vectors.
 
vecFl_t rotateVecFl2d (vecFl_t vector, float radians)
 Rotate a vector by a number of degrees and return the result.
 
float sqMagVecFl2d (vecFl_t vector)
 Return the squared magnitude of the given vector. The square root is not used because it is slow.
 
float magVecFl2d (vecFl_t vector)
 Compute the magnitude of a vector.
 
vecFl_t normVecFl2d (vecFl_t in)
 Normalize and return a vector.
 
vecFl_t perpendicularVecFl2d (vecFl_t in)
 Return a vector perpendicular to the input.
 

Function Documentation

◆ addVecFl2d()

vecFl_t addVecFl2d ( vecFl_t left,
vecFl_t right )

Add two vectors and return the resulting vector.

Parameters
leftOne vector to add
rightThe other vector to add
Returns
The sum of both vectors

◆ subVecFl2d()

vecFl_t subVecFl2d ( vecFl_t left,
vecFl_t right )

Subtract two vectors and return the resulting vector.

Parameters
leftThe vector to subtract from
rightThe other vector to subtract
Returns
The difference between the vectors

◆ mulVecFl2d()

vecFl_t mulVecFl2d ( vecFl_t vector,
float scalar )

Multiply a vector by a scalar and return the result.

Parameters
vectorThe vector to multiply
scalarThe scalar to multiply by
Returns
The multiplied vector

◆ divVecFl2d()

vecFl_t divVecFl2d ( vecFl_t vector,
float scalar )

Divide a vector by a scalar and return the result.

Parameters
vectorThe vector to divide
scalarThe scalar to divide by
Returns
The divided vector

◆ dotVecFl2d()

float dotVecFl2d ( vecFl_t left,
vecFl_t right )

Find the dot product of two vectors.

Parameters
leftOne vector to dot
rightThe other vector to dot
Returns
The dot product of the two vectors

◆ rotateVecFl2d()

vecFl_t rotateVecFl2d ( vecFl_t vector,
float radians )

Rotate a vector by a number of degrees and return the result.

Parameters
vectorThe vector to rotate
radiansThe angle to rotate clockwise by, in radians
Returns
The rotated vector

◆ sqMagVecFl2d()

float sqMagVecFl2d ( vecFl_t vector)

Return the squared magnitude of the given vector. The square root is not used because it is slow.

Parameters
vectorThe vector to get the squared magnitude for
Returns
The squared magnitude of the vector

◆ magVecFl2d()

float magVecFl2d ( vecFl_t vector)

Compute the magnitude of a vector.

Parameters
vectorThe vector to compute magnitude for
Returns
The magnitude

◆ normVecFl2d()

vecFl_t normVecFl2d ( vecFl_t in)

Normalize and return a vector.

Parameters
inThe input vector
Returns
The normalized vector

◆ perpendicularVecFl2d()

vecFl_t perpendicularVecFl2d ( vecFl_t in)

Return a vector perpendicular to the input.

Parameters
inThe input vector
Returns
The perpendicular vector