File: graphene-euler.h

package info (click to toggle)
graphene 1.8.4-1
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 1,184 kB
  • sloc: ansic: 12,764; xml: 74; python: 32; makefile: 14; sh: 3
file content (140 lines) | stat: -rw-r--r-- 6,634 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
/* graphene-euler.h: Euler angles
 *
 * Copyright 2014  Emmanuele Bassi
 *
 * Permission is hereby granted, free of charge, to any person obtaining a copy
 * of this software and associated documentation files (the "Software"), to deal
 * in the Software without restriction, including without limitation the rights
 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
 * copies of the Software, and to permit persons to whom the Software is
 * furnished to do so, subject to the following conditions:
 *
 * The above copyright notice and this permission notice shall be included in
 * all copies or substantial portions of the Software.
 *
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
 * THE SOFTWARE.
 */

#ifndef __GRAPHENE_EULER_H__
#define __GRAPHENE_EULER_H__

#if !defined(GRAPHENE_H_INSIDE) && !defined(GRAPHENE_COMPILATION)
#error "Only graphene.h can be included directly."
#endif

#include "graphene-types.h"
#include "graphene-vec3.h"

GRAPHENE_BEGIN_DECLS

/**
 * graphene_euler_order_t:
 * @GRAPHENE_EULER_ORDER_DEFAULT: Rotate in the default order; the
 *   default order is one of the following enumeration values
 * @GRAPHENE_EULER_ORDER_XYZ: Rotate in the X, Y, and Z order
 * @GRAPHENE_EULER_ORDER_YZX: Rotate in the Y, Z, and X order
 * @GRAPHENE_EULER_ORDER_ZXY: Rotate in the Z, X, and Y order
 * @GRAPHENE_EULER_ORDER_XZY: Rotate in the X, Z, and Y order
 * @GRAPHENE_EULER_ORDER_YXZ: Rotate in the Y, X, and Z order
 * @GRAPHENE_EULER_ORDER_ZYX: Rotate in the Z, Y, and X order
 *
 * Specify the order of the rotations on each axis.
 *
 * The %GRAPHENE_EULER_ORDER_DEFAULT value is special, and is used
 * as an alias for one of the other orders.
 *
 * Since: 1.2
 */
typedef enum {
  GRAPHENE_EULER_ORDER_DEFAULT = -1,
  GRAPHENE_EULER_ORDER_XYZ = 0,
  GRAPHENE_EULER_ORDER_YZX,
  GRAPHENE_EULER_ORDER_ZXY,
  GRAPHENE_EULER_ORDER_XZY,
  GRAPHENE_EULER_ORDER_YXZ,
  GRAPHENE_EULER_ORDER_ZYX
} graphene_euler_order_t;

/**
 * graphene_euler_t:
 *
 * Describe a rotation using Euler angles.
 *
 * The contents of the #graphene_euler_t structure are private
 * and should never be accessed directly.
 *
 * Since: 1.2
 */
struct _graphene_euler_t
{
  /*< private >*/
  GRAPHENE_PRIVATE_FIELD (graphene_vec3_t, angles);
  GRAPHENE_PRIVATE_FIELD (graphene_euler_order_t, order);
};

GRAPHENE_AVAILABLE_IN_1_2
graphene_euler_t *      graphene_euler_alloc                    (void);
GRAPHENE_AVAILABLE_IN_1_2
void                    graphene_euler_free                     (graphene_euler_t            *e);

GRAPHENE_AVAILABLE_IN_1_2
graphene_euler_t *      graphene_euler_init                     (graphene_euler_t            *e,
                                                                 float                        x,
                                                                 float                        y,
                                                                 float                        z);
GRAPHENE_AVAILABLE_IN_1_2
graphene_euler_t *      graphene_euler_init_with_order          (graphene_euler_t            *e,
                                                                 float                        x,
                                                                 float                        y,
                                                                 float                        z,
                                                                 graphene_euler_order_t       order);
GRAPHENE_AVAILABLE_IN_1_2
graphene_euler_t *      graphene_euler_init_from_matrix         (graphene_euler_t            *e,
                                                                 const graphene_matrix_t     *m,
                                                                 graphene_euler_order_t       order);
GRAPHENE_AVAILABLE_IN_1_2
graphene_euler_t *      graphene_euler_init_from_quaternion     (graphene_euler_t            *e,
                                                                 const graphene_quaternion_t *q,
                                                                 graphene_euler_order_t       order);
GRAPHENE_AVAILABLE_IN_1_2
graphene_euler_t *      graphene_euler_init_from_vec3           (graphene_euler_t            *e,
                                                                 const graphene_vec3_t       *v,
                                                                 graphene_euler_order_t       order);
GRAPHENE_AVAILABLE_IN_1_2
graphene_euler_t *      graphene_euler_init_from_euler          (graphene_euler_t            *e,
                                                                 const graphene_euler_t      *src);

GRAPHENE_AVAILABLE_IN_1_2
bool                    graphene_euler_equal                    (const graphene_euler_t      *a,
                                                                 const graphene_euler_t      *b);

GRAPHENE_AVAILABLE_IN_1_2
float                   graphene_euler_get_x                    (const graphene_euler_t      *e);
GRAPHENE_AVAILABLE_IN_1_2
float                   graphene_euler_get_y                    (const graphene_euler_t      *e);
GRAPHENE_AVAILABLE_IN_1_2
float                   graphene_euler_get_z                    (const graphene_euler_t      *e);
GRAPHENE_AVAILABLE_IN_1_2
graphene_euler_order_t  graphene_euler_get_order                (const graphene_euler_t      *e);

GRAPHENE_AVAILABLE_IN_1_2
void                    graphene_euler_to_vec3                  (const graphene_euler_t      *e,
                                                                 graphene_vec3_t             *res);
GRAPHENE_AVAILABLE_IN_1_2
void                    graphene_euler_to_matrix                (const graphene_euler_t      *e,
                                                                 graphene_matrix_t           *res);

GRAPHENE_AVAILABLE_IN_1_2
void                    graphene_euler_reorder                  (const graphene_euler_t      *e,
                                                                 graphene_euler_order_t       order,
                                                                 graphene_euler_t            *res);

GRAPHENE_END_DECLS

#endif /* __GRAPHENE_EULER_H__ */