HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
rtcore_quaternion.h
Go to the documentation of this file.
1 // Copyright 2009-2021 Intel Corporation
2 // SPDX-License-Identifier: Apache-2.0
3 
4 #pragma once
5 
6 #include "rtcore_common.h"
7 
9 
10 /*
11  * Structure for transformation respresentation as a matrix decomposition using
12  * a quaternion
13  */
14 struct RTC_ALIGN(16) RTCQuaternionDecomposition
15 {
16  float scale_x;
17  float scale_y;
18  float scale_z;
19  float skew_xy;
20  float skew_xz;
21  float skew_yz;
22  float shift_x;
23  float shift_y;
24  float shift_z;
25  float quaternion_r;
26  float quaternion_i;
27  float quaternion_j;
28  float quaternion_k;
29  float translation_x;
30  float translation_y;
31  float translation_z;
32 };
33 
34 RTC_FORCEINLINE void rtcInitQuaternionDecomposition(struct RTCQuaternionDecomposition* qdecomp)
35 {
36  qdecomp->scale_x = 1.f;
37  qdecomp->scale_y = 1.f;
38  qdecomp->scale_z = 1.f;
39  qdecomp->skew_xy = 0.f;
40  qdecomp->skew_xz = 0.f;
41  qdecomp->skew_yz = 0.f;
42  qdecomp->shift_x = 0.f;
43  qdecomp->shift_y = 0.f;
44  qdecomp->shift_z = 0.f;
45  qdecomp->quaternion_r = 1.f;
46  qdecomp->quaternion_i = 0.f;
47  qdecomp->quaternion_j = 0.f;
48  qdecomp->quaternion_k = 0.f;
49  qdecomp->translation_x = 0.f;
50  qdecomp->translation_y = 0.f;
51  qdecomp->translation_z = 0.f;
52 }
53 
55  struct RTCQuaternionDecomposition* qdecomp,
56  float r, float i, float j, float k)
57 {
58  qdecomp->quaternion_r = r;
59  qdecomp->quaternion_i = i;
60  qdecomp->quaternion_j = j;
61  qdecomp->quaternion_k = k;
62 }
63 
65  struct RTCQuaternionDecomposition* qdecomp,
66  float scale_x, float scale_y, float scale_z)
67 {
68  qdecomp->scale_x = scale_x;
69  qdecomp->scale_y = scale_y;
70  qdecomp->scale_z = scale_z;
71 }
72 
74  struct RTCQuaternionDecomposition* qdecomp,
75  float skew_xy, float skew_xz, float skew_yz)
76 {
77  qdecomp->skew_xy = skew_xy;
78  qdecomp->skew_xz = skew_xz;
79  qdecomp->skew_yz = skew_yz;
80 }
81 
83  struct RTCQuaternionDecomposition* qdecomp,
84  float shift_x, float shift_y, float shift_z)
85 {
86  qdecomp->shift_x = shift_x;
87  qdecomp->shift_y = shift_y;
88  qdecomp->shift_z = shift_z;
89 }
90 
92  struct RTCQuaternionDecomposition* qdecomp,
93  float translation_x, float translation_y, float translation_z)
94 {
95  qdecomp->translation_x = translation_x;
96  qdecomp->translation_y = translation_y;
97  qdecomp->translation_z = translation_z;
98 }
99 
101 
RTC_FORCEINLINE void rtcQuaternionDecompositionSetScale(struct RTCQuaternionDecomposition *qdecomp, float scale_x, float scale_y, float scale_z)
#define RTC_FORCEINLINE
Definition: rtcore_common.h:41
RTC_FORCEINLINE void rtcInitQuaternionDecomposition(struct RTCQuaternionDecomposition *qdecomp)
RTC_FORCEINLINE void rtcQuaternionDecompositionSetTranslation(struct RTCQuaternionDecomposition *qdecomp, float translation_x, float translation_y, float translation_z)
RTC_FORCEINLINE void rtcQuaternionDecompositionSetSkew(struct RTCQuaternionDecomposition *qdecomp, float skew_xy, float skew_xz, float skew_yz)
RTC_NAMESPACE_BEGIN struct RTC_ALIGN(16) RTCQuaternionDecomposition
GLint j
Definition: glad.h:2733
#define RTC_NAMESPACE_END
Definition: rtcore_config.h:23
GLboolean r
Definition: glcorearb.h:1222
RTC_FORCEINLINE void rtcQuaternionDecompositionSetQuaternion(struct RTCQuaternionDecomposition *qdecomp, float r, float i, float j, float k)
#define RTC_NAMESPACE_BEGIN
Definition: rtcore_config.h:22
RTC_FORCEINLINE void rtcQuaternionDecompositionSetShift(struct RTCQuaternionDecomposition *qdecomp, float shift_x, float shift_y, float shift_z)