GSP
Quick Navigator

Search Site

Unix VPS
A - Starter
B - Basic
C - Preferred
D - Commercial
MPS - Dedicated
Previous VPSs
* Sign Up! *

Support
Contact Us
Online Help
Handbooks
Domain Status
Man Pages

FAQ
Virtual Servers
Pricing
Billing
Technical

Network
Facilities
Connectivity
Topology Map

Miscellaneous
Server Agreement
Year 2038
Credits
 

USA Flag

 

 

Man Pages
M_QUATERNION(3) FreeBSD Library Functions Manual M_QUATERNION(3)

M_QuaternionAgar-Math quaternion

#include <agar/core.h>
#include <agar/gui.h>
#include <agar/math/m.h>

The M_Quaternion structure describes a quaternion. Quaternions are a non-commutative extension of complex numbers (see M_Complex(3)). Quaternions provide a convenient way of representing and concatenating rotations. The structure is defined as:

typedef struct m_quaternion {
	M_Real w, x, y, z;
} M_Quaternion;

M_Quaternion
(void);


M_Quaternion
(void);


M_Quaternion
(AG_DataSource *ds);


void
(AG_DataSource *ds, M_Quaternion q);

The () routine returns the multiplicative identity (1,0,0,0). M_QuaternionAddIdentity() returns the additive identity (0,0,0,0).

The () function reads a quaternion from an AG_DataSource(3) and returns it. M_WriteQuaternion() writes a quaternion to a data source.

void
M_QuaternionpToAxisAngle(const M_Quaternion *q, M_Vector3 *axis, M_Real *theta);


void
(const M_Quaternion *q, M_Real *theta, M_Real *x, M_Real *y, M_Real *z);


M_Quaternion
(M_Vector3 axis, M_Real theta);


M_Quaternion
(M_Real theta, M_Real x, M_Real y, M_Real z);


void
(M_Quaternion *q, M_Vector3 axis, M_Real theta);


void
(M_Quaternion *q, M_Real theta, M_Real x, M_Real y, M_Real z);


void
(M_Quaternion *q, M_Real a, M_Real b, M_Real c);


M_Quaternion
(M_Real a, M_Real b, M_Real c);


void
(M_Matrix44 *A, const M_Quaternion *q);

The () function obtains a rotation in axis-angle format from a quaternion q. The axis is returned into v and angle into theta. The M_QuaternionpToAxisAngle3() variant returns the axis into x, y and z.

() returns a quaternion describing a rotation of theta radians about the axis vector. The M_QuaternionFromAxisAngle3() form accepts individual x, y, z arguments.

The () and M_QuaternionpFromAxisAngle3() variants write the resulting quaternion into q as opposed to returning it.

() and M_QuaternionFromEul() return a quaternion describing a rotation given the set of Euler angles.

() converts the rotation described by quaternion q into a 4x4 matrix A.

void

M_Quaternion
M_QuaternionConj(M_Quaternion q);


M_Quaternion
(const M_Quaternion *q);


void
(M_Quaternion *q);


M_Quaternion
(M_Quaternion q, M_Real c);


M_Quaternion
(const M_Quaternion *q, M_Real c);


void
(M_Quaternion *q, M_Real c);


M_Quaternion
(const M_Quaternion *q1, const M_Quaternion *q2);


M_Quaternion
(M_Quaternion q1, M_Quaternion q2);


M_Quaternion
(const M_Quaternion *q1, const M_Quaternion *q2);


void
(M_Quaternion *q, const M_Quaternion *q1, const M_Quaternion *q2);


M_Quaternion
(const M_Quaternion *q);


void
(M_Quaternion *q);


M_Quaternion
(M_Quaternion q);


M_Quaternion
(const M_Quaternion *q);


void
(M_Quaternion *q);


M_Quaternion
(M_Quaternion q1, M_Quaternion q2, M_Real c);


M_Quaternion
(const M_Quaternion *q1, const M_Quaternion *q2, M_Real c);

(), M_QuaternionConjp() and M_QuaternionConjv() return the conjugate of q.

(), M_QuaternionScalep() and M_QuaternionScalev() return the quaternion q scaled by factor c.

() concatenates the rotations described by q1 and q2 and returns the resulting quaternion.

(), M_QuaternionMultp() and M_QuaternionMultv() compute the product of q1 and q2.

() and M_QuaternionNormv() return the normalized form of q (equivalent to normalizing q as a vector).

(), M_QuaternionInversep() and M_QuaternionInversev() return the inverse (i.e., the normalized form of the conjugate) of q.

The functions () and M_QuaternionSLERPp() perform spherical linear interpolation (SLERP) between q1 and q2, by factor c, and returns the result.

AG_DataSource(3), AG_Intro(3), M_Complex(3), M_Matrix(3), M_Real(3), M_Vector(3)

The M_Quaternion structure first appeared in Agar 1.3.4.

December 21, 2022 Agar 1.7

Search for    or go to Top of page |  Section 3 |  Main Index

Powered by GSP Visit the GSP FreeBSD Man Page Interface.
Output converted with ManDoc.