Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-cw
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wine
wine-cw
Commits
21060b07
Commit
21060b07
authored
Aug 24, 2008
by
Luis C. Busquets Pérez
Committed by
Alexandre Julliard
Aug 26, 2008
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
d3dx8: D3DXQuaternionRotationMatrix correct compare value for the trace.
parent
058ebe37
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
101 additions
and
1 deletion
+101
-1
math.c
dlls/d3dx8/math.c
+1
-1
math.c
dlls/d3dx8/tests/math.c
+100
-0
No files found.
dlls/d3dx8/math.c
View file @
21060b07
...
...
@@ -972,7 +972,7 @@ D3DXQUATERNION* WINAPI D3DXQuaternionRotationMatrix(D3DXQUATERNION *pout, CONST
FLOAT
maxdiag
,
S
,
trace
;
trace
=
pm
->
u
.
m
[
0
][
0
]
+
pm
->
u
.
m
[
1
][
1
]
+
pm
->
u
.
m
[
2
][
2
]
+
1
.
0
f
;
if
(
trace
>
0
.
0
f
)
if
(
trace
>
1
.
0
f
)
{
pout
->
x
=
(
pm
->
u
.
m
[
1
][
2
]
-
pm
->
u
.
m
[
2
][
1
]
)
/
(
2
.
0
f
*
sqrt
(
trace
)
);
pout
->
y
=
(
pm
->
u
.
m
[
2
][
0
]
-
pm
->
u
.
m
[
0
][
2
]
)
/
(
2
.
0
f
*
sqrt
(
trace
)
);
...
...
dlls/d3dx8/tests/math.c
View file @
21060b07
...
...
@@ -744,6 +744,106 @@ static void D3X8QuaternionTest(void)
expectedquat
.
x
=
0
.
651031
f
;
expectedquat
.
y
=
6
.
144103
f
;
expectedquat
.
z
=
-
0
.
203447
f
;
expectedquat
.
w
=
0
.
488273
f
;
D3DXQuaternionRotationMatrix
(
&
gotquat
,
&
mat
);
expect_vec4
(
expectedquat
,
gotquat
);
/* test the case when the trace is near 0 in a matrix which is not a rotation */
U
(
mat
).
m
[
0
][
1
]
=
5
.
0
f
;
U
(
mat
).
m
[
0
][
2
]
=
7
.
0
f
;
U
(
mat
).
m
[
0
][
3
]
=
8
.
0
f
;
U
(
mat
).
m
[
1
][
0
]
=
11
.
0
f
;
U
(
mat
).
m
[
1
][
2
]
=
16
.
0
f
;
U
(
mat
).
m
[
1
][
3
]
=
33
.
0
f
;
U
(
mat
).
m
[
2
][
0
]
=
19
.
0
f
;
U
(
mat
).
m
[
2
][
1
]
=
-
21
.
0
f
;
U
(
mat
).
m
[
2
][
3
]
=
43
.
0
f
;
U
(
mat
).
m
[
3
][
0
]
=
2
.
0
f
;
U
(
mat
).
m
[
3
][
1
]
=
3
.
0
f
;
U
(
mat
).
m
[
3
][
2
]
=
-
4
.
0
f
;
U
(
mat
).
m
[
0
][
0
]
=
-
10
.
0
f
;
U
(
mat
).
m
[
1
][
1
]
=
10
.
0
f
;
U
(
mat
).
m
[
2
][
2
]
=
-
0
.
9
f
;
U
(
mat
).
m
[
3
][
3
]
=
48
.
0
f
;
expectedquat
.
x
=
1
.
709495
f
;
expectedquat
.
y
=
2
.
339872
f
;
expectedquat
.
z
=
-
0
.
534217
f
;
expectedquat
.
w
=
1
.
282122
f
;
D3DXQuaternionRotationMatrix
(
&
gotquat
,
&
mat
);
expect_vec4
(
expectedquat
,
gotquat
);
/* test the case when the trace is 0.49 in a matrix which is not a rotation */
U
(
mat
).
m
[
0
][
1
]
=
5
.
0
f
;
U
(
mat
).
m
[
0
][
2
]
=
7
.
0
f
;
U
(
mat
).
m
[
0
][
3
]
=
8
.
0
f
;
U
(
mat
).
m
[
1
][
0
]
=
11
.
0
f
;
U
(
mat
).
m
[
1
][
2
]
=
16
.
0
f
;
U
(
mat
).
m
[
1
][
3
]
=
33
.
0
f
;
U
(
mat
).
m
[
2
][
0
]
=
19
.
0
f
;
U
(
mat
).
m
[
2
][
1
]
=
-
21
.
0
f
;
U
(
mat
).
m
[
2
][
3
]
=
43
.
0
f
;
U
(
mat
).
m
[
3
][
0
]
=
2
.
0
f
;
U
(
mat
).
m
[
3
][
1
]
=
3
.
0
f
;
U
(
mat
).
m
[
3
][
2
]
=
-
4
.
0
f
;
U
(
mat
).
m
[
0
][
0
]
=
-
10
.
0
f
;
U
(
mat
).
m
[
1
][
1
]
=
10
.
0
f
;
U
(
mat
).
m
[
2
][
2
]
=
-
0
.
51
f
;
U
(
mat
).
m
[
3
][
3
]
=
48
.
0
f
;
expectedquat
.
x
=
1
.
724923
f
;
expectedquat
.
y
=
2
.
318944
f
;
expectedquat
.
z
=
-
0
.
539039
f
;
expectedquat
.
w
=
1
.
293692
f
;
D3DXQuaternionRotationMatrix
(
&
gotquat
,
&
mat
);
expect_vec4
(
expectedquat
,
gotquat
);
/* test the case when the trace is 0.51 in a matrix which is not a rotation */
U
(
mat
).
m
[
0
][
1
]
=
5
.
0
f
;
U
(
mat
).
m
[
0
][
2
]
=
7
.
0
f
;
U
(
mat
).
m
[
0
][
3
]
=
8
.
0
f
;
U
(
mat
).
m
[
1
][
0
]
=
11
.
0
f
;
U
(
mat
).
m
[
1
][
2
]
=
16
.
0
f
;
U
(
mat
).
m
[
1
][
3
]
=
33
.
0
f
;
U
(
mat
).
m
[
2
][
0
]
=
19
.
0
f
;
U
(
mat
).
m
[
2
][
1
]
=
-
21
.
0
f
;
U
(
mat
).
m
[
2
][
3
]
=
43
.
0
f
;
U
(
mat
).
m
[
3
][
0
]
=
2
.
0
f
;
U
(
mat
).
m
[
3
][
1
]
=
3
.
0
f
;
U
(
mat
).
m
[
3
][
2
]
=
-
4
.
0
f
;
U
(
mat
).
m
[
0
][
0
]
=
-
10
.
0
f
;
U
(
mat
).
m
[
1
][
1
]
=
10
.
0
f
;
U
(
mat
).
m
[
2
][
2
]
=
-
0
.
49
f
;
U
(
mat
).
m
[
3
][
3
]
=
48
.
0
f
;
expectedquat
.
x
=
1
.
725726
f
;
expectedquat
.
y
=
2
.
317865
f
;
expectedquat
.
z
=
-
0
.
539289
f
;
expectedquat
.
w
=
1
.
294294
f
;
D3DXQuaternionRotationMatrix
(
&
gotquat
,
&
mat
);
expect_vec4
(
expectedquat
,
gotquat
);
/* test the case when the trace is 0.99 in a matrix which is not a rotation */
U
(
mat
).
m
[
0
][
1
]
=
5
.
0
f
;
U
(
mat
).
m
[
0
][
2
]
=
7
.
0
f
;
U
(
mat
).
m
[
0
][
3
]
=
8
.
0
f
;
U
(
mat
).
m
[
1
][
0
]
=
11
.
0
f
;
U
(
mat
).
m
[
1
][
2
]
=
16
.
0
f
;
U
(
mat
).
m
[
1
][
3
]
=
33
.
0
f
;
U
(
mat
).
m
[
2
][
0
]
=
19
.
0
f
;
U
(
mat
).
m
[
2
][
1
]
=
-
21
.
0
f
;
U
(
mat
).
m
[
2
][
3
]
=
43
.
0
f
;
U
(
mat
).
m
[
3
][
0
]
=
2
.
0
f
;
U
(
mat
).
m
[
3
][
1
]
=
3
.
0
f
;
U
(
mat
).
m
[
3
][
2
]
=
-
4
.
0
f
;
U
(
mat
).
m
[
0
][
0
]
=
-
10
.
0
f
;
U
(
mat
).
m
[
1
][
1
]
=
10
.
0
f
;
U
(
mat
).
m
[
2
][
2
]
=
-
0
.
01
f
;
U
(
mat
).
m
[
3
][
3
]
=
48
.
0
f
;
expectedquat
.
x
=
1
.
745328
f
;
expectedquat
.
y
=
2
.
291833
f
;
expectedquat
.
z
=
-
0
.
545415
f
;
expectedquat
.
w
=
1
.
308996
f
;
D3DXQuaternionRotationMatrix
(
&
gotquat
,
&
mat
);
expect_vec4
(
expectedquat
,
gotquat
);
/* test the case when the trace is 1.0 in a matrix which is not a rotation */
U
(
mat
).
m
[
0
][
1
]
=
5
.
0
f
;
U
(
mat
).
m
[
0
][
2
]
=
7
.
0
f
;
U
(
mat
).
m
[
0
][
3
]
=
8
.
0
f
;
U
(
mat
).
m
[
1
][
0
]
=
11
.
0
f
;
U
(
mat
).
m
[
1
][
2
]
=
16
.
0
f
;
U
(
mat
).
m
[
1
][
3
]
=
33
.
0
f
;
U
(
mat
).
m
[
2
][
0
]
=
19
.
0
f
;
U
(
mat
).
m
[
2
][
1
]
=
-
21
.
0
f
;
U
(
mat
).
m
[
2
][
3
]
=
43
.
0
f
;
U
(
mat
).
m
[
3
][
0
]
=
2
.
0
f
;
U
(
mat
).
m
[
3
][
1
]
=
3
.
0
f
;
U
(
mat
).
m
[
3
][
2
]
=
-
4
.
0
f
;
U
(
mat
).
m
[
0
][
0
]
=
-
10
.
0
f
;
U
(
mat
).
m
[
1
][
1
]
=
10
.
0
f
;
U
(
mat
).
m
[
2
][
2
]
=
0
.
0
f
;
U
(
mat
).
m
[
3
][
3
]
=
48
.
0
f
;
expectedquat
.
x
=
1
.
745743
f
;
expectedquat
.
y
=
2
.
291288
f
;
expectedquat
.
z
=
-
0
.
545545
f
;
expectedquat
.
w
=
1
.
309307
f
;
D3DXQuaternionRotationMatrix
(
&
gotquat
,
&
mat
);
expect_vec4
(
expectedquat
,
gotquat
);
/* test the case when the trace is 1.01 in a matrix which is not a rotation */
U
(
mat
).
m
[
0
][
1
]
=
5
.
0
f
;
U
(
mat
).
m
[
0
][
2
]
=
7
.
0
f
;
U
(
mat
).
m
[
0
][
3
]
=
8
.
0
f
;
U
(
mat
).
m
[
1
][
0
]
=
11
.
0
f
;
U
(
mat
).
m
[
1
][
2
]
=
16
.
0
f
;
U
(
mat
).
m
[
1
][
3
]
=
33
.
0
f
;
U
(
mat
).
m
[
2
][
0
]
=
19
.
0
f
;
U
(
mat
).
m
[
2
][
1
]
=
-
21
.
0
f
;
U
(
mat
).
m
[
2
][
3
]
=
43
.
0
f
;
U
(
mat
).
m
[
3
][
0
]
=
2
.
0
f
;
U
(
mat
).
m
[
3
][
1
]
=
3
.
0
f
;
U
(
mat
).
m
[
3
][
2
]
=
-
4
.
0
f
;
U
(
mat
).
m
[
0
][
0
]
=
-
10
.
0
f
;
U
(
mat
).
m
[
1
][
1
]
=
10
.
0
f
;
U
(
mat
).
m
[
2
][
2
]
=
0
.
01
f
;
U
(
mat
).
m
[
3
][
3
]
=
48
.
0
f
;
expectedquat
.
x
=
18
.
408188
f
;
expectedquat
.
y
=
5
.
970223
f
;
expectedquat
.
z
=
-
2
.
985111
f
;
expectedquat
.
w
=
0
.
502494
f
;
D3DXQuaternionRotationMatrix
(
&
gotquat
,
&
mat
);
expect_vec4
(
expectedquat
,
gotquat
);
/* test the case when the trace is 1.5 in a matrix which is not a rotation */
U
(
mat
).
m
[
0
][
1
]
=
5
.
0
f
;
U
(
mat
).
m
[
0
][
2
]
=
7
.
0
f
;
U
(
mat
).
m
[
0
][
3
]
=
8
.
0
f
;
U
(
mat
).
m
[
1
][
0
]
=
11
.
0
f
;
U
(
mat
).
m
[
1
][
2
]
=
16
.
0
f
;
U
(
mat
).
m
[
1
][
3
]
=
33
.
0
f
;
U
(
mat
).
m
[
2
][
0
]
=
19
.
0
f
;
U
(
mat
).
m
[
2
][
1
]
=
-
21
.
0
f
;
U
(
mat
).
m
[
2
][
3
]
=
43
.
0
f
;
U
(
mat
).
m
[
3
][
0
]
=
2
.
0
f
;
U
(
mat
).
m
[
3
][
1
]
=
3
.
0
f
;
U
(
mat
).
m
[
3
][
2
]
=
-
4
.
0
f
;
U
(
mat
).
m
[
0
][
0
]
=
-
10
.
0
f
;
U
(
mat
).
m
[
1
][
1
]
=
10
.
0
f
;
U
(
mat
).
m
[
2
][
2
]
=
0
.
5
f
;
U
(
mat
).
m
[
3
][
3
]
=
48
.
0
f
;
expectedquat
.
x
=
15
.
105186
f
;
expectedquat
.
y
=
4
.
898980
f
;
expectedquat
.
z
=
-
2
.
449490
f
;
expectedquat
.
w
=
0
.
612372
f
;
D3DXQuaternionRotationMatrix
(
&
gotquat
,
&
mat
);
expect_vec4
(
expectedquat
,
gotquat
);
/* test the case when the trace is 1.7 in a matrix which is not a rotation */
U
(
mat
).
m
[
0
][
1
]
=
5
.
0
f
;
U
(
mat
).
m
[
0
][
2
]
=
7
.
0
f
;
U
(
mat
).
m
[
0
][
3
]
=
8
.
0
f
;
U
(
mat
).
m
[
1
][
0
]
=
11
.
0
f
;
U
(
mat
).
m
[
1
][
2
]
=
16
.
0
f
;
U
(
mat
).
m
[
1
][
3
]
=
33
.
0
f
;
U
(
mat
).
m
[
2
][
0
]
=
19
.
0
f
;
U
(
mat
).
m
[
2
][
1
]
=
-
21
.
0
f
;
U
(
mat
).
m
[
2
][
3
]
=
43
.
0
f
;
U
(
mat
).
m
[
3
][
0
]
=
2
.
0
f
;
U
(
mat
).
m
[
3
][
1
]
=
3
.
0
f
;
U
(
mat
).
m
[
3
][
2
]
=
-
4
.
0
f
;
U
(
mat
).
m
[
0
][
0
]
=
-
10
.
0
f
;
U
(
mat
).
m
[
1
][
1
]
=
10
.
0
f
;
U
(
mat
).
m
[
2
][
2
]
=
0
.
70
f
;
U
(
mat
).
m
[
3
][
3
]
=
48
.
0
f
;
expectedquat
.
x
=
14
.
188852
f
;
expectedquat
.
y
=
4
.
601790
f
;
expectedquat
.
z
=
-
2
.
300895
f
;
expectedquat
.
w
=
0
.
651920
f
;
D3DXQuaternionRotationMatrix
(
&
gotquat
,
&
mat
);
expect_vec4
(
expectedquat
,
gotquat
);
/* test the case when the trace is 1.99 in a matrix which is not a rotation */
U
(
mat
).
m
[
0
][
1
]
=
5
.
0
f
;
U
(
mat
).
m
[
0
][
2
]
=
7
.
0
f
;
U
(
mat
).
m
[
0
][
3
]
=
8
.
0
f
;
U
(
mat
).
m
[
1
][
0
]
=
11
.
0
f
;
U
(
mat
).
m
[
1
][
2
]
=
16
.
0
f
;
U
(
mat
).
m
[
1
][
3
]
=
33
.
0
f
;
U
(
mat
).
m
[
2
][
0
]
=
19
.
0
f
;
U
(
mat
).
m
[
2
][
1
]
=
-
21
.
0
f
;
U
(
mat
).
m
[
2
][
3
]
=
43
.
0
f
;
U
(
mat
).
m
[
3
][
0
]
=
2
.
0
f
;
U
(
mat
).
m
[
3
][
1
]
=
3
.
0
f
;
U
(
mat
).
m
[
3
][
2
]
=
-
4
.
0
f
;
U
(
mat
).
m
[
0
][
0
]
=
-
10
.
0
f
;
U
(
mat
).
m
[
1
][
1
]
=
10
.
0
f
;
U
(
mat
).
m
[
2
][
2
]
=
0
.
99
f
;
U
(
mat
).
m
[
3
][
3
]
=
48
.
0
f
;
expectedquat
.
x
=
13
.
114303
f
;
expectedquat
.
y
=
4
.
253287
f
;
expectedquat
.
z
=
-
2
.
126644
f
;
expectedquat
.
w
=
0
.
705337
f
;
D3DXQuaternionRotationMatrix
(
&
gotquat
,
&
mat
);
expect_vec4
(
expectedquat
,
gotquat
);
/* test the case when the trace is 2.0 in a matrix which is not a rotation */
U
(
mat
).
m
[
0
][
1
]
=
5
.
0
f
;
U
(
mat
).
m
[
0
][
2
]
=
7
.
0
f
;
U
(
mat
).
m
[
0
][
3
]
=
8
.
0
f
;
U
(
mat
).
m
[
1
][
0
]
=
11
.
0
f
;
U
(
mat
).
m
[
1
][
2
]
=
16
.
0
f
;
U
(
mat
).
m
[
1
][
3
]
=
33
.
0
f
;
U
(
mat
).
m
[
2
][
0
]
=
19
.
0
f
;
U
(
mat
).
m
[
2
][
1
]
=
-
21
.
0
f
;
U
(
mat
).
m
[
2
][
3
]
=
43
.
0
f
;
U
(
mat
).
m
[
3
][
0
]
=
2
.
0
f
;
U
(
mat
).
m
[
3
][
1
]
=
3
.
0
f
;
U
(
mat
).
m
[
3
][
2
]
=
-
4
.
0
f
;
U
(
mat
).
m
[
0
][
0
]
=
-
10
.
0
f
;
U
(
mat
).
m
[
1
][
1
]
=
10
.
0
f
;
U
(
mat
).
m
[
2
][
2
]
=
2
.
0
f
;
U
(
mat
).
m
[
3
][
3
]
=
48
.
0
f
;
expectedquat
.
x
=
10
.
680980
f
;
expectedquat
.
y
=
3
.
464102
f
;
expectedquat
.
z
=
-
1
.
732051
f
;
expectedquat
.
w
=
0
.
866025
f
;
D3DXQuaternionRotationMatrix
(
&
gotquat
,
&
mat
);
expect_vec4
(
expectedquat
,
gotquat
);
/*_______________D3DXQuaternionRotationYawPitchRoll__________*/
expectedquat
.
x
=
0
.
303261
f
;
expectedquat
.
y
=
0
.
262299
f
;
expectedquat
.
z
=
0
.
410073
f
;
expectedquat
.
w
=
0
.
819190
f
;
...
...
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