Skip to content
tiffany352 edited this page Aug 10, 2012 · 1 revision

Sypnosis

#include "common/matrix.h"

sg_Vector2 sg_Vector2_add(sg_Vector2 a, sg_Vector2 b);
sg_Vector2 sg_Vector2_sub(sg_Vector2 a, sg_Vector2 b);
sg_Vector2 sg_Vector2_mul(sg_Vector2 a, sg_Vector2 b);
sg_Vector2 sg_Vector2_mul_f(sg_Vector2 a, float b);
sg_Vector2 sg_Vector2_div(sg_Vector2 a, sg_Vector2 b);
sg_Vector2 sg_Vector2_div_f(sg_Vector2 a, float b);
float sg_Vector2_len(sg_Vector2 v);
sg_Vector2 sg_Vector2_normalise(sg_Vector2 v);
float sg_Vector2_dot(sg_Vector2 a, sg_Vector2 b);

sg_Vector3 sg_Vector3_add(sg_Vector3 a, sg_Vector3 b);
sg_Vector3 sg_Vector3_sub(sg_Vector3 a, sg_Vector3 b);
sg_Vector3 sg_Vector3_mul(sg_Vector3 a, sg_Vector3 b);
sg_Vector3 sg_Vector3_mul_f(sg_Vector3 a, float b);
sg_Vector3 sg_Vector3_div(sg_Vector3 a, sg_Vector3 b);
sg_Vector3 sg_Vector3_div_f(sg_Vector3 a, float b);
float sg_Vector3_len(sg_Vector3 v);
sg_Vector3 sg_Vector3_normalise(sg_Vector3 v);
float sg_Vector3_dot(sg_Vector3 a, sg_Vector3 b);
sg_Vector3 sg_Vector3_cross(sg_Vector3 a, sg_Vector3 b);

sg_Matrix sg_Matrix_mul(sg_Matrix a, sg_Matrix b);
sg_Matrix sg_Matrix_transform(sg_Matrix m, sg_Vector3 t);
sg_Matrix sg_Matrix_rotate_v(sg_Matrix m, float a, sg_Vector3 n);
sg_Matrix sg_Matrix_scale(sg_Matrix m, sg_Vector3 v); 

sg_Quaternion sg_Quaternion_new(sg_Vector3 v, float a);
sg_Vector3 sg_Vector3_rotate(sg_Vector3 p, sg_Quaternion q);
sg_Matrix sg_Matrix_rotate_q(sg_Matrix m, sg_Quaternion q);

Description

This header is the matrix library from sCenegraph, since modified, used in IntenseLogic for vector, matrix, and quaternion operations.

Each function is defined with the following prototype: <Type> sg_<Type>_<operation>[_<extratype>] ( Type arguments [, extratype extra_arg ] );

The Vector2 struct is defined as:

  • float x, y - X and Y axes

The Vector3 struct is defined as:

  • float x, y, z - X, Y, and Z axes

The Matrix struct is defined as:

  • float data[16] - Array containing the values of the 4x4 matrix in a left-to-right top-to-bottom format

The Quaternion struct is defined as:

  • float x, y, z - Real part
  • float w - Imaginary part

See Also

Clone this wiki locally