| mialm Reference Manual | ||||
|---|---|---|---|---|
| Top | Description | ||||
MiaQuaternion; typedef RotMatrix; MiaQuaternion * mia_quaternion_copy (MiaQuaternion *dest,const MiaQuaternion *src); MiaQuaternion * mia_quaternion_dup (const MiaQuaternion *org); gboolean mia_quaternion_equal (const MiaQuaternion *a,const MiaQuaternion *b); void mia_quaternion_get_rotation (MiaQuaternion *self,RotMatrix m); MiaQuaternion * mia_quaternion_multby (MiaQuaternion *self,MiaQuaternion *other); MiaQuaternion * mia_quaternion_new (gfloat x,gfloat y,gfloat z,gfloat w); MiaQuaternion * mia_quaternion_new_from_eulerrot (const MiaVector3d *axis,gfloat angle); gfloat mia_quaternion_norm (const MiaQuaternion *self); void mia_quaternion_normalize (MiaQuaternion *self); gboolean mia_quaternion_test (void); void mia_quaternion_xmlio_read (ParserState *state,const gchar *property); gboolean mia_quaternion_xmlio_write (xmlNodePtr root,xmlNsPtr ns,const gchar *tag,const MiaQuaternion *q);
MiaQuaternion and the related functions describe and handle rotations in 3D space that are specifically suited for visualization.
typedef struct _MiaQuaternion MiaQuaternion;
This defines a Quaternion and is used to describe a rotation in 3D space.
MiaQuaternion * mia_quaternion_copy (MiaQuaternion *dest,const MiaQuaternion *src);
Copy one quaternion into another one. The destination quaternion must already be properly created.
|
destination quaternion to copy to |
|
source quaternion to copy from |
Returns : |
the destination quaternion |
MiaQuaternion * mia_quaternion_dup (const MiaQuaternion *org);
Create a duplicate of a quaternion. It must be destroyed by calling
calling g_object_unref()
|
a quaterion |
Returns : |
a newly created copy of the quaternion. |
gboolean mia_quaternion_equal (const MiaQuaternion *a,const MiaQuaternion *b);
Test if two quaternions are exactly equal.
|
left hand value for comparison |
|
right hand value for comparison |
Returns : |
TRUE if equal, FALSE otherwise |
void mia_quaternion_get_rotation (MiaQuaternion *self,RotMatrix m);
Evaluate the 4x4 Matrix corresponding to the 3D rotation.
|
the quaternion desctibing the rotation |
|
The result will be stored in this matrix. |
MiaQuaternion * mia_quaternion_multby (MiaQuaternion *self,MiaQuaternion *other);
Multiply the quaternion dest by a quaternion other as in dest *= other
|
destination quaternion |
|
other quaternion to multiply by |
Returns : |
the quaternion self |
MiaQuaternion * mia_quaternion_new (gfloat x,gfloat y,gfloat z,gfloat w);
Create a quaternion q = w + x *i + y * j + z * k.
|
x-component of rotation axis |
|
y-component of rotation axis |
|
z-component of rotation axis |
|
scalar part of the quaternion |
Returns : |
a newly created quaternion representing the rotation |
MiaQuaternion * mia_quaternion_new_from_eulerrot (const MiaVector3d *axis,gfloat angle);
Create a quaternion that represents a rotation around the given axis
by the given angle. The returned quaternion must be destroyed by
calling g_object_unref()
|
the rotation axis |
|
the rotation angle |
Returns : |
a newly created quaternion |
gfloat mia_quaternion_norm (const MiaQuaternion *self);
Evaluate the quaternions norm.
|
the quaternion |
Returns : |
the Euclidian norm |
void mia_quaternion_normalize (MiaQuaternion *self);
Normalize a quaternion if it's norm is not zero.
|
the quaternion to be normalized |
void mia_quaternion_xmlio_read (ParserState *state,const gchar *property);
Helper function to read a quaternion from a XML file
|
XML parser state holding the parent object and the values |
|
property name the quaternion has in the parent class |
gboolean mia_quaternion_xmlio_write (xmlNodePtr root,xmlNsPtr ns,const gchar *tag,const MiaQuaternion *q);
Helper function to write a quaternion to a XML file
|
xml node this quaternion will be attached to |
|
name space |
|
the xml tag to store this quaternion under |
|
the quaternion |
Returns : |
true if the node creation was successfu, otherwise false. |