Algorithms_in_C 1.0.0
Set of algorithms implemented in C.
Loading...
Searching...
No Matches
geometry_datatypes.h
Go to the documentation of this file.
1/**
2 * @addtogroup quaternions Library for 3D Vectors & Quaternions
3 * @{
4 * @file
5 * @brief Generic header that provides data types for 3D vectors and quaternions
6 * @author Krishna Vedala
7 */
8
9#ifndef __LIBQUAT_H_
10#define __LIBQUAT_H_
11
12/** Minimum recognizable value. Any value less than this is considered to be
13 * @f$=0@f$ */
14#define EPSILON 1e-9
15
16/**
17 * @addtogroup vec_3d 3D Vector operations
18 * @{
19 */
20/** 3D vector type */
21typedef struct vec_3d_
22{
23 float x; /**< X co-ordinate */
24 float y; /**< Y co-ordinate */
25 float z; /**< Z co-ordinate */
27/** @} */
28
29/**
30 * @addtogroup matrix Matrix operations
31 * @{
32 */
33/** A 3x3 Matrix type definition */
34typedef struct mat_3x3_
35{
36 union
37 { /**< 3 element row 1 */
38 float row1[3];
39 vec_3d vec1;
40 };
41 union
42 { /**< 3 element row 2 */
43 float row2[3];
44 vec_3d vec2;
45 };
46 union
47 { /**< 3 element row 3 */
48 float row3[3];
49 vec_3d vec3;
50 };
52/** @} */
53
54/** @addtogroup quats 3D Quaternion operations
55 * @{
56 */
57/** a Quaternion type represented using a scalar \f$w\f$ or \f$q_0\f$ and a
58 * 3D vector \f$\left(q_1,q_2,q_3\right)\f$
59 */
60typedef struct quaternion_
61{
62 union
63 {
64 float w; /**< real part of quaternion */
65 float q0; /**< real part of quaternion */
66 };
67 /**< dual part of quaternion */
68 union
69 {
70 vec_3d dual; /**< can be a 3D vector */
71 /** or individual values */
72 struct
73 {
74 float q1, q2, q3;
75 };
76 };
78
79/** 3D Euler or Tait-Bryan angles (in radian) */
80typedef struct euler_
81{
82 union
83 {
84 float roll; /**< or bank \f$\phi\f$ = rotation about X axis */
85 float bank; /**< or roll \f$\phi\f$ = rotation about X axis */
86 };
87 union
88 {
89 float pitch; /**< or elevation \f$\theta\f$ = rotation about Y axis */
90 float elevation; /**< or pitch \f$\theta\f$ = rotation about Y axis */
91 };
92 union
93 {
94 float yaw; /**< or heading \f$\psi\f$ = rotation about Z axis */
95 float heading; /**< or yaw \f$\psi\f$ = rotation about Z axis */
96 };
98
99/** @} */
100
101/** @addtogroup dual_quats 3D Dual-Quaternion operations
102 * @{
103 */
104/** a dual quaternion type */
105typedef struct dual_quat_
106{
107 quaternion real; /**< real part of dual quaternion */
108 quaternion dual; /**< dual part of dual quaternion */
110
111/** @} */
112
113#endif // __LIBQUAT_H_
114
115/** @} */
struct dual_quat_ dual_quat
a dual quaternion type
struct mat_3x3_ mat_3x3
A 3x3 Matrix type definition.
struct euler_ euler
3D Euler or Tait-Bryan angles (in radian)
struct quaternion_ quaternion
a Quaternion type represented using a scalar or and a 3D vector
struct vec_3d_ vec_3d
3D vector type
a dual quaternion type
Definition geometry_datatypes.h:106
quaternion dual
dual part of dual quaternion
Definition geometry_datatypes.h:108
quaternion real
real part of dual quaternion
Definition geometry_datatypes.h:107
3D Euler or Tait-Bryan angles (in radian)
Definition geometry_datatypes.h:81
float bank
or roll = rotation about X axis
Definition geometry_datatypes.h:85
float roll
or bank = rotation about X axis
Definition geometry_datatypes.h:84
float heading
or yaw = rotation about Z axis
Definition geometry_datatypes.h:95
float pitch
or elevation = rotation about Y axis
Definition geometry_datatypes.h:89
float yaw
or heading = rotation about Z axis
Definition geometry_datatypes.h:94
float elevation
or pitch = rotation about Y axis
Definition geometry_datatypes.h:90
A 3x3 Matrix type definition.
Definition geometry_datatypes.h:35
float row3[3]
< 3 element row 3
Definition geometry_datatypes.h:48
float row2[3]
< 3 element row 2
Definition geometry_datatypes.h:43
float row1[3]
< 3 element row 1
Definition geometry_datatypes.h:38
a Quaternion type represented using a scalar or and a 3D vector
Definition geometry_datatypes.h:61
float q0
real part of quaternion
Definition geometry_datatypes.h:65
vec_3d dual
can be a 3D vector
Definition geometry_datatypes.h:70
float w
real part of quaternion
Definition geometry_datatypes.h:64
3D vector type
Definition geometry_datatypes.h:22
float z
Z co-ordinate.
Definition geometry_datatypes.h:25
float x
X co-ordinate.
Definition geometry_datatypes.h:23
float y
Y co-ordinate.
Definition geometry_datatypes.h:24