Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
C-Fu
OpenGL
Commits
1c5a33cf
Commit
1c5a33cf
authored
Dec 03, 2016
by
Anakin
Browse files
different quat2eul function from the internet
parent
40783470
Changes
1
Show whitespace changes
Inline
Side-by-side
MshViewer/Source/Object.cpp
View file @
1c5a33cf
...
@@ -574,21 +574,20 @@ void Object::readUV(Segment* dataDestination, std::streampos position)
...
@@ -574,21 +574,20 @@ void Object::readUV(Segment* dataDestination, std::streampos position)
void
Object
::
quat2eul
(
float
&
quat0
,
float
&
quat1
,
float
&
quat2
,
float
&
quat3
)
void
Object
::
quat2eul
(
float
&
quat0
,
float
&
quat1
,
float
&
quat2
,
float
&
quat3
)
{
{
float
eulX
=
atan2
(
float
ysqr
=
quat1
*
quat1
;
2
*
(
quat0
*
quat1
+
quat2
*
quat3
),
float
t0
=
-
2.0
f
*
(
ysqr
+
quat2
*
quat2
)
+
1.0
f
;
1
-
2
*
(
pow
(
quat1
,
2
)
+
pow
(
quat2
,
2
))
float
t1
=
+
2.0
f
*
(
quat0
*
quat1
-
quat3
*
quat2
);
);
float
t2
=
-
2.0
f
*
(
quat0
*
quat2
+
quat3
*
quat1
);
float
t3
=
+
2.0
f
*
(
quat1
*
quat2
-
quat3
*
quat0
);
float
t4
=
-
2.0
f
*
(
quat0
*
quat0
+
ysqr
)
+
1.0
f
;
float
eulY
=
asin
(
2
*
(
quat0
*
quat2
-
quat3
*
quat1
));
t2
=
t2
>
1.0
f
?
1.0
f
:
t2
;
t2
=
t2
<
-
1.0
f
?
-
1.0
f
:
t2
;
float
eulZ
=
atan2
(
quat1
=
std
::
asin
(
t2
);
2
*
(
quat0
*
quat3
+
quat1
*
quat2
),
quat0
=
std
::
atan2
(
t3
,
t4
);
1
-
2
*
(
pow
(
quat2
,
2
)
+
pow
(
quat3
,
2
))
quat2
=
std
::
atan2
(
t1
,
t0
);
)
-
PI
;
quat0
=
eulX
;
quat1
=
eulY
;
quat2
=
eulZ
;
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment