Skip to content

Simple C library for OpenGL math aimed at readability

License

Notifications You must be signed in to change notification settings

yatima1460/CGLMath

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

15 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Summary

Members Descriptions
public float float_min(float a,float b)
public float float_max(float a,float b)
public float float_clamp(float value,float value_min,float value_max)
public float float_rad(float degree)
public Matrix4f matrix4f_identity()
public Matrix4f matrix4f_mul(Matrix4f m1,Matrix4f m2)
public Matrix4f matrix4f_scale(Matrix4f m,Vector3f v)
public Matrix4f matrix4f_mul_scalar(Matrix4f m,float scalar)
public Matrix4f matrix4f_perspective(float fov,float ratio,float near,float far)
public Matrix4f matrix4f_lookat(Vector3f eye,Vector3f target,Vector3f axis)
public Matrix4f matrix4f_translate(Matrix4f m,Vector3f v)
public Matrix4f matrix4f_translate_make(Vector3f position)
public Matrix4f matrix4f_rotate(Matrix4f m,float angle,Vector3f axis)
public Matrix4f matrix4f_mul_rot(Matrix4f m1,Matrix4f m2)
public Matrix4f matrix4f_rotate_make(float angle,Vector3f axis)
public Matrix4f matrix4f_inv(Matrix4f mat)
public Matrix4f matrix4f_ortho(float left,float right,float bottom,float top,float near,float far)
public Quaternion quaternion_identity() Identity
public Quaternion quaternion_normalize(Quaternion q) Normalizes the quaternion
public Matrix4f quaternion_to_matrix4f(Quaternion q)
public Vector3f quaternion_imaginary(Quaternion q)
public float quaternion_real(Quaternion q) Returns the real part of the quaternion
public Quaternion quaternion_mul(Quaternion q1,Quaternion q2)
public Quaternion quaternion_make(float angle,Vector3f axis)
public Vector3f quaternion_forward(Quaternion q) Gets the forward vector of the quaternion
public Vector3f quaternion_right(Quaternion q)
public float quaternion_magnitude(Quaternion q)
public Transform transform_identity()
public Matrix4f transform_to_matrix(struct transform transform)
public Vector3f vector3f_add(Vector3f a,Vector3f b)
public Vector3f vector3f_sub(Vector3f a,Vector3f b)
public Vector3f vector3f_mul(Vector3f a,Vector3f b)
public Vector3f vector3f_make(float x,float y,float z)
public Vector3f vector3f_scale(Vector3f v,float f)
public float vector3f_dot(Vector3f v1,Vector3f v2)
public Vector3f vector3f_cross(Vector3f v1,Vector3f v2)
public Vector3f vector3f_div_scalar(Vector3f v,float s)
public Vector3f vector3f_normalize(Vector3f v)
public float vector3f_magnitude(Vector3f v)
public Vector3f vector3f_negate(Vector3f v)
public Vector3f vector3f_zero()
public Vector3f vector3f_one()
public Vector3f vector3f_mul_scalar(Vector3f v,float s)
public Vector3f vector3f_rotate(Vector3f v,Quaternion q) Rotates a vector using a quaternion
public Vector4f vector4f_one()

Members

public float float_min(float a,float b)

public float float_max(float a,float b)

public float float_clamp(float value,float value_min,float value_max)

public float float_rad(float degree)

public Matrix4f matrix4f_identity()

public Matrix4f matrix4f_mul(Matrix4f m1,Matrix4f m2)

public Matrix4f matrix4f_scale(Matrix4f m,Vector3f v)

public Matrix4f matrix4f_mul_scalar(Matrix4f m,float scalar)

public Matrix4f matrix4f_perspective(float fov,float ratio,float near,float far)

public Matrix4f matrix4f_lookat(Vector3f eye,Vector3f target,Vector3f axis)

public Matrix4f matrix4f_translate(Matrix4f m,Vector3f v)

public Matrix4f matrix4f_translate_make(Vector3f position)

public Matrix4f matrix4f_rotate(Matrix4f m,float angle,Vector3f axis)

public Matrix4f matrix4f_mul_rot(Matrix4f m1,Matrix4f m2)

public Matrix4f matrix4f_rotate_make(float angle,Vector3f axis)

public Matrix4f matrix4f_inv(Matrix4f mat)

public Matrix4f matrix4f_ortho(float left,float right,float bottom,float top,float near,float far)

public Quaternion quaternion_identity()

Identity

Returns

the identity quaternion

public Quaternion quaternion_normalize(Quaternion q)

Normalizes the quaternion

Parameters

  • q

Returns

public Matrix4f quaternion_to_matrix4f(Quaternion q)

public Vector3f quaternion_imaginary(Quaternion q)

public float quaternion_real(Quaternion q)

Returns the real part of the quaternion

Parameters

  • q

Returns

public Quaternion quaternion_mul(Quaternion q1,Quaternion q2)

public Quaternion quaternion_make(float angle,Vector3f axis)

public Vector3f quaternion_forward(Quaternion q)

Gets the forward vector of the quaternion

Parameters

  • q

Returns

public Vector3f quaternion_right(Quaternion q)

public float quaternion_magnitude(Quaternion q)

public Transform transform_identity()

public Matrix4f transform_to_matrix(struct transform transform)

public Vector3f vector3f_add(Vector3f a,Vector3f b)

public Vector3f vector3f_sub(Vector3f a,Vector3f b)

public Vector3f vector3f_mul(Vector3f a,Vector3f b)

public Vector3f vector3f_make(float x,float y,float z)

public Vector3f vector3f_scale(Vector3f v,float f)

public float vector3f_dot(Vector3f v1,Vector3f v2)

public Vector3f vector3f_cross(Vector3f v1,Vector3f v2)

public Vector3f vector3f_div_scalar(Vector3f v,float s)

public Vector3f vector3f_normalize(Vector3f v)

public float vector3f_magnitude(Vector3f v)

public Vector3f vector3f_negate(Vector3f v)

public Vector3f vector3f_zero()

public Vector3f vector3f_one()

public Vector3f vector3f_mul_scalar(Vector3f v,float s)

public Vector3f vector3f_rotate(Vector3f v,Quaternion q)

Rotates a vector using a quaternion

Parameters

  • vA the vector to rotate

  • qA the quaternion as rotation

Returns

the vector rotated

public Vector4f vector4f_one()

Generated by Moxygen