# Vector math

Therse are common functions used in vector math

### f_sqrtf

float f_sqrtf(float value);

Description: Computes the squareroot for 32 bit floats.

### f_length2f

float f_length2f(float *vec);

Description: Computes the length of a vector 2D for 32 bit floats.

### f_length3f

float f_length3f(float *vec);

Description: Computes the length of a vector 3D for 32 bit floats.

### f_distance2f

float f_distance2f(float *a, float *b);

Description: Computes the distance between two points in 2D for 32 bit floats.

### f_distance3f

float f_distance3f(float *a, float *b);

Description: Computes the distance between two points in 3D for 32 bit floats.

### f_dot2f

float f_dot2f(float *a, float *b);

Description: Computes the dot product between two points in 2D for 32 bit floats.

### f_dot3f

float f_dot3f(float *a, float *b);

Description: Computes the dot product between two points in 3D for 32 bit floats.

### f_cross2f

void f_cross2f(float *output, float *a, float *b);

Description: Computes cross product between two points in 2D for 32 bit floats.

### f_cross3f

void f_cross3f(float *output, float *a, float *b);

Description: Computes cross product between two points in 3D for 32 bit floats.

### f_normalize2f

float f_normalize2f(float *vec);

Description: Normalizes a 2D vector of 32 bit floats.

### f_normalize3f

float f_normalize3f(float *vec);

Description: Normalizes a 3D vector of 32 bit floats.

### f_normalize4f

float f_normalize4f(float *vec);

Description: Normalizes a 4D vector of 32 bit floats (useful for quaternions).

### f_vector2f

void f_vector2f(float *vec, float *start, float *end);

Description: Creates a 2D vector of 32 bit floats from 2 points.

### f_vector3f

void f_vector3f(float *vec, float *start, float *end);

Description: Creates a 3D vector of 32 bit floats from 2 points.

### f_vector4f

void f_vector4f(float *vec, float *start, float *end);

Description: Creates a 4D vector of 32 bit floats from 2 points.

### f_vector_normalized2f

float f_vector_normalized2f(float *vec, float *start, float *end);

Description: Creates a normalized 2D vector of 64 bit floats form 2 points.

### f_vector_normalized3f

float f_vector_normalized3f(float *vec, float *start, float *end);

Description: Creates a normalized 3D vector of 32 bit floats form 2 points.

### f_vector_normalized4f

float f_vector_normalized4f(float *vec, float *start, float *end);

Description: Creates a normalized 4D vector of 64 bit floats form 2 points.

### f_normal2f

void f_normal2f(float *output, float *a, float *b);

Description: Generates a normal from 2 points on a line.

### f_normal3f

void f_normal3f(float *output, float *a, float *b, float *c);

Description: Generates a normal from 3 points on a plane.

### f_area2f

float f_area2f(float *a, float *b, float *c);

Description: Computes the area of a 2D triangle.

### f_area3f

float f_area3f(float *a, float *b, float *c);

Description: Computes the area of a 3D triangle.

### f_reflect2f

void f_reflect2f(float *output, float *pos, float *normal);

Description: Reflects a position to a normal plane in 2D for 32 bit floats.

### f_reflect3f

void f_reflect3f(float *output, float *pos, float *normal);

Description: Reflects a position to a normal plane in 3D for 32 bit floats.

### f_flatten2f

void f_flatten2f(float *output, float *pos, float *normal);

Description: Flattens a position to a normal plane in 2D for 32 bit floats.

### f_flatten3f

void f_flatten3f(float *output, float *pos, float *normal);

Description: Flattens a position to a normal plane in 3D for 32 bit floats.

### f_project2f

void f_project2f(float *output, float *plane_pos, float *normal, float *pos, float *vector);

Description: projects from aposition along a vector on to a positioned planein 2D for 32 bit floats.

### f_project3f

void f_project3f(float *output, float *plane_pos, float *normal, float *pos, float *vector);

Description: projects from aposition along a vector on to a positioned planein 3D for 32 bit floats.

### f_intersect2f

void f_intersect2f(float *output, float *line_a0, float *line_a1, float *line_b0, float *line_b1);

Description: Computes the intersection between two lines in 2D for 32 bit floats.

### f_intersect_test2f

int f_intersect_test2f(float *line_a0, float *line_a1, float *line_b0, float *line_b1);

Description: Tests if two 32bit float line segments intersect.

### f_intersect3f

void f_intersect3f(float *output, float *line_a0, float *line_a1, float *line_b0, float *line_b1);

Description: finds the point on line line_a0 to line_a1 that is closest to line line_b0 to line_b1.

### f_distance_to_line3f

float f_distance_to_line3f(float *line_a, float *line_b, float *pos);

Description: finds the distance between a point and a line in 3D for 32 bit floats

### f_length2d

double f_length2d(double *vec);

Description: Computes the length of a vector 2D for 64 bit doubles.

### f_length3d

double f_length3d(double *vec);

Description: Computes the length of a vector 3D for 64 bit doubles.

### f_distance2d

double f_distance2d(double *a, double *b);

Description: Computes the distance between two points in 2D for 64 bit doubles.

### f_distance3d

double f_distance3d(double *a, double *b);

Description: Computes the distance between two points in 3D for 64 bit doubles.

### f_dot2d

double f_dot2d(double *a, double *b);

Description: Computes the dot product between two points in 2D for 64 bit doubles.

### f_dot3d

double f_dot3d(double *a, double *b);

Description: Computes the dot product between two points in 3D for 64 bit doubles.

### f_cross2d

void f_cross2d(double *output, double *a, double *b);

Description: Computes cross product between two points in 2D for 64 bit doubles.

### f_cross3d

void f_cross3d(double *output, double *a, double *b);

Description: Computes cross product between two points in 3D for 64 bit doubles.

### f_normalize2d

double f_normalize2d(double *vec);

Description: Normalizes a 2D vector of 64 bit doubles.

### f_normalize3d

double f_normalize3d(double *vec);

Description: Normalizes a 3D vector of 64 bit doubles.

### f_normalize4d

double f_normalize4d(double *vec);

Description: Normalizes a 4D vector of 64 bit doubles (useful for quaternions).

### f_vector2d

void f_vector2d(double *vec, double *start, double *end);

Description: Creates a 2D vector of 64 bit doubles from 2 points.

### f_vector3d

void f_vector3d(double *vec, double *start, double *end);

Description: Creates a 3D vector of 64 bit doubles from 2 points.

### f_vector4d

void f_vector4d(double *vec, double *start, double *end);

Description: Creates a 4D vector of 64 bit doubles from 2 points.

### f_vector_normalized2d

double f_vector_normalized2d(double *vec, double *start, double *end);

Description: Creates a normalized 2D vector of 64 bit doubles from 2 points.

### f_vector_normalized3d

double f_vector_normalized3d(double *vec, double *start, double *end);

Description: Creates a normalized 3D vector of 64 bit doubles from 2 points.

### f_vector_normalized4d

double f_vector_normalized4d(double *vec, double *start, double *end);

Description: Creates a normalized 4D vector of 64 bit doubles from 2 points.

### f_normal2d

void f_normal2d(double *output, double *a, double *b);

Description: Generates a normal from 2 points on a line.

### f_normal3d

void f_normal3d(double *output, double *a, double *b, double *c);

Description: Generates a normal from 3 points on a plane.

### f_area2d

double f_area2d(double *a, double *b, double *c);

Description: Computes the area of a 2D triangle.

### f_area3d

double f_area3d(double *a, double *b, double *c);

Description: Computes the area of a 3D triangle.

### f_reflect2d

void f_reflect2d(double *output, double *pos, double *normal);

Description: Reflects a position to a normal plane in 2D for 64 bit doubles.

### f_reflect3d

void f_reflect3d(double *output, double *pos, double *normal);

Description: Reflects a position to a normal plane in 3D for 64 bit doubles.

### f_flatten2d

void f_flatten2d(double *output, double *pos, double *normal);

Description: Flattens a position to a normal plane in 2D for 64 bit doubles.

### f_flatten3d

void f_flatten3d(double *output, double *pos, double *normal);

Description: Flattens a position to a normal plane in 3D for 64 bit doubles.

### f_project2d

void f_project2d(double *output, double *plane_pos, double *normal, double *pos, double *vector);

Description: projects from aposition along a vector on to a positioned planein 2D for 64 bit doubles.

### f_project3d

void f_project3d(double *output, double *plane_pos, double *normal, double *pos, double *vector);

Description: projects fr0m aposition along a vector on to a positioned planein 3D for 64 bit doubles.

### f_intersect2d

void f_intersect2d(double *output, double *line_a0, double *line_a1, double *line_b0, double *line_b1);

Description: Computes the intersection between two lines in 2D for 64 bit doubles.

### f_intersect_test2d

int f_intersect_test2d(double *line_a0, double *line_a1, double *line_b0, double *line_b1);

Description: Tests if two 64bit float line segments intersect.

### f_intersect3d

void f_intersect3d(double *output, double *line_a0, double *line_a1, double *line_b0, double *line_b1);

Description: finds the point on line line_a0 to line_a1 that is closest to line line_b0 to line_b1.

### f_distance_to_line3d

float f_distance_to_line3d(double *line_a, double *line_b, double *pos);

Description: finds the distance between a point and a line in 3D for 64 bit doubles