libgpac 0.5.0
|
math and trigo functions. More...
Classes | |
struct | __vec2f |
2D point More... | |
struct | GF_Rect |
rectangle 2D More... | |
struct | GF_IRect |
pixel-aligned rectangle More... | |
struct | GF_Matrix2D |
2D matrix More... | |
struct | __vec3f |
3D point or vector More... | |
struct | __vec4f |
4D vector More... | |
struct | GF_Matrix |
3D matrix More... | |
struct | GF_BBox |
3D Bounding Box More... | |
struct | GF_Plane |
Plane object. More... | |
struct | GF_Ray |
3D Ray More... | |
Defines | |
#define | FIX_ONE |
#define | INT2FIX(v) |
#define | FLT2FIX(v) |
#define | FIX2INT(v) |
#define | FIX2FLT(v) |
#define | FIX_EPSILON |
#define | FIX_MAX |
#define | FIX_MIN |
#define | GF_PI2 |
#define | GF_PI |
#define | GF_2PI |
#define | gf_invfix(_a) |
#define | gf_mulfix(_a, _b) |
#define | gf_muldiv(_a, _b, _c) |
#define | gf_divfix(_a, _b) |
#define | gf_sqrt(_a) |
#define | gf_ceil(_a) |
#define | gf_floor(_a) |
#define | gf_cos(_a) |
#define | gf_sin(_a) |
#define | gf_tan(_a) |
#define | gf_atan2(_y, _x) |
#define | gf_acos(_a) |
#define | gf_asin(_a) |
#define | gf_mx2d_init(_obj) |
matrix initialization | |
#define | gf_mx2d_copy(_obj, from) |
matrix copy | |
#define | gf_mx2d_is_identity(_obj) |
matrix identity testing | |
#define | gf_vec_equal(v1, v2) |
#define | gf_vec_rev(v) |
#define | gf_vec_diff(res, v1, v2) |
#define | gf_vec_add(res, v1, v2) |
#define | gf_quat_len(v) |
#define | gf_quat_norm(v) |
#define | gf_mx_init(_obj) |
matrix initialization | |
#define | gf_mx_copy(_obj, from) |
matrix copy | |
Typedefs | |
typedef Float | Fixed |
typedef struct __vec2f | GF_Point2D |
2D point | |
typedef struct __vec3f | GF_Vec |
3D point or vector | |
typedef struct __vec4f | GF_Vec4 |
4D vector | |
Enumerations | |
enum | { GF_BBOX_FRONT, GF_BBOX_INTER, GF_BBOX_BACK } |
Functions | |
Fixed | gf_angle_diff (Fixed a, Fixed b) |
u32 | gf_get_bit_size (u32 MaxVal) |
Field bit-size. | |
u32 | gf_get_next_pow2 (u32 val) |
Get power of 2. | |
Fixed | gf_v2d_len (GF_Point2D *vec) |
get 2D vector length | |
Fixed | gf_v2d_distance (GF_Point2D *a, GF_Point2D *b) |
get distance between 2 points | |
GF_Point2D | gf_v2d_from_polar (Fixed length, Fixed angle) |
2D vector from polar coordinates | |
void | gf_rect_union (GF_Rect *rc1, GF_Rect *rc2) |
rectangle union | |
GF_Rect | gf_rect_center (Fixed w, Fixed h) |
centers a rectangle | |
Bool | gf_rect_overlaps (GF_Rect rc1, GF_Rect rc2) |
rectangle overlap test | |
Bool | gf_rect_equal (GF_Rect rc1, GF_Rect rc2) |
rectangle identity test | |
GF_IRect | gf_rect_pixelize (GF_Rect *r) |
gets the pixelized version of a rectangle | |
void | gf_mx2d_add_matrix (GF_Matrix2D *_this, GF_Matrix2D *from) |
2D matrix multiplication | |
void | gf_mx2d_pre_multiply (GF_Matrix2D *_this, GF_Matrix2D *from) |
2D matrix pre-multiplication | |
void | gf_mx2d_add_translation (GF_Matrix2D *_this, Fixed cx, Fixed cy) |
matrix translating | |
void | gf_mx2d_add_rotation (GF_Matrix2D *_this, Fixed cx, Fixed cy, Fixed angle) |
matrix rotating | |
void | gf_mx2d_add_scale (GF_Matrix2D *_this, Fixed scale_x, Fixed scale_y) |
matrix scaling | |
void | gf_mx2d_add_scale_at (GF_Matrix2D *_this, Fixed scale_x, Fixed scale_y, Fixed cx, Fixed cy, Fixed angle) |
matrix uncentered scaling | |
void | gf_mx2d_add_skew (GF_Matrix2D *_this, Fixed skew_x, Fixed skew_y) |
matrix skewing | |
void | gf_mx2d_add_skew_x (GF_Matrix2D *_this, Fixed angle) |
matrix horizontal skewing | |
void | gf_mx2d_add_skew_y (GF_Matrix2D *_this, Fixed angle) |
matrix vertical skewing | |
void | gf_mx2d_inverse (GF_Matrix2D *_this) |
matrix inversing | |
void | gf_mx2d_apply_coords (GF_Matrix2D *_this, Fixed *x, Fixed *y) |
matrix coordinate transformation | |
void | gf_mx2d_apply_point (GF_Matrix2D *_this, GF_Point2D *pt) |
matrix point transformation | |
void | gf_mx2d_apply_rect (GF_Matrix2D *_this, GF_Rect *rc) |
matrix rectangle transformation | |
Bool | gf_mx2d_decompose (GF_Matrix2D *_this, GF_Point2D *scale, Fixed *rotate, GF_Point2D *translate) |
matrix decomposition | |
Fixed | gf_vec_len (GF_Vec v) |
get 3D vector length | |
Fixed | gf_vec_lensq (GF_Vec v) |
get 3D vector square length | |
Fixed | gf_vec_dot (GF_Vec v1, GF_Vec v2) |
get 3D vector dot product | |
void | gf_vec_norm (GF_Vec *v) |
vector normalization | |
GF_Vec | gf_vec_scale (GF_Vec v, Fixed f) |
vector scaling | |
GF_Vec | gf_vec_cross (GF_Vec v1, GF_Vec v2) |
vector cross product | |
GF_Vec4 | gf_quat_to_rotation (GF_Vec4 *quat) |
quaternion to rotation | |
GF_Vec4 | gf_quat_from_rotation (GF_Vec4 rot) |
quaternion from rotation | |
GF_Vec4 | gf_quat_get_inv (GF_Vec4 *quat) |
GF_Vec4 | gf_quat_multiply (GF_Vec4 *q1, GF_Vec4 *q2) |
quaternion multiplication | |
GF_Vec | gf_quat_rotate (GF_Vec4 *quat, GF_Vec *vec) |
quaternion vector rotating | |
GF_Vec4 | gf_quat_from_axis_cos (GF_Vec axis, Fixed cos_a) |
quaternion from axis and cos | |
GF_Vec4 | gf_quat_slerp (GF_Vec4 q1, GF_Vec4 q2, Fixed frac) |
quaternion interpolation | |
void | gf_bbox_refresh (GF_BBox *b) |
void | gf_bbox_from_rect (GF_BBox *box, GF_Rect *rc) |
void | gf_rect_from_bbox (GF_Rect *rc, GF_BBox *box) |
void | gf_bbox_grow_point (GF_BBox *box, GF_Vec pt) |
bounding box expansion | |
void | gf_bbox_union (GF_BBox *b1, GF_BBox *b2) |
Bool | gf_bbox_equal (GF_BBox *b1, GF_BBox *b2) |
Bool | gf_bbox_point_inside (GF_BBox *box, GF_Vec *p) |
void | gf_bbox_get_vertices (GF_Vec bmin, GF_Vec bmax, GF_Vec *vecs) |
get box vertices | |
void | gf_mx_from_mx2d (GF_Matrix *mx, GF_Matrix2D *mat2D) |
matrix constructor from 2D | |
Bool | gf_mx_equal (GF_Matrix *mx1, GF_Matrix *mx2) |
matrix identity testing | |
void | gf_mx_add_translation (GF_Matrix *mx, Fixed tx, Fixed ty, Fixed tz) |
matrix translation | |
void | gf_mx_add_scale (GF_Matrix *mx, Fixed sx, Fixed sy, Fixed sz) |
matrix scaling | |
void | gf_mx_add_rotation (GF_Matrix *mx, Fixed angle, Fixed x, Fixed y, Fixed z) |
matrix rotating | |
void | gf_mx_add_matrix (GF_Matrix *mx, GF_Matrix *mul) |
matrices multiplication | |
void | gf_mx_add_matrix_2d (GF_Matrix *mx, GF_Matrix2D *mat2D) |
2D matrix multiplication | |
void | gf_mx_inverse (GF_Matrix *mx) |
affine matrix inversion | |
void | gf_mx_apply_vec (GF_Matrix *mx, GF_Vec *pt) |
matrix point transformation | |
void | gf_mx_apply_rect (GF_Matrix *_this, GF_Rect *rc) |
matrix rectangle transformation | |
void | gf_mx_ortho (GF_Matrix *mx, Fixed left, Fixed right, Fixed bottom, Fixed top, Fixed z_near, Fixed z_far) |
ortho matrix construction | |
void | gf_mx_perspective (GF_Matrix *mx, Fixed foc, Fixed aspect_ratio, Fixed z_near, Fixed z_far) |
perspective matrix construction | |
void | gf_mx_lookat (GF_Matrix *mx, GF_Vec position, GF_Vec target, GF_Vec up_vector) |
creates look matrix | |
void | gf_mx_apply_bbox (GF_Matrix *mx, GF_BBox *b) |
matrix box transformation | |
void | gf_mx_apply_bbox_sphere (GF_Matrix *mx, GF_BBox *box) |
matrix box sphere transformation | |
void | gf_mx_add_matrix_4x4 (GF_Matrix *mat, GF_Matrix *mul) |
non-affine matrix multiplication | |
Bool | gf_mx_inverse_4x4 (GF_Matrix *mx) |
non-affine matrix inversion | |
void | gf_mx_apply_vec_4x4 (GF_Matrix *mx, GF_Vec4 *vec) |
matrix 4D vector transformation | |
void | gf_mx_decompose (GF_Matrix *mx, GF_Vec *translate, GF_Vec *scale, GF_Vec4 *rotate, GF_Vec *shear) |
matrix decomposition | |
void | gf_mx_rotate_vector (GF_Matrix *mx, GF_Vec *pt) |
matrix vector rotation | |
void | gf_mx_rotation_matrix_from_vectors (GF_Matrix *mx, GF_Vec x_axis, GF_Vec y_axis, GF_Vec z_axis) |
matrix initialization from vectors | |
void | gf_mx2d_from_mx (GF_Matrix2D *mx2d, GF_Matrix *mx) |
matrix to 2D matrix | |
void | gf_mx_apply_plane (GF_Matrix *mx, GF_Plane *plane) |
matrix plane transformation | |
Fixed | gf_plane_get_distance (GF_Plane *plane, GF_Vec *p) |
point to plane distance | |
GF_Vec | gf_closest_point_to_line (GF_Vec line_pt, GF_Vec line_vec, GF_Vec pt) |
closest point on a line | |
u32 | gf_plane_get_p_vertex_idx (GF_Plane *p) |
box p-vertex index | |
Bool | gf_plane_intersect_line (GF_Plane *plane, GF_Vec *linepoint, GF_Vec *linevec, GF_Vec *outPoint) |
plane line intersection | |
u32 | gf_bbox_plane_relation (GF_BBox *box, GF_Plane *p) |
box-plane relation | |
GF_Ray | gf_ray (GF_Vec start, GF_Vec end) |
ray constructor | |
void | gf_mx_apply_ray (GF_Matrix *mx, GF_Ray *r) |
matrix ray transformation | |
Bool | gf_ray_hit_box (GF_Ray *ray, GF_Vec min_edge, GF_Vec max_edge, GF_Vec *out_point) |
ray box intersection test | |
Bool | gf_ray_hit_sphere (GF_Ray *ray, GF_Vec *center, Fixed radius, GF_Vec *out_point) |
ray sphere intersection test | |
Bool | gf_ray_hit_triangle (GF_Ray *ray, GF_Vec *v0, GF_Vec *v1, GF_Vec *v2, Fixed *dist) |
ray triangle intersection test | |
Bool | gf_ray_hit_triangle_backcull (GF_Ray *ray, GF_Vec *v0, GF_Vec *v1, GF_Vec *v2, Fixed *dist) |
ray triangle intersection test |
>