SSBM Decomp
Loading...
Searching...
No Matches
lbvector.h File Reference
#include <baselib/forward.h>
#include <dolphin/mtx.h>
#include <MetroTRK/intrinsics.h>

Go to the source code of this file.

Functions

static float lbVector_Len (Vec3 *vec)
 
static float lbVector_Len_xy (Vec3 *vec)
 
float lbVector_Normalize (Vec3 *vec)
 
float lbVector_NormalizeXY (Vec3 *a)
 
Vec3 * lbVector_Add (Vec3 *a, Vec3 *b)
 
Vec3 * lbVector_Add_xy (Vec3 *a, Vec3 *b)
 
Vec3 * lbVector_Sub (Vec3 *a, Vec3 *b)
 
Vec3 * lbVector_Diff (Vec3 *a, Vec3 *b, Vec3 *result)
 
Vec3 * lbVector_CrossprodNormalized (Vec3 *a, Vec3 *b, Vec3 *result)
 
float lbVector_Angle (Vec3 *a, Vec3 *b)
 8000D620 - returns the angle between a and b
 
float lbVector_AngleXY (Vec3 *a, Vec3 *b)
 8000D790 - returns the angle between a and b
 
static float sin (float angle)
 
static float cos (float angle)
 
void lbVector_RotateAboutUnitAxis (Vec3 *v, Vec3 *axis, float angle)
 8000D8F4 Rotates v by angle about the given axis.
 
void lbVector_Rotate (Vec3 *v, int axis, float angle)
 
float dummy (void)
 
void lbVector_Mirror (Vec3 *a, Vec3 *b)
 8000DC6C - compute a -= 2*<a,b>*b.
 
float lbVector_CosAngle (Vec3 *a, Vec3 *b)
 8000DCA8 - returns <a/|a|, b/|b|>, which is the cosine of the angle between a and b.
 
Vec3 * lbVector_Lerp (Vec3 *a, Vec3 *b, Vec3 *result, float f)
 8000DDAC - linearly interpolates between a and b as f goes from 0 to 1, returns a + f*(b-a).
 
Vec3 * lbVector_8000DE38 (Mtx m, Vec3 *v, float c)
 
Vec3 * lbVector_EulerAnglesFromONB (Vec3 *result_angles, Vec3 *a, Vec3 *b, Vec3 *c)
 8000DF0C - computes euler angles phi_x,phi_y,phi_z that rotate the standard basis (e1,e2,e3) onto the orthonormal basis (b,c,a) with 3 rotations about the x,y,z axes in that order.
 
Vec3 * lbVector_EulerAnglesFromPartialONB (Vec3 *result_angles, Vec3 *a, Vec3 *c)
 8000DFF4 - returns lbVector_EulerAnglesFromONB(result_angles, a, c cross a, c).
 
Vec3 * lbVector_ApplyEulerRotation (Vec3 *v, Vec3 *angles)
 8000E138
 
float lbVector_sqrtf_accurate (float x)
 8000E19C
 
Vec3 * lbVector_WorldToScreen (HSD_CObj *cobj, const Vec3 *pos3d, Vec3 *screenCoords, int d)
 8000E210
 
void lbVector_CreateEulerMatrix (Mtx m, Vec3 *angles)
 8000E530 - Sets m to the 3x3 euler matrix that rotates about the x,y,z axes with angles angles.x, angles.y, angles.z in that order, that means m = rotation_matrix_z(angles.z) * rotation_matrix_y(angles.y) * rotation_matrix_x(angles.x) Column 4 of m is then set to (0,0,0) because there is no translational component.
 
float lbVector_8000E838 (Vec3 *a, Vec3 *b, Vec3 *c, Vec3 *d)
 8000E838 - This function seems to have a very specific use case and is only used once in Camera_CheckToStopDrawingHighPoly(80030cfc), here's what it does: Let u = b-a, then compute the intersection of the line through a with direction u with the plane that contains c and is perpendicular to u.
 

Function Documentation

◆ lbVector_Len()

static float lbVector_Len ( Vec3 *  vec)
static

◆ lbVector_Len_xy()

static float lbVector_Len_xy ( Vec3 *  vec)
static

◆ lbVector_Normalize()

float lbVector_Normalize ( Vec3 *  vec)

◆ lbVector_NormalizeXY()

float lbVector_NormalizeXY ( Vec3 *  a)

◆ lbVector_Add()

Vec3 * lbVector_Add ( Vec3 *  a,
Vec3 *  b 
)

◆ lbVector_Add_xy()

Vec3 * lbVector_Add_xy ( Vec3 *  a,
Vec3 *  b 
)

◆ lbVector_Sub()

Vec3 * lbVector_Sub ( Vec3 *  a,
Vec3 *  b 
)

◆ lbVector_Diff()

Vec3 * lbVector_Diff ( Vec3 *  a,
Vec3 *  b,
Vec3 *  result 
)

◆ lbVector_CrossprodNormalized()

Vec3 * lbVector_CrossprodNormalized ( Vec3 *  a,
Vec3 *  b,
Vec3 *  result 
)

◆ lbVector_Angle()

float lbVector_Angle ( Vec3 *  a,
Vec3 *  b 
)

8000D620 - returns the angle between a and b

◆ lbVector_AngleXY()

float lbVector_AngleXY ( Vec3 *  a,
Vec3 *  b 
)

8000D790 - returns the angle between a and b

◆ sin()

static float sin ( float  angle)
static

◆ cos()

static float cos ( float  angle)
static

◆ lbVector_RotateAboutUnitAxis()

void lbVector_RotateAboutUnitAxis ( Vec3 *  v,
Vec3 *  axis,
float  angle 
)

8000D8F4 Rotates v by angle about the given axis.

The axis must have unit length, the angle is in radians. Rotation is oriented such that rotating (1,0,0) about the (0,0,1) axis results in (0,1,0).

◆ lbVector_Rotate()

void lbVector_Rotate ( Vec3 *  v,
int  axis,
float  angle 
)

◆ dummy()

float dummy ( void  )

◆ lbVector_Mirror()

void lbVector_Mirror ( Vec3 *  a,
Vec3 *  unit_mirror_axis 
)

8000DC6C - compute a -= 2*<a,b>*b.

When b has unit length, this mirrors a at the plane that is perpendicular to b and contains the origin.

◆ lbVector_CosAngle()

float lbVector_CosAngle ( Vec3 *  a,
Vec3 *  b 
)

8000DCA8 - returns <a/|a|, b/|b|>, which is the cosine of the angle between a and b.

◆ lbVector_Lerp()

Vec3 * lbVector_Lerp ( Vec3 *  a,
Vec3 *  b,
Vec3 *  result,
float  f 
)

8000DDAC - linearly interpolates between a and b as f goes from 0 to 1, returns a + f*(b-a).

The numerical error can be large for f=1 when b is small compared to a.

◆ lbVector_8000DE38()

Vec3 * lbVector_8000DE38 ( Mtx  m,
Vec3 *  v,
float  c 
)

◆ lbVector_EulerAnglesFromONB()

Vec3 * lbVector_EulerAnglesFromONB ( Vec3 *  result_angles,
Vec3 *  a,
Vec3 *  b,
Vec3 *  c 
)

8000DF0C - computes euler angles phi_x,phi_y,phi_z that rotate the standard basis (e1,e2,e3) onto the orthonormal basis (b,c,a) with 3 rotations about the x,y,z axes in that order.

◆ lbVector_EulerAnglesFromPartialONB()

Vec3 * lbVector_EulerAnglesFromPartialONB ( Vec3 *  result_angles,
Vec3 *  a,
Vec3 *  c 
)

8000DFF4 - returns lbVector_EulerAnglesFromONB(result_angles, a, c cross a, c).

When rotating about the x,y,z angles about the euler angles returned from that function in that order, the standard basis (e1,e2,e3) is rotated onto (c cross a,c,a).

◆ lbVector_ApplyEulerRotation()

Vec3 * lbVector_ApplyEulerRotation ( Vec3 *  v,
Vec3 *  angles 
)

8000E138

◆ lbVector_sqrtf_accurate()

float lbVector_sqrtf_accurate ( float  x)

8000E19C

◆ lbVector_WorldToScreen()

Vec3 * lbVector_WorldToScreen ( HSD_CObj cobj,
const Vec3 *  pos3d,
Vec3 *  screenCoords,
int  d 
)

8000E210

◆ lbVector_CreateEulerMatrix()

void lbVector_CreateEulerMatrix ( Mtx  m,
Vec3 *  angles 
)

8000E530 - Sets m to the 3x3 euler matrix that rotates about the x,y,z axes with angles angles.x, angles.y, angles.z in that order, that means m = rotation_matrix_z(angles.z) * rotation_matrix_y(angles.y) * rotation_matrix_x(angles.x) Column 4 of m is then set to (0,0,0) because there is no translational component.

◆ lbVector_8000E838()

float lbVector_8000E838 ( Vec3 *  a,
Vec3 *  b,
Vec3 *  c,
Vec3 *  d 
)

8000E838 - This function seems to have a very specific use case and is only used once in Camera_CheckToStopDrawingHighPoly(80030cfc), here's what it does: Let u = b-a, then compute the intersection of the line through a with direction u with the plane that contains c and is perpendicular to u.

Write the result to d. If u is numerically too small, set d=a instead. Return the length of c-d.