![]() |
![]() |
![]() |
hkl Reference Manual | ![]() |
---|---|---|---|---|
Top | Description |
HklQuaternion; void hkl_quaternion_init (HklQuaternion *self
,double a
,double b
,double c
,double d
); void hkl_quaternion_init_from_vector (HklQuaternion *self
,const HklVector *v
); void hkl_quaternion_init_from_angle_and_axe (HklQuaternion *self
,double angle
,const HklVector *v
); void hkl_quaternion_fprintf (FILE *file
,const HklQuaternion *self
); int hkl_quaternion_cmp (const HklQuaternion *self
,const HklQuaternion *q
); void hkl_quaternion_minus_quaternion (HklQuaternion *self
,const HklQuaternion *q
); void hkl_quaternion_times_quaternion (HklQuaternion *self
,const HklQuaternion *q
); double hkl_quaternion_norm2 (const HklQuaternion *self
); void hkl_quaternion_conjugate (HklQuaternion *self
); void hkl_quaternion_to_matrix (const HklQuaternion *self
,HklMatrix *m
); void hkl_quaternion_to_angle_and_axe (const HklQuaternion *self
,double *angle
,HklVector *v
);
void hkl_quaternion_init (HklQuaternion *self
,double a
,double b
,double c
,double d
);
initialize the four elements of an HklQuaternion
|
the HklQuaternion to initialize |
|
the 1st element value |
|
the 2nd element value |
|
the 3rd element value |
|
the 4th element value |
void hkl_quaternion_init_from_vector (HklQuaternion *self
,const HklVector *v
);
initialize an HklQuaternion from an HklVector
|
the HklQuaternion to set |
|
the HklVector used to set the self HklQuaternion |
void hkl_quaternion_init_from_angle_and_axe (HklQuaternion *self
,double angle
,const HklVector *v
);
initialize an HklQuaternion from a vector and a angle.
|
the HklQuaternion to set |
|
the angles of the rotation |
|
the axe of rotation |
void hkl_quaternion_fprintf (FILE *file
,const HklQuaternion *self
);
print an HklQuaternion into a FILE stream
|
the file to send the HklQuaternion into |
|
the HklQuaternion to write into the file stream. |
int hkl_quaternion_cmp (const HklQuaternion *self
,const HklQuaternion *q
);
compare two HklQuaternion.
|
the first HklQuaternion |
|
the second HklQuaternion |
Returns : |
HKL_TRUE if both are equal, HKL_FAIL otherwise. |
void hkl_quaternion_minus_quaternion (HklQuaternion *self
,const HklQuaternion *q
);
substract two HklQuaternions Todo: test
|
the HklQuaternion to modify. |
|
the HklQuaternion to substract |
void hkl_quaternion_times_quaternion (HklQuaternion *self
,const HklQuaternion *q
);
multiply two quaternions
|
the HklQuaternion to modify |
|
the HklQuaternion to multiply by |
double hkl_quaternion_norm2 (const HklQuaternion *self
);
compute the norm2 of an HklQuaternion
|
the quaternion use to compute the norm |
Returns : |
the self hklquaternion norm |
void hkl_quaternion_conjugate (HklQuaternion *self
);
compute the conjugate of a quaternion
|
the HklQuaternion to conjugate |
void hkl_quaternion_to_matrix (const HklQuaternion *self
,HklMatrix *m
);
Compute the rotation matrix of a Quaternion.
compute the rotation matrix corresponding to the unitary quaternion. \f$ q = a + b \cdot i + c \cdot j + d \cdot k \f$
\f$ \left( \begin{array}{ccc} a^2+b^2-c^2-d^2 & 2bc-2ad & 2ac+2bd\\ 2ad+2bc & a^2-b^2+c^2-d^2 & 2cd-2ab\\ 2bd-2ac & 2ab+2cd & a^2-b^2-c^2+d^2 \end{array} \right) \f$ Todo: optimize
|
the HklQuaternion use to compute the HklMatrix |
|
the HklMatrix return. |
void hkl_quaternion_to_angle_and_axe (const HklQuaternion *self
,double *angle
,HklVector *v
);
compute the axe and angle of the unitary quaternion angle [-pi, pi] if q is the (1, 0, 0, 0) quaternion return the (0,0,0) axe and a 0 angle
|
The HklQuaternion use to compute the angle and the roation axis. |
|
the returned angle of the rotation. |
|
the returned axis of the rotation. |