ReactOS  0.4.15-dev-2354-g9e947e2
math.c File Reference
#include "wine/test.h"
#include "d3dx9.h"
#include <math.h>
Include dependency graph for math.c:

Go to the source code of this file.

Macros

#define expect_vec2(expected, vector, ulps)   expect_vec2_(__LINE__, expected, vector, ulps)
 
#define expect_vec3(expected, vector, ulps)   expect_vec3_(__LINE__, expected, vector, ulps)
 
#define expect_vec4(expected, vector, ulps)   expect_vec4_(__LINE__, expected, vector, ulps)
 
#define expect_color(expected, color, ulps)   expect_color_(__LINE__, expected, color, ulps)
 
#define expect_plane(expected, plane, ulps)   expect_plane_(__LINE__, expected, plane, ulps)
 
#define expect_quaternion(expected, quaternion, ulps)   expect_quaternion_(__LINE__, expected, quaternion, ulps)
 
#define expect_matrix(expected, matrix, ulps)   expect_matrix_(__LINE__, expected, matrix, ulps)
 
#define expect_vec4_array(count, expected, vector, ulps)   expect_vec4_array_(__LINE__, count, expected, vector, ulps)
 

Functions

static BOOL compare_float (float f, float g, unsigned int ulps)
 
static BOOL compare_vec2 (const D3DXVECTOR2 *v1, const D3DXVECTOR2 *v2, unsigned int ulps)
 
static BOOL compare_vec3 (const D3DXVECTOR3 *v1, const D3DXVECTOR3 *v2, unsigned int ulps)
 
static BOOL compare_vec4 (const D3DXVECTOR4 *v1, const D3DXVECTOR4 *v2, unsigned int ulps)
 
static BOOL compare_color (const D3DXCOLOR *c1, const D3DXCOLOR *c2, unsigned int ulps)
 
static BOOL compare_plane (const D3DXPLANE *p1, const D3DXPLANE *p2, unsigned int ulps)
 
static BOOL compare_quaternion (const D3DXQUATERNION *q1, const D3DXQUATERNION *q2, unsigned int ulps)
 
static BOOL compare_matrix (const D3DXMATRIX *m1, const D3DXMATRIX *m2, unsigned int ulps)
 
static void expect_vec2_ (unsigned int line, const D3DXVECTOR2 *expected, const D3DXVECTOR2 *vector, unsigned int ulps)
 
static void expect_vec3_ (unsigned int line, const D3DXVECTOR3 *expected, const D3DXVECTOR3 *vector, unsigned int ulps)
 
static void expect_vec4_ (unsigned int line, const D3DXVECTOR4 *expected, const D3DXVECTOR4 *vector, unsigned int ulps)
 
static void expect_color_ (unsigned int line, const D3DXCOLOR *expected, const D3DXCOLOR *color, unsigned int ulps)
 
static void expect_plane_ (unsigned int line, const D3DXPLANE *expected, const D3DXPLANE *plane, unsigned int ulps)
 
static void expect_quaternion_ (unsigned int line, const D3DXQUATERNION *expected, const D3DXQUATERNION *quaternion, unsigned int ulps)
 
static void expect_matrix_ (unsigned int line, const D3DXMATRIX *expected, const D3DXMATRIX *matrix, unsigned int ulps)
 
static void expect_vec4_array_ (unsigned int line, unsigned int count, const D3DXVECTOR4 *expected, const D3DXVECTOR4 *vector, unsigned int ulps)
 
static void set_matrix (D3DXMATRIX *mat, float m00, float m01, float m02, float m03, float m10, float m11, float m12, float m13, float m20, float m21, float m22, float m23, float m30, float m31, float m32, float m33)
 
static void D3DXColorTest (void)
 
static void D3DXFresnelTest (void)
 
static void D3DXMatrixTest (void)
 
static void D3DXPlaneTest (void)
 
static void D3DXQuaternionTest (void)
 
static void D3DXVector2Test (void)
 
static void D3DXVector3Test (void)
 
static void D3DXVector4Test (void)
 
static void test_matrix_stack (void)
 
static void test_Matrix_AffineTransformation2D (void)
 
static void test_Matrix_Decompose (void)
 
static void test_Matrix_Transformation2D (void)
 
static void test_D3DXVec_Array (void)
 
static void test_D3DXFloat_Array (void)
 
static void test_D3DXSHAdd (void)
 
static void test_D3DXSHDot (void)
 
static void test_D3DXSHEvalConeLight (void)
 
static void test_D3DXSHEvalDirection (void)
 
static void test_D3DXSHEvalDirectionalLight (void)
 
static void test_D3DXSHEvalHemisphereLight (void)
 
static void test_D3DXSHEvalSphericalLight (void)
 
static void test_D3DXSHMultiply2 (void)
 
static void test_D3DXSHMultiply3 (void)
 
static void test_D3DXSHMultiply4 (void)
 
static void test_D3DXSHRotate (void)
 
static void test_D3DXSHRotateZ (void)
 
static void test_D3DXSHScale (void)
 
 START_TEST (math)
 

Macro Definition Documentation

◆ expect_color

#define expect_color (   expected,
  color,
  ulps 
)    expect_color_(__LINE__, expected, color, ulps)

Definition at line 129 of file math.c.

◆ expect_matrix

#define expect_matrix (   expected,
  matrix,
  ulps 
)    expect_matrix_(__LINE__, expected, matrix, ulps)

Definition at line 158 of file math.c.

◆ expect_plane

#define expect_plane (   expected,
  plane,
  ulps 
)    expect_plane_(__LINE__, expected, plane, ulps)

Definition at line 138 of file math.c.

◆ expect_quaternion

#define expect_quaternion (   expected,
  quaternion,
  ulps 
)    expect_quaternion_(__LINE__, expected, quaternion, ulps)

Definition at line 147 of file math.c.

◆ expect_vec2

#define expect_vec2 (   expected,
  vector,
  ulps 
)    expect_vec2_(__LINE__, expected, vector, ulps)

Definition at line 102 of file math.c.

◆ expect_vec3

#define expect_vec3 (   expected,
  vector,
  ulps 
)    expect_vec3_(__LINE__, expected, vector, ulps)

Definition at line 111 of file math.c.

◆ expect_vec4

#define expect_vec4 (   expected,
  vector,
  ulps 
)    expect_vec4_(__LINE__, expected, vector, ulps)

Definition at line 120 of file math.c.

◆ expect_vec4_array

#define expect_vec4_array (   count,
  expected,
  vector,
  ulps 
)    expect_vec4_array_(__LINE__, count, expected, vector, ulps)

Definition at line 177 of file math.c.

Function Documentation

◆ compare_color()

static BOOL compare_color ( const D3DXCOLOR c1,
const D3DXCOLOR c2,
unsigned int  ulps 
)
static

Definition at line 62 of file math.c.

63 {
64  return compare_float(c1->r, c2->r, ulps)
65  && compare_float(c1->g, c2->g, ulps)
66  && compare_float(c1->b, c2->b, ulps)
67  && compare_float(c1->a, c2->a, ulps);
68 }
FLOAT g
Definition: d3dx9math.h:262
FLOAT a
Definition: d3dx9math.h:262
static BOOL compare_float(float f, float g, unsigned int ulps)
Definition: math.c:26
FLOAT r
Definition: d3dx9math.h:262
FLOAT b
Definition: d3dx9math.h:262
unsigned int ulps
Definition: effect.c:4332

Referenced by expect_color_().

◆ compare_float()

static BOOL compare_float ( float  f,
float  g,
unsigned int  ulps 
)
static

Definition at line 26 of file math.c.

27 {
28  int x = *(int *)&f;
29  int y = *(int *)&g;
30 
31  if (x < 0)
32  x = INT_MIN - x;
33  if (y < 0)
34  y = INT_MIN - y;
35 
36  if (abs(x - y) > ulps)
37  return FALSE;
38 
39  return TRUE;
40 }
#define abs(i)
Definition: fconv.c:206
#define TRUE
Definition: types.h:120
GLint GLint GLint GLint GLint x
Definition: gl.h:1548
#define FALSE
Definition: types.h:117
GLboolean GLboolean g
Definition: glext.h:6204
GLfloat f
Definition: glext.h:7540
#define INT_MIN
Definition: limits.h:39
GLint GLint GLint GLint GLint GLint y
Definition: gl.h:1548
unsigned int ulps
Definition: effect.c:4332

Referenced by compare_color(), compare_matrix(), compare_plane(), compare_quaternion(), compare_vec2(), compare_vec3(), compare_vec4(), D3DXFresnelTest(), D3DXMatrixTest(), D3DXQuaternionTest(), D3DXVector2Test(), D3DXVector3Test(), D3DXVector4Test(), test_D3DXFloat_Array(), test_D3DXSHAdd(), test_D3DXSHDot(), test_D3DXSHEvalConeLight(), test_D3DXSHEvalDirection(), test_D3DXSHEvalDirectionalLight(), test_D3DXSHEvalHemisphereLight(), test_D3DXSHEvalSphericalLight(), test_D3DXSHMultiply2(), test_D3DXSHMultiply3(), test_D3DXSHMultiply4(), test_D3DXSHRotate(), test_D3DXSHRotateZ(), and test_D3DXSHScale().

◆ compare_matrix()

static BOOL compare_matrix ( const D3DXMATRIX m1,
const D3DXMATRIX m2,
unsigned int  ulps 
)
static

Definition at line 86 of file math.c.

87 {
88  unsigned int i, j;
89 
90  for (i = 0; i < 4; ++i)
91  {
92  for (j = 0; j < 4; ++j)
93  {
94  if (!compare_float(U(*m1).m[i][j], U(*m2).m[i][j], ulps))
95  return FALSE;
96  }
97  }
98 
99  return TRUE;
100 }
#define TRUE
Definition: types.h:120
#define U(x)
Definition: wordpad.c:45
static BOOL compare_float(float f, float g, unsigned int ulps)
Definition: math.c:26
#define FALSE
Definition: types.h:117
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint GLint GLint j
Definition: glfuncs.h:250
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
unsigned int ulps
Definition: effect.c:4332

Referenced by expect_matrix_().

◆ compare_plane()

static BOOL compare_plane ( const D3DXPLANE p1,
const D3DXPLANE p2,
unsigned int  ulps 
)
static

Definition at line 70 of file math.c.

71 {
72  return compare_float(p1->a, p2->a, ulps)
73  && compare_float(p1->b, p2->b, ulps)
74  && compare_float(p1->c, p2->c, ulps)
75  && compare_float(p1->d, p2->d, ulps);
76 }
FLOAT d
Definition: d3dx9math.h:221
static BOOL compare_float(float f, float g, unsigned int ulps)
Definition: math.c:26
FLOAT c
Definition: d3dx9math.h:221
FLOAT b
Definition: d3dx9math.h:221
unsigned int ulps
Definition: effect.c:4332
FLOAT a
Definition: d3dx9math.h:221

Referenced by expect_plane_(), and test_D3DXVec_Array().

◆ compare_quaternion()

static BOOL compare_quaternion ( const D3DXQUATERNION q1,
const D3DXQUATERNION q2,
unsigned int  ulps 
)
static

Definition at line 78 of file math.c.

79 {
80  return compare_float(q1->x, q2->x, ulps)
81  && compare_float(q1->y, q2->y, ulps)
82  && compare_float(q1->z, q2->z, ulps)
83  && compare_float(q1->w, q2->w, ulps);
84 }
static BOOL compare_float(float f, float g, unsigned int ulps)
Definition: math.c:26
unsigned int ulps
Definition: effect.c:4332

Referenced by expect_quaternion_(), and test_Matrix_Decompose().

◆ compare_vec2()

static BOOL compare_vec2 ( const D3DXVECTOR2 v1,
const D3DXVECTOR2 v2,
unsigned int  ulps 
)
static

Definition at line 42 of file math.c.

43 {
44  return compare_float(v1->x, v2->x, ulps) && compare_float(v1->y, v2->y, ulps);
45 }
static BOOL compare_float(float f, float g, unsigned int ulps)
Definition: math.c:26
GLfloat GLfloat GLfloat v2
Definition: glext.h:6063
unsigned int ulps
Definition: effect.c:4332
GLfloat GLfloat v1
Definition: glext.h:6062

Referenced by expect_vec2_().

◆ compare_vec3()

static BOOL compare_vec3 ( const D3DXVECTOR3 v1,
const D3DXVECTOR3 v2,
unsigned int  ulps 
)
static

Definition at line 47 of file math.c.

48 {
49  return compare_float(v1->x, v2->x, ulps)
50  && compare_float(v1->y, v2->y, ulps)
51  && compare_float(v1->z, v2->z, ulps);
52 }
static BOOL compare_float(float f, float g, unsigned int ulps)
Definition: math.c:26
GLfloat GLfloat GLfloat v2
Definition: glext.h:6063
unsigned int ulps
Definition: effect.c:4332
GLfloat GLfloat v1
Definition: glext.h:6062

Referenced by expect_vec3_().

◆ compare_vec4()

static BOOL compare_vec4 ( const D3DXVECTOR4 v1,
const D3DXVECTOR4 v2,
unsigned int  ulps 
)
static

Definition at line 54 of file math.c.

55 {
56  return compare_float(v1->x, v2->x, ulps)
57  && compare_float(v1->y, v2->y, ulps)
58  && compare_float(v1->z, v2->z, ulps)
59  && compare_float(v1->w, v2->w, ulps);
60 }
static BOOL compare_float(float f, float g, unsigned int ulps)
Definition: math.c:26
GLfloat GLfloat GLfloat v2
Definition: glext.h:6063
unsigned int ulps
Definition: effect.c:4332
GLfloat GLfloat v1
Definition: glext.h:6062

Referenced by expect_vec4_(), and expect_vec4_array_().

◆ D3DXColorTest()

static void D3DXColorTest ( void  )
static

Definition at line 208 of file math.c.

209 {
210  D3DXCOLOR color, color1, color2, expected, got;
211  LPD3DXCOLOR funcpointer;
212  FLOAT scale;
213 
214  color.r = 0.2f; color.g = 0.75f; color.b = 0.41f; color.a = 0.93f;
215  color1.r = 0.6f; color1.g = 0.55f; color1.b = 0.23f; color1.a = 0.82f;
216  color2.r = 0.3f; color2.g = 0.5f; color2.b = 0.76f; color2.a = 0.11f;
217 
218  scale = 0.3f;
219 
220 /*_______________D3DXColorAdd________________*/
221  expected.r = 0.9f; expected.g = 1.05f; expected.b = 0.99f; expected.a = 0.93f;
222  D3DXColorAdd(&got,&color1,&color2);
223  expect_color(&expected, &got, 1);
224  /* Test the NULL case */
225  funcpointer = D3DXColorAdd(&got,NULL,&color2);
226  ok(funcpointer == NULL, "Expected: %p, Got: %p\n", NULL, funcpointer);
227  funcpointer = D3DXColorAdd(NULL,NULL,&color2);
228  ok(funcpointer == NULL, "Expected: %p, Got: %p\n", NULL, funcpointer);
229  funcpointer = D3DXColorAdd(NULL,NULL,NULL);
230  ok(funcpointer == NULL, "Expected: %p, Got: %p\n", NULL, funcpointer);
231 
232 /*_______________D3DXColorAdjustContrast______*/
233  expected.r = 0.41f; expected.g = 0.575f; expected.b = 0.473f; expected.a = 0.93f;
235  expect_color(&expected, &got, 0);
236 
237 /*_______________D3DXColorAdjustSaturation______*/
238  expected.r = 0.486028f; expected.g = 0.651028f; expected.b = 0.549028f; expected.a = 0.93f;
240  expect_color(&expected, &got, 16);
241 
242 /*_______________D3DXColorLerp________________*/
243  expected.r = 0.32f; expected.g = 0.69f; expected.b = 0.356f; expected.a = 0.897f;
244  D3DXColorLerp(&got,&color,&color1,scale);
245  expect_color(&expected, &got, 0);
246  /* Test the NULL case */
247  funcpointer = D3DXColorLerp(&got,NULL,&color1,scale);
248  ok(funcpointer == NULL, "Expected: %p, Got: %p\n", NULL, funcpointer);
249  funcpointer = D3DXColorLerp(NULL,NULL,&color1,scale);
250  ok(funcpointer == NULL, "Expected: %p, Got: %p\n", NULL, funcpointer);
251  funcpointer = D3DXColorLerp(NULL,NULL,NULL,scale);
252  ok(funcpointer == NULL, "Expected: %p, Got: %p\n", NULL, funcpointer);
253 
254 /*_______________D3DXColorModulate________________*/
255  expected.r = 0.18f; expected.g = 0.275f; expected.b = 0.1748f; expected.a = 0.0902f;
256  D3DXColorModulate(&got,&color1,&color2);
257  expect_color(&expected, &got, 0);
258  /* Test the NULL case */
259  funcpointer = D3DXColorModulate(&got,NULL,&color2);
260  ok(funcpointer == NULL, "Expected: %p, Got: %p\n", NULL, funcpointer);
261  funcpointer = D3DXColorModulate(NULL,NULL,&color2);
262  ok(funcpointer == NULL, "Expected: %p, Got: %p\n", NULL, funcpointer);
263  funcpointer = D3DXColorModulate(NULL,NULL,NULL);
264  ok(funcpointer == NULL, "Expected: %p, Got: %p\n", NULL, funcpointer);
265 
266 /*_______________D3DXColorNegative________________*/
267  expected.r = 0.8f; expected.g = 0.25f; expected.b = 0.59f; expected.a = 0.93f;
268  D3DXColorNegative(&got,&color);
269  expect_color(&expected, &got, 1);
270  /* Test the greater than 1 case */
271  color1.r = 0.2f; color1.g = 1.75f; color1.b = 0.41f; color1.a = 0.93f;
272  expected.r = 0.8f; expected.g = -0.75f; expected.b = 0.59f; expected.a = 0.93f;
273  D3DXColorNegative(&got,&color1);
274  expect_color(&expected, &got, 1);
275  /* Test the negative case */
276  color1.r = 0.2f; color1.g = -0.75f; color1.b = 0.41f; color1.a = 0.93f;
277  expected.r = 0.8f; expected.g = 1.75f; expected.b = 0.59f; expected.a = 0.93f;
278  D3DXColorNegative(&got,&color1);
279  expect_color(&expected, &got, 1);
280  /* Test the NULL case */
281  funcpointer = D3DXColorNegative(&got,NULL);
282  ok(funcpointer == NULL, "Expected: %p, Got: %p\n", NULL, funcpointer);
283  funcpointer = D3DXColorNegative(NULL,NULL);
284  ok(funcpointer == NULL, "Expected: %p, Got: %p\n", NULL, funcpointer);
285 
286 /*_______________D3DXColorScale________________*/
287  expected.r = 0.06f; expected.g = 0.225f; expected.b = 0.123f; expected.a = 0.279f;
288  D3DXColorScale(&got,&color,scale);
289  expect_color(&expected, &got, 1);
290  /* Test the NULL case */
291  funcpointer = D3DXColorScale(&got,NULL,scale);
292  ok(funcpointer == NULL, "Expected: %p, Got: %p\n", NULL, funcpointer);
293  funcpointer = D3DXColorScale(NULL,NULL,scale);
294  ok(funcpointer == NULL, "Expected: %p, Got: %p\n", NULL, funcpointer);
295 
296 /*_______________D3DXColorSubtract_______________*/
297  expected.r = -0.1f; expected.g = 0.25f; expected.b = -0.35f; expected.a = 0.82f;
298  D3DXColorSubtract(&got,&color,&color2);
299  expect_color(&expected, &got, 1);
300  /* Test the NULL case */
301  funcpointer = D3DXColorSubtract(&got,NULL,&color2);
302  ok(funcpointer == NULL, "Expected: %p, Got: %p\n", NULL, funcpointer);
303  funcpointer = D3DXColorSubtract(NULL,NULL,&color2);
304  ok(funcpointer == NULL, "Expected: %p, Got: %p\n", NULL, funcpointer);
305  funcpointer = D3DXColorSubtract(NULL,NULL,NULL);
306  ok(funcpointer == NULL, "Expected: %p, Got: %p\n", NULL, funcpointer);
307 }
#define expect_color(expected, color, ulps)
Definition: math.c:129
GLenum GLenum GLenum GLenum GLenum scale
Definition: glext.h:9032
FLOAT g
Definition: d3dx9math.h:262
FLOAT a
Definition: d3dx9math.h:262
FLOAT r
Definition: d3dx9math.h:262
GLuint color
Definition: glext.h:6243
D3DXCOLOR *WINAPI D3DXColorAdjustContrast(D3DXCOLOR *pout, const D3DXCOLOR *pc, FLOAT s)
Definition: math.c:50
FLOAT b
Definition: d3dx9math.h:262
D3DXCOLOR *WINAPI D3DXColorAdjustSaturation(D3DXCOLOR *pout, const D3DXCOLOR *pc, FLOAT s)
Definition: math.c:61
#define ok(value,...)
Definition: atltest.h:57
#define NULL
Definition: types.h:112
float FLOAT
Definition: typedefs.h:69
BOOL expected
Definition: store.c:2063

Referenced by START_TEST().

◆ D3DXFresnelTest()

static void D3DXFresnelTest ( void  )
static

Definition at line 309 of file math.c.

310 {
311  float fresnel;
312  BOOL equal;
313 
314  fresnel = D3DXFresnelTerm(0.5f, 1.5f);
315  equal = compare_float(fresnel, 8.91867128e-02f, 1);
316  ok(equal, "Got unexpected Fresnel term %.8e.\n", fresnel);
317 }
#define equal(x, y)
Definition: reader.cc:56
static BOOL compare_float(float f, float g, unsigned int ulps)
Definition: math.c:26
unsigned int BOOL
Definition: ntddk_ex.h:94
#define e
Definition: ke_i.h:82
GLfloat f
Definition: glext.h:7540
#define ok(value,...)
Definition: atltest.h:57
FLOAT WINAPI D3DXFresnelTerm(FLOAT costheta, FLOAT refractionindex)
Definition: math.c:77

Referenced by START_TEST().

◆ D3DXMatrixTest()

static void D3DXMatrixTest ( void  )
static

Definition at line 319 of file math.c.

320 {
321  D3DXMATRIX expectedmat, gotmat, mat, mat2, mat3;
322  BOOL expected, got, equal;
323  float angle, determinant;
325  D3DXQUATERNION q, r;
326  D3DXVECTOR3 at, axis, eye, last;
328  D3DXMATRIX *ret;
329 
330  U(mat).m[0][1] = 5.0f; U(mat).m[0][2] = 7.0f; U(mat).m[0][3] = 8.0f;
331  U(mat).m[1][0] = 11.0f; U(mat).m[1][2] = 16.0f; U(mat).m[1][3] = 33.0f;
332  U(mat).m[2][0] = 19.0f; U(mat).m[2][1] = -21.0f; U(mat).m[2][3] = 43.0f;
333  U(mat).m[3][0] = 2.0f; U(mat).m[3][1] = 3.0f; U(mat).m[3][2] = -4.0f;
334  U(mat).m[0][0] = 10.0f; U(mat).m[1][1] = 20.0f; U(mat).m[2][2] = 30.0f;
335  U(mat).m[3][3] = -40.0f;
336 
337  U(mat2).m[0][0] = 1.0f; U(mat2).m[1][0] = 2.0f; U(mat2).m[2][0] = 3.0f;
338  U(mat2).m[3][0] = 4.0f; U(mat2).m[0][1] = 5.0f; U(mat2).m[1][1] = 6.0f;
339  U(mat2).m[2][1] = 7.0f; U(mat2).m[3][1] = 8.0f; U(mat2).m[0][2] = -8.0f;
340  U(mat2).m[1][2] = -7.0f; U(mat2).m[2][2] = -6.0f; U(mat2).m[3][2] = -5.0f;
341  U(mat2).m[0][3] = -4.0f; U(mat2).m[1][3] = -3.0f; U(mat2).m[2][3] = -2.0f;
342  U(mat2).m[3][3] = -1.0f;
343 
344  plane.a = -3.0f; plane.b = -1.0f; plane.c = 4.0f; plane.d = 7.0f;
345 
346  q.x = 1.0f; q.y = -4.0f; q.z =7.0f; q.w = -11.0f;
347  r.x = 0.87f; r.y = 0.65f; r.z =0.43f; r.w= 0.21f;
348 
349  at.x = -2.0f; at.y = 13.0f; at.z = -9.0f;
350  axis.x = 1.0f; axis.y = -3.0f; axis.z = 7.0f;
351  eye.x = 8.0f; eye.y = -5.0f; eye.z = 5.75f;
352  last.x = 9.7f; last.y = -8.6; last.z = 1.3f;
353 
354  light.x = 9.6f; light.y = 8.5f; light.z = 7.4; light.w = 6.3;
355 
356  angle = D3DX_PI/3.0f;
357 
358 /*____________D3DXMatrixAffineTransformation______*/
359  set_matrix(&expectedmat,
360  -459.239990f, -576.719971f, -263.440002f, 0.0f,
361  519.760010f, -352.440002f, -277.679993f, 0.0f,
362  363.119995f, -121.040001f, -117.479996f, 0.0f,
363  -1239.0f, 667.0f, 567.0f, 1.0f);
364  D3DXMatrixAffineTransformation(&gotmat, 3.56f, &at, &q, &axis);
365  expect_matrix(&expectedmat, &gotmat, 0);
366 
367  /* Test the NULL case */
368  U(expectedmat).m[3][0] = 1.0f; U(expectedmat).m[3][1] = -3.0f; U(expectedmat).m[3][2] = 7.0f; U(expectedmat).m[3][3] = 1.0f;
369  D3DXMatrixAffineTransformation(&gotmat, 3.56f, NULL, &q, &axis);
370  expect_matrix(&expectedmat, &gotmat, 0);
371 
372  U(expectedmat).m[3][0] = -1240.0f; U(expectedmat).m[3][1] = 670.0f; U(expectedmat).m[3][2] = 560.0f; U(expectedmat).m[3][3] = 1.0f;
373  D3DXMatrixAffineTransformation(&gotmat, 3.56f, &at, &q, NULL);
374  expect_matrix(&expectedmat, &gotmat, 0);
375 
376  U(expectedmat).m[3][0] = 0.0f; U(expectedmat).m[3][1] = 0.0f; U(expectedmat).m[3][2] = 0.0f; U(expectedmat).m[3][3] = 1.0f;
377  D3DXMatrixAffineTransformation(&gotmat, 3.56f, NULL, &q, NULL);
378  expect_matrix(&expectedmat, &gotmat, 0);
379 
380  set_matrix(&expectedmat,
381  3.56f, 0.0f, 0.0f, 0.0f,
382  0.0f, 3.56f, 0.0f, 0.0f,
383  0.0f, 0.0f, 3.56f, 0.0f,
384  1.0f, -3.0f, 7.0f, 1.0f);
385  D3DXMatrixAffineTransformation(&gotmat, 3.56f, NULL, NULL, &axis);
386  expect_matrix(&expectedmat, &gotmat, 0);
387 
388  D3DXMatrixAffineTransformation(&gotmat, 3.56f, &at, NULL, &axis);
389  expect_matrix(&expectedmat, &gotmat, 0);
390 
391  U(expectedmat).m[3][0] = 0.0f; U(expectedmat).m[3][1] = 0.0f; U(expectedmat).m[3][2] = 0.0f; U(expectedmat).m[3][3] = 1.0f;
392  D3DXMatrixAffineTransformation(&gotmat, 3.56f, &at, NULL, NULL);
393  expect_matrix(&expectedmat, &gotmat, 0);
394 
395  D3DXMatrixAffineTransformation(&gotmat, 3.56f, NULL, NULL, NULL);
396  expect_matrix(&expectedmat, &gotmat, 0);
397 
398 /*____________D3DXMatrixfDeterminant_____________*/
399  determinant = D3DXMatrixDeterminant(&mat);
400  equal = compare_float(determinant, -147888.0f, 0);
401  ok(equal, "Got unexpected determinant %.8e.\n", determinant);
402 
403 /*____________D3DXMatrixInverse______________*/
404  set_matrix(&expectedmat,
405  16067.0f/73944.0f, -10165.0f/147888.0f, -2729.0f/147888.0f, -1631.0f/49296.0f,
406  -565.0f/36972.0f, 2723.0f/73944.0f, -1073.0f/73944.0f, 289.0f/24648.0f,
407  -389.0f/2054.0f, 337.0f/4108.0f, 181.0f/4108.0f, 317.0f/4108.0f,
408  163.0f/5688.0f, -101.0f/11376.0f, -73.0f/11376.0f, -127.0f/3792.0f);
409  D3DXMatrixInverse(&gotmat, &determinant, &mat);
410  expect_matrix(&expectedmat, &gotmat, 1);
411  equal = compare_float(determinant, -147888.0f, 0);
412  ok(equal, "Got unexpected determinant %.8e.\n", determinant);
413  determinant = 5.0f;
414  ret = D3DXMatrixInverse(&gotmat, &determinant, &mat2);
415  ok(!ret, "Unexpected return value %p.\n", ret);
416  expect_matrix(&expectedmat, &gotmat, 1);
417  ok(compare_float(determinant, 5.0f, 0) || broken(!determinant), /* Vista 64 bit testbot */
418  "Unexpected determinant %.8e.\n", determinant);
419 
420 /*____________D3DXMatrixIsIdentity______________*/
421  expected = FALSE;
422  memset(&mat3, 0, sizeof(mat3));
423  got = D3DXMatrixIsIdentity(&mat3);
424  ok(expected == got, "Expected : %d, Got : %d\n", expected, got);
425  D3DXMatrixIdentity(&mat3);
426  expected = TRUE;
427  got = D3DXMatrixIsIdentity(&mat3);
428  ok(expected == got, "Expected : %d, Got : %d\n", expected, got);
429  U(mat3).m[0][0] = 0.000009f;
430  expected = FALSE;
431  got = D3DXMatrixIsIdentity(&mat3);
432  ok(expected == got, "Expected : %d, Got : %d\n", expected, got);
433  /* Test the NULL case */
434  expected = FALSE;
435  got = D3DXMatrixIsIdentity(NULL);
436  ok(expected == got, "Expected : %d, Got : %d\n", expected, got);
437 
438 /*____________D3DXMatrixLookAtLH_______________*/
439  set_matrix(&expectedmat,
440  -0.82246518f, -0.40948939f, -0.39480308f, 0.0f,
441  -0.55585691f, 0.43128574f, 0.71064550f, 0.0f,
442  -0.12072885f, 0.80393475f, -0.58233452f, 0.0f,
443  4.4946337f, 0.80971903f, 10.060076f, 1.0f);
444  D3DXMatrixLookAtLH(&gotmat, &eye, &at, &axis);
445  expect_matrix(&expectedmat, &gotmat, 32);
446 
447 /*____________D3DXMatrixLookAtRH_______________*/
448  set_matrix(&expectedmat,
449  0.82246518f, -0.40948939f, 0.39480308f, 0.0f,
450  0.55585691f, 0.43128574f, -0.71064550f, 0.0f,
451  0.12072885f, 0.80393475f, 0.58233452f, 0.0f,
452  -4.4946337f, 0.80971903f, -10.060076f, 1.0f);
453  D3DXMatrixLookAtRH(&gotmat, &eye, &at, &axis);
454  expect_matrix(&expectedmat, &gotmat, 32);
455 
456 /*____________D3DXMatrixMultiply______________*/
457  set_matrix(&expectedmat,
458  73.0f, 193.0f, -197.0f, -77.0f,
459  231.0f, 551.0f, -489.0f, -169.0f,
460  239.0f, 523.0f, -400.0f, -116.0f,
461  -164.0f, -320.0f, 187.0f, 31.0f);
462  D3DXMatrixMultiply(&gotmat, &mat, &mat2);
463  expect_matrix(&expectedmat, &gotmat, 0);
464 
465 /*____________D3DXMatrixMultiplyTranspose____*/
466  set_matrix(&expectedmat,
467  73.0f, 231.0f, 239.0f, -164.0f,
468  193.0f, 551.0f, 523.0f, -320.0f,
469  -197.0f, -489.0f, -400.0f, 187.0f,
470  -77.0f, -169.0f, -116.0f, 31.0f);
471  D3DXMatrixMultiplyTranspose(&gotmat, &mat, &mat2);
472  expect_matrix(&expectedmat, &gotmat, 0);
473 
474 /*____________D3DXMatrixOrthoLH_______________*/
475  set_matrix(&expectedmat,
476  0.8f, 0.0f, 0.0f, 0.0f,
477  0.0f, 0.27027027f, 0.0f, 0.0f,
478  0.0f, 0.0f, -0.15151515f, 0.0f,
479  0.0f, 0.0f, -0.48484848f, 1.0f);
480  D3DXMatrixOrthoLH(&gotmat, 2.5f, 7.4f, -3.2f, -9.8f);
481  expect_matrix(&expectedmat, &gotmat, 16);
482 
483 /*____________D3DXMatrixOrthoOffCenterLH_______________*/
484  set_matrix(&expectedmat,
485  3.6363636f, 0.0f, 0.0f, 0.0f,
486  0.0f, 0.18018018f, 0.0f, 0.0f,
487  0.0f, 0.0f, -0.045662100f, 0.0f,
488  -1.7272727f, -0.56756757f, 0.42465753f, 1.0f);
489  D3DXMatrixOrthoOffCenterLH(&gotmat, 0.2f, 0.75f, -2.4f, 8.7f, 9.3, -12.6);
490  expect_matrix(&expectedmat, &gotmat, 32);
491 
492 /*____________D3DXMatrixOrthoOffCenterRH_______________*/
493  set_matrix(&expectedmat,
494  3.6363636f, 0.0f, 0.0f, 0.0f,
495  0.0f, 0.18018018f, 0.0f, 0.0f,
496  0.0f, 0.0f, 0.045662100f, 0.0f,
497  -1.7272727f, -0.56756757f, 0.42465753f, 1.0f);
498  D3DXMatrixOrthoOffCenterRH(&gotmat, 0.2f, 0.75f, -2.4f, 8.7f, 9.3, -12.6);
499  expect_matrix(&expectedmat, &gotmat, 32);
500 
501 /*____________D3DXMatrixOrthoRH_______________*/
502  set_matrix(&expectedmat,
503  0.8f, 0.0f, 0.0f, 0.0f,
504  0.0f, 0.27027027f, 0.0f, 0.0f,
505  0.0f, 0.0f, 0.15151515f, 0.0f,
506  0.0f, 0.0f, -0.48484848f, 1.0f);
507  D3DXMatrixOrthoRH(&gotmat, 2.5f, 7.4f, -3.2f, -9.8f);
508  expect_matrix(&expectedmat, &gotmat, 16);
509 
510 /*____________D3DXMatrixPerspectiveFovLH_______________*/
511  set_matrix(&expectedmat,
512  13.288858f, 0.0f, 0.0f, 0.0f,
513  0.0f, 9.9666444f, 0.0f, 0.0f,
514  0.0f, 0.0f, 0.78378378f, 1.0f,
515  0.0f, 0.0f, 1.8810811f, 0.0f);
516  D3DXMatrixPerspectiveFovLH(&gotmat, 0.2f, 0.75f, -2.4f, 8.7f);
517  expect_matrix(&expectedmat, &gotmat, 4);
518 
519 /*____________D3DXMatrixPerspectiveFovRH_______________*/
520  set_matrix(&expectedmat,
521  13.288858f, 0.0f, 0.0f, 0.0f,
522  0.0f, 9.9666444f, 0.0f, 0.0f,
523  0.0f, 0.0f, -0.78378378f, -1.0f,
524  0.0f, 0.0f, 1.8810811f, 0.0f);
525  D3DXMatrixPerspectiveFovRH(&gotmat, 0.2f, 0.75f, -2.4f, 8.7f);
526  expect_matrix(&expectedmat, &gotmat, 4);
527 
528 /*____________D3DXMatrixPerspectiveLH_______________*/
529  set_matrix(&expectedmat,
530  -24.0f, 0.0f, 0.0f, 0.0f,
531  0.0f, -6.4f, 0.0f, 0.0f,
532  0.0f, 0.0f, 0.78378378f, 1.0f,
533  0.0f, 0.0f, 1.8810811f, 0.0f);
534  D3DXMatrixPerspectiveLH(&gotmat, 0.2f, 0.75f, -2.4f, 8.7f);
535  expect_matrix(&expectedmat, &gotmat, 4);
536 
537 /*____________D3DXMatrixPerspectiveOffCenterLH_______________*/
538  set_matrix(&expectedmat,
539  11.636364f, 0.0f, 0.0f, 0.0f,
540  0.0f, 0.57657658f, 0.0f, 0.0f,
541  -1.7272727f, -0.56756757f, 0.84079602f, 1.0f,
542  0.0f, 0.0f, -2.6905473f, 0.0f);
543  D3DXMatrixPerspectiveOffCenterLH(&gotmat, 0.2f, 0.75f, -2.4f, 8.7f, 3.2f, -16.9f);
544  expect_matrix(&expectedmat, &gotmat, 8);
545 
546 /*____________D3DXMatrixPerspectiveOffCenterRH_______________*/
547  set_matrix(&expectedmat,
548  11.636364f, 0.0f, 0.0f, 0.0f,
549  0.0f, 0.57657658f, 0.0f, 0.0f,
550  1.7272727f, 0.56756757f, -0.84079602f, -1.0f,
551  0.0f, 0.0f, -2.6905473f, 0.0f);
552  D3DXMatrixPerspectiveOffCenterRH(&gotmat, 0.2f, 0.75f, -2.4f, 8.7f, 3.2f, -16.9f);
553  expect_matrix(&expectedmat, &gotmat, 8);
554 
555 /*____________D3DXMatrixPerspectiveRH_______________*/
556  set_matrix(&expectedmat,
557  -24.0f, -0.0f, 0.0f, 0.0f,
558  0.0f, -6.4f, 0.0f, 0.0f,
559  0.0f, 0.0f, -0.78378378f, -1.0f,
560  0.0f, 0.0f, 1.8810811f, 0.0f);
561  D3DXMatrixPerspectiveRH(&gotmat, 0.2f, 0.75f, -2.4f, 8.7f);
562  expect_matrix(&expectedmat, &gotmat, 4);
563 
564 /*____________D3DXMatrixReflect______________*/
565  set_matrix(&expectedmat,
566  0.30769235f, -0.23076922f, 0.92307687f, 0.0f,
567  -0.23076922, 0.92307693f, 0.30769232f, 0.0f,
568  0.92307687f, 0.30769232f, -0.23076922f, 0.0f,
569  1.6153846f, 0.53846157f, -2.1538463f, 1.0f);
570  D3DXMatrixReflect(&gotmat, &plane);
571  expect_matrix(&expectedmat, &gotmat, 32);
572 
573 /*____________D3DXMatrixRotationAxis_____*/
574  set_matrix(&expectedmat,
575  0.50847453f, 0.76380461f, 0.39756277f, 0.0f,
576  -0.81465209f, 0.57627118f, -0.065219201f, 0.0f,
577  -0.27891868f, -0.29071301f, 0.91525424f, 0.0f,
578  0.0f, 0.0f, 0.0f, 1.0f);
579  D3DXMatrixRotationAxis(&gotmat, &axis, angle);
580  expect_matrix(&expectedmat, &gotmat, 32);
581 
582 /*____________D3DXMatrixRotationQuaternion______________*/
583  set_matrix(&expectedmat,
584  -129.0f, -162.0f, -74.0f, 0.0f,
585  146.0f, -99.0f, -78.0f, 0.0f,
586  102.0f, -34.0f, -33.0f, 0.0f,
587  0.0f, 0.0f, 0.0f, 1.0f);
588  D3DXMatrixRotationQuaternion(&gotmat, &q);
589  expect_matrix(&expectedmat, &gotmat, 0);
590 
591 /*____________D3DXMatrixRotationX______________*/
592  set_matrix(&expectedmat,
593  1.0f, 0.0f, 0.0f, 0.0f,
594  0.0f, 0.5f, sqrt(3.0f)/2.0f, 0.0f,
595  0.0f, -sqrt(3.0f)/2.0f, 0.5f, 0.0f,
596  0.0f, 0.0f, 0.0f, 1.0f);
597  D3DXMatrixRotationX(&gotmat, angle);
598  expect_matrix(&expectedmat, &gotmat, 1);
599 
600 /*____________D3DXMatrixRotationY______________*/
601  set_matrix(&expectedmat,
602  0.5f, 0.0f, -sqrt(3.0f)/2.0f, 0.0f,
603  0.0f, 1.0f, 0.0f, 0.0f,
604  sqrt(3.0f)/2.0f, 0.0f, 0.5f, 0.0f,
605  0.0f, 0.0f, 0.0f, 1.0f);
606  D3DXMatrixRotationY(&gotmat, angle);
607  expect_matrix(&expectedmat, &gotmat, 1);
608 
609 /*____________D3DXMatrixRotationYawPitchRoll____*/
610  set_matrix(&expectedmat,
611  0.88877726f, 0.091874748f, -0.44903678f, 0.0f,
612  0.35171318f, 0.49148652f, 0.79670501f, 0.0f,
613  0.29389259f, -0.86602545f, 0.40450847f, 0.0f,
614  0.0f, 0.0f, 0.0f, 1.0f);
615  D3DXMatrixRotationYawPitchRoll(&gotmat, 3.0f * angle / 5.0f, angle, 3.0f * angle / 17.0f);
616  expect_matrix(&expectedmat, &gotmat, 64);
617 
618 /*____________D3DXMatrixRotationZ______________*/
619  set_matrix(&expectedmat,
620  0.5f, sqrt(3.0f)/2.0f, 0.0f, 0.0f,
621  -sqrt(3.0f)/2.0f, 0.5f, 0.0f, 0.0f,
622  0.0f, 0.0f, 1.0f, 0.0f,
623  0.0f, 0.0f, 0.0f, 1.0f);
624  D3DXMatrixRotationZ(&gotmat, angle);
625  expect_matrix(&expectedmat, &gotmat, 1);
626 
627 /*____________D3DXMatrixScaling______________*/
628  set_matrix(&expectedmat,
629  0.69f, 0.0f, 0.0f, 0.0f,
630  0.0f, 0.53f, 0.0f, 0.0f,
631  0.0f, 0.0f, 4.11f, 0.0f,
632  0.0f, 0.0f, 0.0f, 1.0f);
633  D3DXMatrixScaling(&gotmat, 0.69f, 0.53f, 4.11f);
634  expect_matrix(&expectedmat, &gotmat, 0);
635 
636 /*____________D3DXMatrixShadow______________*/
637  set_matrix(&expectedmat,
638  12.786773f, 5.0009613f, 4.3537784f, 3.7065949f,
639  1.8827150f, 8.8056154f, 1.4512594f, 1.2355317f,
640  -7.5308599f, -6.6679487f, 1.3335901f, -4.9421268f,
641  -13.179006f, -11.668910f, -10.158816f, -1.5100943f);
642  D3DXMatrixShadow(&gotmat, &light, &plane);
643  expect_matrix(&expectedmat, &gotmat, 8);
644 
645 /*____________D3DXMatrixTransformation______________*/
646  set_matrix(&expectedmat,
647  1.0f, 0.0f, 0.0f, 0.0f,
648  0.0f, 1.0f, 0.0f, 0.0f,
649  0.0f, 0.0f, 1.0f, 0.0f,
650  0.0f, 0.0f, 0.0f, 1.0f);
652  expect_matrix(&expectedmat, &gotmat, 0);
653 
654  set_matrix(&expectedmat,
655  1.0f, 0.0f, 0.0f, 0.0f,
656  0.0f, 1.0f, 0.0f, 0.0f,
657  0.0f, 0.0f, 1.0f, 0.0f,
658  9.7f, -8.6f, 1.3f, 1.0f);
660  expect_matrix(&expectedmat, &gotmat, 0);
661 
662  set_matrix(&expectedmat,
663  -0.2148f, 1.3116f, 0.4752f, 0.0f,
664  0.9504f, -0.8836f, 0.9244f, 0.0f,
665  1.0212f, 0.1936f, -1.3588f, 0.0f,
666  0.0f, 0.0f, 0.0f, 1.0f);
667  D3DXMatrixTransformation(&gotmat, NULL, NULL, NULL, NULL, &r, NULL);
668  expect_matrix(&expectedmat, &gotmat, 8);
669 
670  set_matrix(&expectedmat,
671  1.0f, 0.0f, 0.0f, 0.0f,
672  0.0f, 1.0f, 0.0f, 0.0f,
673  0.0f, 0.0f, 1.0f, 0.0f,
674  0.0f, 0.0f, 0.0f, 1.0f);
675  D3DXMatrixTransformation(&gotmat, NULL, NULL, NULL, &eye, NULL, NULL);
676  expect_matrix(&expectedmat, &gotmat, 0);
677 
678  set_matrix(&expectedmat,
679  1.0f, 0.0f, 0.0f, 0.0f,
680  0.0f, -3.0f, 0.0f, 0.0f,
681  0.0f, 0.0f, 7.0f, 0.0f,
682  0.0f, 0.0f, 0.0f, 1.0f);
683  D3DXMatrixTransformation(&gotmat, NULL, NULL, &axis, NULL, NULL, NULL);
684  expect_matrix(&expectedmat, &gotmat, 0);
685 
686  set_matrix(&expectedmat,
687  1.0f, 0.0f, 0.0f, 0.0f,
688  0.0f, 1.0f, 0.0f, 0.0f,
689  0.0f, 0.0f, 1.0f, 0.0f,
690  0.0f, 0.0f, 0.0f, 1.0f);
691  D3DXMatrixTransformation(&gotmat, NULL, &q, NULL, NULL, NULL, NULL);
692  expect_matrix(&expectedmat, &gotmat, 0);
693 
694  set_matrix(&expectedmat,
695  1.0f, 0.0f, 0.0f, 0.0f,
696  0.0f, 1.0f, 0.0f, 0.0f,
697  0.0f, 0.0f, 1.0f, 0.0f,
698  0.0f, 0.0f, 0.0f, 1.0f);
699  D3DXMatrixTransformation(&gotmat, &at, NULL, NULL, NULL, NULL, NULL);
700  expect_matrix(&expectedmat, &gotmat, 0);
701 
702  set_matrix(&expectedmat,
703  -0.2148f, 1.3116f, 0.4752f, 0.0f,
704  0.9504f, -0.8836f, 0.9244f, 0.0f,
705  1.0212f, 0.1936f, -1.3588f, 0.0f,
706  9.7f, -8.6f, 1.3f, 1.0f);
707  D3DXMatrixTransformation(&gotmat, NULL, NULL, NULL, NULL, &r, &last);
708  expect_matrix(&expectedmat, &gotmat, 8);
709 
710  set_matrix(&expectedmat,
711  1.0f, 0.0f, 0.0f, 0.0f,
712  0.0f, 1.0f, 0.0f, 0.0f,
713  0.0f, 0.0f, 1.0f, 0.0f,
714  9.7f, -8.6f, 1.3f, 1.0f);
715  D3DXMatrixTransformation(&gotmat, NULL, NULL, NULL, &eye, NULL, &last);
716  expect_matrix(&expectedmat, &gotmat, 0);
717 
718  set_matrix(&expectedmat,
719  1.0f, 0.0f, 0.0f, 0.0f,
720  0.0f, -3.0f, 0.0f, 0.0f,
721  0.0f, 0.0f, 7.0f, 0.0f,
722  9.7f, -8.6f, 1.3f, 1.0f);
723  D3DXMatrixTransformation(&gotmat, NULL, NULL, &axis, NULL, NULL, &last);
724  expect_matrix(&expectedmat, &gotmat, 0);
725 
726  set_matrix(&expectedmat,
727  1.0f, 0.0f, 0.0f, 0.0f,
728  0.0f, 1.0f, 0.0f, 0.0f,
729  0.0f, 0.0f, 1.0f, 0.0f,
730  9.7f, -8.6f, 1.3f, 1.0f);
731  D3DXMatrixTransformation(&gotmat, NULL, &q, NULL, NULL, NULL, &last);
732  expect_matrix(&expectedmat, &gotmat, 0);
733 
734  set_matrix(&expectedmat,
735  1.0f, 0.0f, 0.0f, 0.0f,
736  0.0f, 1.0f, 0.0f, 0.0f,
737  0.0f, 0.0f, 1.0f, 0.0f,
738  9.7f, -8.6f, 1.3f, 1.0f);
739  D3DXMatrixTransformation(&gotmat, &at, NULL, NULL, NULL, NULL, &last);
740  expect_matrix(&expectedmat, &gotmat, 0);
741 
742  set_matrix(&expectedmat,
743  -0.2148f, 1.3116f, 0.4752f, 0.0f,
744  0.9504f, -0.8836f, 0.9244f, 0.0f,
745  1.0212f, 0.1936f, -1.3588f, 0.0f,
746  8.5985f, -21.024f, 14.383499, 1.0f);
747  D3DXMatrixTransformation(&gotmat, NULL, NULL, NULL, &eye, &r, NULL);
748  expect_matrix(&expectedmat, &gotmat, 8);
749 
750  set_matrix(&expectedmat,
751  -0.2148f, 1.3116f, 0.4752f, 0.0f,
752  -2.8512f, 2.6508f, -2.7732f, 0.0f,
753  7.148399f, 1.3552f, -9.5116f, 0.0f,
754  0.0f, 0.0f, 0.0f, 1.0f);
755  D3DXMatrixTransformation(&gotmat, NULL, NULL, &axis, NULL, &r, NULL);
756  expect_matrix(&expectedmat, &gotmat, 8);
757 
758  set_matrix(&expectedmat,
759  -0.2148f, 1.3116f, 0.4752f, 0.0f,
760  0.9504f, -0.8836f, 0.9244f, 0.0f,
761  1.0212f, 0.1936f, -1.3588f, 0.0f,
762  0.0f, 0.0f, 0.0f, 1.0f);
763  D3DXMatrixTransformation(&gotmat, NULL, &q, NULL, NULL, &r, NULL);
764  expect_matrix(&expectedmat, &gotmat, 8);
765 
766  set_matrix(&expectedmat,
767  -0.2148f, 1.3116f, 0.4752f, 0.0f,
768  0.9504f, -0.8836f, 0.9244f, 0.0f,
769  1.0212f, 0.1936f, -1.3588f, 0.0f,
770  0.0f, 0.0f, 0.0f, 1.0f);
771  D3DXMatrixTransformation(&gotmat, &at, NULL, NULL, NULL, &r, NULL);
772  expect_matrix(&expectedmat, &gotmat, 8);
773 
774  set_matrix(&expectedmat,
775  1.0f, 0.0f, 0.0f, 0.0f,
776  0.0f, -3.0f, 0.0f, 0.0f,
777  0.0f, 0.0f, 7.0f, 0.0f,
778  0.0f, 0.0f, 0.0f, 1.0f);
779  D3DXMatrixTransformation(&gotmat, NULL, NULL, &axis, &eye, NULL, NULL);
780  expect_matrix(&expectedmat, &gotmat, 0);
781 
782  set_matrix(&expectedmat,
783  1.0f, 0.0f, 0.0f, 0.0f,
784  0.0f, 1.0f, 0.0f, 0.0f,
785  0.0f, 0.0f, 1.0f, 0.0f,
786  0.0f, 0.0f, 0.0f, 1.0f);
787  D3DXMatrixTransformation(&gotmat, NULL, &q, NULL, &eye, NULL, NULL);
788  expect_matrix(&expectedmat, &gotmat, 0);
789 
790  set_matrix(&expectedmat,
791  1.0f, 0.0f, 0.0f, 0.0f,
792  0.0f, 1.0f, 0.0f, 0.0f,
793  0.0f, 0.0f, 1.0f, 0.0f,
794  0.0f, 0.0f, 0.0f, 1.0f);
795  D3DXMatrixTransformation(&gotmat, &at, NULL, NULL, &eye, NULL, NULL);
796  expect_matrix(&expectedmat, &gotmat, 0);
797 
798  set_matrix(&expectedmat,
799  25521.0f, 39984.0f, 20148.0f, 0.0f,
800  39984.0f, 4933.0f, -3324.0f, 0.0f,
801  20148.0f, -3324.0f, -5153.0f, 0.0f,
802  0.0f, 0.0f, 0.0f, 1.0f);
803  D3DXMatrixTransformation(&gotmat, NULL, &q, &axis, NULL, NULL, NULL);
804  expect_matrix(&expectedmat, &gotmat, 0);
805 
806  set_matrix(&expectedmat,
807  1.0f, 0.0f, 0.0f, 0.0f,
808  0.0f, -3.0f, 0.0f, 0.0f,
809  0.0f, 0.0f, 7.0f, 0.0f,
810  0.0f, 52.0f, 54.0f, 1.0f);
811  D3DXMatrixTransformation(&gotmat, &at, NULL, &axis, NULL, NULL, NULL);
812  expect_matrix(&expectedmat, &gotmat, 0);
813 
814  set_matrix(&expectedmat,
815  1.0f, 0.0f, 0.0f, 0.0f,
816  0.0f, 1.0f, 0.0f, 0.0f,
817  0.0f, 0.0f, 1.0f, 0.0f,
818  0.0f, 0.0f, 0.0f, 1.0f);
819  D3DXMatrixTransformation(&gotmat, &at, &q, NULL, NULL, NULL, NULL);
820  expect_matrix(&expectedmat, &gotmat, 0);
821 
822  set_matrix(&expectedmat,
823  -0.2148f, 1.3116f, 0.4752f, 0.0f,
824  0.9504f, -0.8836f, 0.9244f, 0.0f,
825  1.0212f, 0.1936f, -1.3588f, 0.0f,
826  18.2985f, -29.624001f, 15.683499f, 1.0f);
827  D3DXMatrixTransformation(&gotmat, NULL, NULL, NULL, &eye, &r, &last);
828  expect_matrix(&expectedmat, &gotmat, 8);
829 
830  set_matrix(&expectedmat,
831  -0.2148f, 1.3116f, 0.4752f, 0.0f,
832  -2.8512f, 2.6508f, -2.7732f, 0.0f,
833  7.148399f, 1.3552f, -9.5116f, 0.0f,
834  9.7f, -8.6f, 1.3f, 1.0f);
835  D3DXMatrixTransformation(&gotmat, NULL, NULL, &axis, NULL, &r, &last);
836  expect_matrix(&expectedmat, &gotmat, 8);
837 
838  set_matrix(&expectedmat,
839  -0.2148f, 1.3116f, 0.4752f, 0.0f,
840  0.9504f, -0.8836f, 0.9244f, 0.0f,
841  1.0212f, 0.1936f, -1.3588f, 0.0f,
842  9.7f, -8.6f, 1.3f, 1.0f);
843  D3DXMatrixTransformation(&gotmat, NULL, &q, NULL, NULL, &r, &last);
844  expect_matrix(&expectedmat, &gotmat, 8);
845 
846  set_matrix(&expectedmat,
847  -0.2148f, 1.3116f, 0.4752f, 0.0f,
848  0.9504f, -0.8836f, 0.9244f, 0.0f,
849  1.0212f, 0.1936f, -1.3588f, 0.0f,
850  9.7f, -8.6f, 1.3f, 1.0f);
851  D3DXMatrixTransformation(&gotmat, &at, NULL, NULL, NULL, &r, &last);
852  expect_matrix(&expectedmat, &gotmat, 8);
853 
854  set_matrix(&expectedmat,
855  1.0f, 0.0f, 0.0f, 0.0f,
856  0.0f, -3.0f, 0.0f, 0.0f,
857  0.0f, 0.0f, 7.0f, 0.0f,
858  9.7f, -8.6f, 1.3f, 1.0f);
859  D3DXMatrixTransformation(&gotmat, NULL, NULL, &axis, &eye, NULL, &last);
860  expect_matrix(&expectedmat, &gotmat, 0);
861 
862  set_matrix(&expectedmat,
863  1.0f, 0.0f, 0.0f, 0.0f,
864  0.0f, 1.0f, 0.0f, 0.0f,
865  0.0f, 0.0f, 1.0f, 0.0f,
866  9.7f, -8.6f, 1.3f, 1.0f);
867  D3DXMatrixTransformation(&gotmat, NULL, &q, NULL, &eye, NULL, &last);
868  expect_matrix(&expectedmat, &gotmat, 0);
869 
870  set_matrix(&expectedmat,
871  1.0f, 0.0f, 0.0f, 0.0f,
872  0.0f, 1.0f, 0.0f, 0.0f,
873  0.0f, 0.0f, 1.0f, 0.0f,
874  9.7f, -8.6f, 1.3f, 1.0f);
875  D3DXMatrixTransformation(&gotmat, &at, NULL, NULL, &eye, NULL, &last);
876  expect_matrix(&expectedmat, &gotmat, 0);
877 
878  set_matrix(&expectedmat,
879  25521.0f, 39984.0f, 20148.0f, 0.0f,
880  39984.0f, 4933.0f, -3324.0f, 0.0f,
881  20148.0f, -3324.0f, -5153.0f, 0.0f,
882  9.7f, -8.6f, 1.3f, 1.0f);
883  D3DXMatrixTransformation(&gotmat, NULL, &q, &axis, NULL, NULL, &last);
884  expect_matrix(&expectedmat, &gotmat, 0);
885 
886  set_matrix(&expectedmat,
887  1.0f, 0.0f, 0.0f, 0.0f,
888  0.0f, -3.0f, 0.0f, 0.0f,
889  0.0f, 0.0f, 7.0f, 0.0f,
890  9.7f, 43.400002f, 55.299999f, 1.0f);
891  D3DXMatrixTransformation(&gotmat, &at, NULL, &axis, NULL, NULL, &last);
892  expect_matrix(&expectedmat, &gotmat, 0);
893 
894  set_matrix(&expectedmat,
895  1.0f, 0.0f, 0.0f, 0.0f,
896  0.0f, 1.0f, 0.0f, 0.0f,
897  0.0f, 0.0f, 1.0f, 0.0f,
898  9.7f, -8.6f, 1.3f, 1.0f);
899  D3DXMatrixTransformation(&gotmat, &at, &q, NULL, NULL, NULL, &last);
900  expect_matrix(&expectedmat, &gotmat, 0);
901 
902  set_matrix(&expectedmat,
903  -0.2148f, 1.3116f, 0.4752f, 0.0f,
904  -2.8512f, 2.6508f, -2.7732f, 0.0f,
905  7.148399f, 1.3552f, -9.5116f, 0.0f,
906  8.5985f, -21.024f, 14.383499, 1.0f);
907  D3DXMatrixTransformation(&gotmat, NULL, NULL, &axis, &eye, &r, NULL);
908  expect_matrix(&expectedmat, &gotmat, 8);
909 
910  set_matrix(&expectedmat,
911  -0.2148f, 1.3116f, 0.4752f, 0.0f,
912  0.9504f, -0.8836f, 0.9244f, 0.0f,
913  1.0212f, 0.1936f, -1.3588f, 0.0f,
914  8.5985f, -21.024f, 14.383499, 1.0f);
915  D3DXMatrixTransformation(&gotmat, NULL, &q, NULL, &eye, &r, NULL);
916  expect_matrix(&expectedmat, &gotmat, 8);
917 
918  set_matrix(&expectedmat,
919  -0.2148f, 1.3116f, 0.4752f, 0.0f,
920  0.9504f, -0.8836f, 0.9244f, 0.0f,
921  1.0212f, 0.1936f, -1.3588f, 0.0f,
922  8.5985f, -21.024f, 14.383499, 1.0f);
923  D3DXMatrixTransformation(&gotmat, &at, NULL, NULL, &eye, &r, NULL);
924  expect_matrix(&expectedmat, &gotmat, 8);
925 
926  set_matrix(&expectedmat,
927  53094.015625f, 2044.133789f, 21711.687500f, 0.0f,
928  -7294.705078f, 47440.683594f, 28077.113281, 0.0f,
929  -12749.161133f, 28365.580078f, 13503.520508f, 0.0f,
930  0.0f, 0.0f, 0.0f, 1.0f);
931  D3DXMatrixTransformation(&gotmat, NULL, &q, &axis, NULL, &r, NULL);
932  expect_matrix(&expectedmat, &gotmat, 32);
933 
934  set_matrix(&expectedmat,
935  -0.2148f, 1.3116f, 0.4752f, 0.0f,
936  -2.8512f, 2.6508f, -2.7732f, 0.0f,
937  7.148399f, 1.3552f, -9.5116f, 0.0f,
938  104.565598f, -35.492798f, -25.306400f, 1.0f);
939  D3DXMatrixTransformation(&gotmat, &at, NULL, &axis, NULL, &r, NULL);
940  expect_matrix(&expectedmat, &gotmat, 8);
941 
942  set_matrix(&expectedmat,
943  -0.2148f, 1.3116f, 0.4752f, 0.0f,
944  0.9504f, -0.8836f, 0.9244f, 0.0f,
945  1.0212f, 0.1936f, -1.3588f, 0.0f,
946  0.0f, 0.0f, 0.0f, 1.0f);
947  D3DXMatrixTransformation(&gotmat, &at, &q, NULL, NULL, &r, NULL);
948  expect_matrix(&expectedmat, &gotmat, 8);
949 
950  set_matrix(&expectedmat,
951  25521.0f, 39984.0f, 20148.0f, 0.0f,
952  39984.0f, 4933.0f, -3324.0f, 0.0f,
953  20148.0f, -3324.0f, -5153.0f, 0.0f,
954  0.0f, 0.0f, 0.0f, 1.0f);
955  D3DXMatrixTransformation(&gotmat, NULL, &q, &axis, &eye, NULL, NULL);
956  expect_matrix(&expectedmat, &gotmat, 0);
957 
958  set_matrix(&expectedmat,
959  1.0f, 0.0f, 0.0f, 0.0f,
960  0.0f, -3.0f, 0.0f, 0.0f,
961  0.0f, 0.0f, 7.0f, 0.0f,
962  0.0f, 52.0f, 54.0f, 1.0f);
963  D3DXMatrixTransformation(&gotmat, &at, NULL, &axis, &eye, NULL, NULL);
964  expect_matrix(&expectedmat, &gotmat, 0);
965 
966  set_matrix(&expectedmat,
967  1.0f, 0.0f, 0.0f, 0.0f,
968  0.0f, 1.0f, 0.0f, 0.0f,
969  0.0f, 0.0f, 1.0f, 0.0f,
970  0.0f, 0.0f, 0.0f, 1.0f);
971  D3DXMatrixTransformation(&gotmat, &at, &q, NULL, &eye, NULL, NULL);
972  expect_matrix(&expectedmat, &gotmat, 0);
973 
974  set_matrix(&expectedmat,
975  25521.0f, 39984.0f, 20148.0f, 0.0f,
976  39984.0f, 4933.0f, -3324.0f, 0.0f,
977  20148.0f, -3324.0f, -5153.0f, 0.0f,
978  -287420.0f, -14064.0f, 37122.0f, 1.0f);
979  D3DXMatrixTransformation(&gotmat, &at, &q, &axis, NULL, NULL, NULL);
980  expect_matrix(&expectedmat, &gotmat, 0);
981 
982  set_matrix(&expectedmat,
983  -0.2148f, 1.3116f, 0.4752f, 0.0f,
984  -2.8512f, 2.6508f, -2.7732f, 0.0f,
985  7.148399f, 1.3552f, -9.5116f, 0.0f,
986  18.2985f, -29.624001f, 15.683499f, 1.0f);
987  D3DXMatrixTransformation(&gotmat, NULL, NULL, &axis, &eye, &r, &last);
988  expect_matrix(&expectedmat, &gotmat, 8);
989 
990  set_matrix(&expectedmat,
991  -0.2148f, 1.3116f, 0.4752f, 0.0f,
992  0.9504f, -0.8836f, 0.9244f, 0.0f,
993  1.0212f, 0.1936f, -1.3588f, 0.0f,
994  18.2985f, -29.624001f, 15.683499f, 1.0f);
995  D3DXMatrixTransformation(&gotmat, NULL, &q, NULL, &eye, &r, &last);
996  expect_matrix(&expectedmat, &gotmat, 8);
997 
998  set_matrix(&expectedmat,
999  -0.2148f, 1.3116f, 0.4752f, 0.0f,
1000  0.9504f, -0.8836f, 0.9244f, 0.0f,
1001  1.0212f, 0.1936f, -1.3588f, 0.0f,
1002  18.2985f, -29.624001f, 15.683499f, 1.0f);
1003  D3DXMatrixTransformation(&gotmat, &at, NULL, NULL, &eye, &r, &last);
1004  expect_matrix(&expectedmat, &gotmat, 8);
1005 
1006  set_matrix(&expectedmat,
1007  53094.015625f, 2044.133789f, 21711.687500f, 0.0f,
1008  -7294.705078f, 47440.683594f, 28077.113281, 0.0f,
1009  -12749.161133f, 28365.580078f, 13503.520508f, 0.0f,
1010  9.7f, -8.6f, 1.3f, 1.0f);
1011  D3DXMatrixTransformation(&gotmat, NULL, &q, &axis, NULL, &r, &last);
1012  expect_matrix(&expectedmat, &gotmat, 32);
1013 
1014  set_matrix(&expectedmat,
1015  -0.2148f, 1.3116f, 0.4752f, 0.0f,
1016  -2.8512f, 2.6508f, -2.7732f, 0.0f,
1017  7.148399f, 1.3552f, -9.5116f, 0.0f,
1018  114.265594f, -44.092796f, -24.006401f, 1.0f);
1019  D3DXMatrixTransformation(&gotmat, &at, NULL, &axis, NULL, &r, &last);
1020  expect_matrix(&expectedmat, &gotmat, 8);
1021 
1022  set_matrix(&expectedmat,
1023  -0.2148f, 1.3116f, 0.4752f, 0.0f,
1024  0.9504f, -0.8836f, 0.9244f, 0.0f,
1025  1.0212f, 0.1936f, -1.3588f, 0.0f,
1026  9.7f, -8.6f, 1.3f, 1.0f);
1027  D3DXMatrixTransformation(&gotmat, &at, &q, NULL, NULL, &r, &last);
1028  expect_matrix(&expectedmat, &gotmat, 8);
1029 
1030  set_matrix(&expectedmat,
1031  25521.0f, 39984.0f, 20148.0f, 0.0f,
1032  39984.0f, 4933.0f, -3324.0f, 0.0f,
1033  20148.0f, -3324.0f, -5153.0f, 0.0f,
1034  9.7f, -8.6f, 1.3f, 1.0f);
1035  D3DXMatrixTransformation(&gotmat, NULL, &q, &axis, &eye, NULL, &last);
1036  expect_matrix(&expectedmat, &gotmat, 0);
1037 
1038  set_matrix(&expectedmat,
1039  1.0f, 0.0f, 0.0f, 0.0f,
1040  0.0f, -3.0f, 0.0f, 0.0f,
1041  0.0f, 0.0f, 7.0f, 0.0f,
1042  9.7f, 43.400002f, 55.299999f, 1.0f);
1043  D3DXMatrixTransformation(&gotmat, &at, NULL, &axis, &eye, NULL, &last);
1044  expect_matrix(&expectedmat, &gotmat, 0);
1045 
1046  set_matrix(&expectedmat,
1047  1.0f, 0.0f, 0.0f, 0.0f,
1048  0.0f, 1.0f, 0.0f, 0.0f,
1049  0.0f, 0.0f, 1.0f, 0.0f,
1050  9.7f, -8.6f, 1.3f, 1.0f);
1051  D3DXMatrixTransformation(&gotmat, &at, &q, NULL, &eye, NULL, &last);
1052  expect_matrix(&expectedmat, &gotmat, 0);
1053 
1054  set_matrix(&expectedmat,
1055  25521.0f, 39984.0f, 20148.0f, 0.0f,
1056  39984.0f, 4933.0f, -3324.0f, 0.0f,
1057  20148.0f, -3324.0f, -5153.0f, 0.0f,
1058  -287410.3125f, -14072.599609f, 37123.300781f, 1.0f);
1059  D3DXMatrixTransformation(&gotmat, &at, &q, &axis, NULL, NULL, &last);
1060  expect_matrix(&expectedmat, &gotmat, 0);
1061 
1062  set_matrix(&expectedmat,
1063  53094.015625f, 2044.133789f, 21711.687500f, 0.0f,
1064  -7294.705078f, 47440.683594f, 28077.113281, 0.0f,
1065  -12749.161133f, 28365.580078f, 13503.520508f, 0.0f,
1066  8.598499f, -21.024f, 14.383499f, 1.0f);
1067  D3DXMatrixTransformation(&gotmat, NULL, &q, &axis, &eye, &r, NULL);
1068  expect_matrix(&expectedmat, &gotmat, 32);
1069 
1070  set_matrix(&expectedmat,
1071  -0.2148f, 1.3116f, 0.4752f, 0.0f,
1072  -2.8512f, 2.6508f, -2.7732f, 0.0f,
1073  7.148399f, 1.3552f, -9.5116f, 0.0f,
1074  113.164093f, -56.5168f, -10.922897f, 1.0f);
1075  D3DXMatrixTransformation(&gotmat, &at, NULL, &axis, &eye, &r, NULL);
1076  expect_matrix(&expectedmat, &gotmat, 8);
1077 
1078  set_matrix(&expectedmat,
1079  -0.2148f, 1.3116f, 0.4752f, 0.0f,
1080  0.9504f, -0.8836f, 0.9244f, 0.0f,
1081  1.0212f, 0.1936f, -1.3588f, 0.0f,
1082  8.5985f, -21.024f, 14.383499, 1.0f);
1083  D3DXMatrixTransformation(&gotmat, &at, &q, NULL, &eye, &r, NULL);
1084  expect_matrix(&expectedmat, &gotmat, 8);
1085 
1086  set_matrix(&expectedmat,
1087  53094.015625f, 2044.133789f, 21711.687500f, 0.0f,
1088  -7294.705078f, 47440.683594f, 28077.113281, 0.0f,
1089  -12749.161133f, 28365.580078f, 13503.520508f, 0.0f,
1090  86280.34375f, -357366.3125f, -200024.125f, 1.0f);
1091  D3DXMatrixTransformation(&gotmat, &at, &q, &axis, NULL, &r, NULL);
1092  expect_matrix(&expectedmat, &gotmat, 32);
1093 
1094  set_matrix(&expectedmat,
1095  25521.0f, 39984.0f, 20148.0f, 0.0f,
1096  39984.0f, 4933.0f, -3324.0f, 0.0f,
1097  20148.0f, -3324.0f, -5153.0f, 0.0f,
1098  -287410.3125f, -14064.0f, 37122.0f, 1.0f);
1099  D3DXMatrixTransformation(&gotmat, &at, &q, &axis, &eye, NULL, NULL);
1100  expect_matrix(&expectedmat, &gotmat, 512);
1101 
1102  set_matrix(&expectedmat,
1103  53094.015625f, 2044.133789f, 21711.687500f, 0.0f,
1104  -7294.705078f, 47440.683594f, 28077.113281, 0.0f,
1105  -12749.161133f, 28365.580078f, 13503.520508f, 0.0f,
1106  86280.34375f, -357366.3125f, -200009.75f, 1.0f);
1107  D3DXMatrixTransformation(&gotmat, &at, &q, &axis, &eye, &r, NULL);
1108  expect_matrix(&expectedmat, &gotmat, 2048);
1109 
1110  set_matrix(&expectedmat,
1111  25521.0f, 39984.0f, 20148.0f, 0.0f,
1112  39984.0f, 4933.0f, -3324.0f, 0.0f,
1113  20148.0f, -3324.0f, -5153.0f, 0.0f,
1114  -287410.3125f, -14072.599609f, 37123.300781f, 1.0f);
1115  D3DXMatrixTransformation(&gotmat, &at, &q, &axis, &eye, NULL, &last);
1116  expect_matrix(&expectedmat, &gotmat, 0);
1117 
1118  set_matrix(&expectedmat,
1119  53094.015625f, 2044.133789f, 21711.687500f, 0.0f,
1120  -7294.705078f, 47440.683594f, 28077.113281, 0.0f,
1121  -12749.161133f, 28365.580078f, 13503.520508f, 0.0f,
1122  86290.046875f, -357374.90625f, -200022.828125f, 1.0f);
1123  D3DXMatrixTransformation(&gotmat, &at, &q, &axis, NULL, &r, &last);
1124  expect_matrix(&expectedmat, &gotmat, 32);
1125 
1126  set_matrix(&expectedmat,
1127  -0.21480007f, 1.3116000f, 0.47520003f, 0.0f,
1128  0.95040143f, -0.88360137f, 0.92439979f, 0.0f,
1129  1.0212044f, 0.19359307f, -1.3588026f, 0.0f,
1130  18.298532f, -29.624001f, 15.683499f, 1.0f);
1131  D3DXMatrixTransformation(&gotmat, &at, &q, NULL, &eye, &r, &last);
1132  expect_matrix(&expectedmat, &gotmat, 512);
1133 
1134  set_matrix(&expectedmat,
1135  -0.2148f, 1.3116f, 0.4752f, 0.0f,
1136  -2.8512f, 2.6508f, -2.7732f, 0.0f,
1137  7.148399f, 1.3552f, -9.5116f, 0.0f,
1138  122.86409f, -65.116798f, -9.622897f, 1.0f);
1139  D3DXMatrixTransformation(&gotmat, &at, NULL, &axis, &eye, &r, &last);
1140  expect_matrix(&expectedmat, &gotmat, 8);
1141 
1142  set_matrix(&expectedmat,
1143  53094.015625f, 2044.133789f, 21711.687500f, 0.0f,
1144  -7294.705078f, 47440.683594f, 28077.113281, 0.0f,
1145  -12749.161133f, 28365.580078f, 13503.520508f, 0.0f,
1146  18.2985f, -29.624001f, 15.683499f, 1.0f);
1147  D3DXMatrixTransformation(&gotmat, NULL, &q, &axis, &eye, &r, &last);
1148  expect_matrix(&expectedmat, &gotmat, 32);
1149 
1150  q.x = 1.0f; q.y = 1.0f; q.z = 1.0f; q.w = 1.0f;
1151  axis.x = 1.0f; axis.y = 1.0f; axis.z = 2.0f;
1152 
1153  set_matrix(&expectedmat,
1154  41.0f, -12.0f, -24.0f, 0.0f,
1155  -12.0f, 25.0f, -12.0f, 0.0f,
1156  -24.0f, -12.0f, 34.0f, 0.0f,
1157  0.0f, 0.0f, 0.0f, 1.0f);
1158  D3DXMatrixTransformation(&gotmat, NULL, &q, &axis, NULL, NULL, NULL);
1159  expect_matrix(&expectedmat, &gotmat, 0);
1160 
1161  q.x = 1.0f; q.y = 1.0f; q.z = 1.0f; q.w = 1.0f;
1162  axis.x = 1.0f; axis.y = 1.0f; axis.z = 3.0f;
1163 
1164  set_matrix(&expectedmat,
1165  57.0f, -12.0f, -36.0f, 0.0f,
1166  -12.0f, 25.0f, -12.0f, 0.0f,
1167  -36.0f, -12.0f, 43.0f, 0.0f,
1168  0.0f, 0.0f, 0.0f, 1.0f);
1169  D3DXMatrixTransformation(&gotmat, NULL, &q, &axis, NULL, NULL, NULL);
1170  expect_matrix(&expectedmat, &gotmat, 0);
1171 
1172  q.x = 1.0f; q.y = 1.0f; q.z = 1.0f; q.w = 0.0f;
1173  axis.x = 1.0f; axis.y = 1.0f; axis.z = 3.0f;
1174 
1175  set_matrix(&expectedmat,
1176  25.0f, 0.0f, -20.0f, 0.0f,
1177  0.0f, 25.0f, -20.0f, 0.0f,
1178  -20.0f, -20.0f, 35.0f, 0.0f,
1179  0.0f, 0.0f, 0.0f, 1.0f);
1180  D3DXMatrixTransformation(&gotmat, NULL, &q, &axis, NULL, NULL, NULL);
1181  expect_matrix(&expectedmat, &gotmat, 0);
1182 
1183  q.x = 1.0f; q.y = 1.0f; q.z = 0.0f; q.w = 0.0f;
1184  axis.x = 1.0f; axis.y = 1.0f; axis.z = 3.0f;
1185 
1186  set_matrix(&expectedmat,
1187  5.0f, -4.0f, 0.0f, 0.0f,
1188  -4.0f, 5.0f, 0.0f, 0.0f,
1189  0.0f, 0.0f, 27.0f, 0.0f,
1190  0.0f, 0.0f, 0.0f, 1.0f);
1191  D3DXMatrixTransformation(&gotmat, NULL, &q, &axis, NULL, NULL, NULL);
1192  expect_matrix(&expectedmat, &gotmat, 0);
1193 
1194  q.x = 1.0f; q.y = 0.0f; q.z = 0.0f; q.w = 0.0f;
1195  axis.x = 5.0f; axis.y = 2.0f; axis.z = 1.0f;
1196 
1197  set_matrix(&expectedmat,
1198  5.0f, 0.0f, 0.0f, 0.0f,
1199  0.0f, 2.0f, 0.0f, 0.0f,
1200  0.0f, 0.0f, 1.0f, 0.0f,
1201  0.0f, 0.0f, 0.0f, 1.0f);
1202  D3DXMatrixTransformation(&gotmat, NULL, &q, &axis, NULL, NULL, NULL);
1203  expect_matrix(&expectedmat, &gotmat, 0);
1204 
1205  q.x = 1.0f; q.y = 0.0f; q.z = 0.0f; q.w = 0.0f;
1206  axis.x = 1.0f; axis.y = 4.0f; axis.z = 1.0f;
1207 
1208  set_matrix(&expectedmat,
1209  1.0f, 0.0f, 0.0f, 0.0f,
1210  0.0f, 4.0f, 0.0f, 0.0f,
1211  0.0f, 0.0f, 1.0f, 0.0f,
1212  0.0f, 0.0f, 0.0f, 1.0f);
1213  D3DXMatrixTransformation(&gotmat, NULL, &q, &axis, NULL, NULL, NULL);
1214  expect_matrix(&expectedmat, &gotmat, 0);
1215 
1216  q.x = 0.0f; q.y = 1.0f; q.z = 0.0f; q.w = 0.0f;
1217  axis.x = 1.0f; axis.y = 4.0f; axis.z = 1.0f;
1218 
1219  set_matrix(&expectedmat,
1220  1.0f, 0.0f, 0.0f, 0.0f,
1221  0.0f, 4.0f, 0.0f, 0.0f,
1222  0.0f, 0.0f, 1.0f, 0.0f,
1223  0.0f, 0.0f, 0.0f, 1.0f);
1224  D3DXMatrixTransformation(&gotmat, NULL, &q, &axis, NULL, NULL, NULL);
1225  expect_matrix(&expectedmat, &gotmat, 0);
1226 
1227  q.x = 1.0f; q.y = 0.0f; q.z = 0.0f; q.w = 1.0f;
1228  axis.x = 1.0f; axis.y = 4.0f; axis.z = 1.0f;
1229 
1230  set_matrix(&expectedmat,
1231  1.0f, 0.0f, 0.0f, 0.0f,
1232  0.0f, 8.0f, -6.0f, 0.0f,
1233  0.0f, -6.0f, 17.0f, 0.0f,
1234  0.0f, 0.0f, 0.0f, 1.0f);
1235  D3DXMatrixTransformation(&gotmat, NULL, &q, &axis, NULL, NULL, NULL);
1236  expect_matrix(&expectedmat, &gotmat, 0);
1237 
1238  q.x = 1.0f; q.y = 0.0f; q.z = 0.0f; q.w = 1.0f;
1239  axis.x = 0.0f; axis.y = 4.0f; axis.z = 0.0f;
1240 
1241  set_matrix(&expectedmat,
1242  0.0f, 0.0f, 0.0f, 0.0f,
1243  0.0f, 4.0f, -8.0f, 0.0f,
1244  0.0f, -8.0f, 16.0f, 0.0f,
1245  0.0f, 0.0f, 0.0f, 1.0f);
1246  D3DXMatrixTransformation(&gotmat, NULL, &q, &axis, NULL, NULL, NULL);
1247  expect_matrix(&expectedmat, &gotmat, 0);
1248 
1249  q.x = 0.0f; q.y = 1.0f; q.z = 0.0f; q.w = 1.0f;
1250  axis.x = 1.0f; axis.y = 4.0f; axis.z = 1.0f;
1251 
1252  set_matrix(&expectedmat,
1253  5.0f, 0.0f, 0.0f, 0.0f,
1254  0.0f, 4.0f, 0.0f, 0.0f,
1255  0.0f, 0.0f, 5.0f, 0.0f,
1256  0.0f, 0.0f, 0.0f, 1.0f);
1257  D3DXMatrixTransformation(&gotmat, NULL, &q, &axis, NULL, NULL, NULL);
1258  expect_matrix(&expectedmat, &gotmat, 0);
1259 
1260  q.x = 1.0f; q.y = 0.0f; q.z = 0.0f; q.w = 0.0f;
1261  axis.x = 1.0f; axis.y = 1.0f; axis.z = 3.0f;
1262 
1263  set_matrix(&expectedmat,
1264  1.0f, 0.0f, 0.0f, 0.0f,
1265  0.0f, 1.0f, 0.0f, 0.0f,
1266  0.0f, 0.0f, 3.0f, 0.0f,
1267  0.0f, 0.0f, 0.0f, 1.0f);
1268  D3DXMatrixTransformation(&gotmat, NULL, &q, &axis, NULL, NULL, NULL);
1269  expect_matrix(&expectedmat, &gotmat, 0);
1270 
1271  q.x = 11.0f; q.y = 13.0f; q.z = 15.0f; q.w = 17.0f;
1272  axis.x = 3.0f; axis.y = 3.0f; axis.z = 3.0f;
1273 
1274  set_matrix(&expectedmat,
1275  3796587.0f, -1377948.0f, -1589940.0f, 0.0f,
1276  -1377948.0f, 3334059.0f, -1879020.0f, 0.0f,
1277  -1589940.0f, -1879020.0f, 2794443.0f, 0.0f,
1278  0.0f, 0.0f, 0.0f, 1.0f);
1279  D3DXMatrixTransformation(&gotmat, NULL, &q, &axis, NULL, NULL, NULL);
1280  expect_matrix(&expectedmat, &gotmat, 0);
1281 
1282  q.x = 11.0f; q.y = 13.0f; q.z = 15.0f; q.w = 17.0f;
1283  axis.x = 1.0f; axis.y = 1.0f; axis.z = 1.0f;
1284 
1285  set_matrix(&expectedmat,
1286  1265529.0f, -459316.0f, -529980.0f, 0.0f,
1287  -459316.0f, 1111353.0f, -626340.0f, 0.0f,
1288  -529980.0f, -626340.0f, 931481.0f, 0.0f,
1289  0.0f, 0.0f, 0.0f, 1.0f);
1290  D3DXMatrixTransformation(&gotmat, NULL, &q, &axis, NULL, NULL, NULL);
1291  expect_matrix(&expectedmat, &gotmat, 0);
1292 
1293  q.x = 11.0f; q.y = 13.0f; q.z = 15.0f; q.w = 17.0f;
1294  axis.x = 1.0f; axis.y = 1.0f; axis.z = 3.0f;
1295 
1296  set_matrix(&expectedmat,
1297  2457497.0f, -434612.0f, -1423956.0f, 0.0f,
1298  -434612.0f, 1111865.0f, -644868.0f, 0.0f,
1299  -1423956.0f, -644868.0f, 1601963.0f, 0.0f,
1300  0.0f, 0.0f, 0.0f, 1.0f);
1301  D3DXMatrixTransformation(&gotmat, NULL, &q, &axis, NULL, NULL, NULL);
1302  expect_matrix(&expectedmat, &gotmat, 0);
1303 
1304  q.x = 11.0f; q.y = 13.0f; q.z = 15.0f; q.w = 17.0f;
1305  axis.x = 0.0f; axis.y = 0.0f; axis.z = 3.0f;
1306 
1307  set_matrix(&expectedmat,
1308  1787952.0f, 37056.0f, -1340964.0f, 0.0f,
1309  37056.0f, 768.0f, -27792.0f, 0.0f,
1310  -1340964.0f, -27792.0f, 1005723.0f, 0.0f,
1311  0.0f, 0.0f, 0.0f, 1.0f);
1312  D3DXMatrixTransformation(&gotmat, NULL, &q, &axis, NULL, NULL, NULL);
1313  expect_matrix(&expectedmat, &gotmat, 0);
1314 
1315  q.x = 11.0f; q.y = 13.0f; q.z = 15.0f; q.w = 17.0f;
1316  axis.x = 0.0f; axis.y = 0.0f; axis.z = 1.0f;
1317 
1318  set_matrix(&expectedmat,
1319  595984.0f, 12352.0f, -446988.0f, 0.0f,
1320  12352.0f, 256.0f, -9264.0f, 0.0f,
1321  -446988.0f, -9264.0f, 335241.0f, 0.0f,
1322  0.0f, 0.0f, 0.0f, 1.0f);
1323  D3DXMatrixTransformation(&gotmat, NULL, &q, &axis, NULL, NULL, NULL);
1324  expect_matrix(&expectedmat, &gotmat, 0);
1325 
1326  q.x = 11.0f; q.y = 13.0f; q.z = 15.0f; q.w = 17.0f;
1327  axis.x = 0.0f; axis.y = 3.0f; axis.z = 0.0f;
1328 
1329  set_matrix(&expectedmat,
1330  150528.0f, 464352.0f, -513408.0f, 0.0f,
1331  464352.0f, 1432443.0f, -1583772.0f, 0.0f,
1332  -513408.0f, -1583772.0f, 1751088.0f, 0.0f,
1333  0.0f, 0.0f, 0.0f, 1.0f);
1334  D3DXMatrixTransformation(&gotmat, NULL, &q, &axis, NULL, NULL, NULL);
1335  expect_matrix(&expectedmat, &gotmat, 0);
1336 
1337  q.x = 11.0f; q.y = 13.0f; q.z = 15.0f; q.w = 17.0f;
1338  axis.x = 0.0f; axis.y = 1.0f; axis.z = 0.0f;
1339 
1340  set_matrix(&expectedmat,
1341  50176.0f, 154784.0f, -171136.0f, 0.0f,
1342  154784.0f, 477481.0f, -527924.0f, 0.0f,
1343  -171136.0f, -527924.0f, 583696.0f, 0.0f,
1344  0.0f, 0.0f, 0.0f, 1.0f);
1345  D3DXMatrixTransformation(&gotmat, NULL, &q, &axis, NULL, NULL, NULL);
1346  expect_matrix(&expectedmat, &gotmat, 0);
1347 
1348  q.x = 11.0f; q.y = 13.0f; q.z = 15.0f; q.w = 17.0f;
1349  axis.x = 1.0f; axis.y = 0.0f; axis.z = 0.0f;
1350 
1351  set_matrix(&expectedmat,
1352  619369.0f, -626452.0f, 88144.0f, 0.0f,
1353  -626452.0f, 633616.0f, -89152.0f, 0.0f,
1354  88144.0f, -89152, 12544.0f, 0.0f,
1355  0.0f, 0.0f, 0.0f, 1.0f);
1356  D3DXMatrixTransformation(&gotmat, NULL, &q, &axis, NULL, NULL, NULL);
1357  expect_matrix(&expectedmat, &gotmat, 0);
1358 
1359 /*____________D3DXMatrixTranslation______________*/
1360  set_matrix(&expectedmat,
1361  1.0f, 0.0f, 0.0f, 0.0f,
1362  0.0f, 1.0f, 0.0f, 0.0f,
1363  0.0f, 0.0f, 1.0f, 0.0f,
1364  0.69f, 0.53f, 4.11f, 1.0f);
1365  D3DXMatrixTranslation(&gotmat, 0.69f, 0.53f, 4.11f);
1366  expect_matrix(&expectedmat, &gotmat, 0);
1367 
1368 /*____________D3DXMatrixTranspose______________*/
1369  set_matrix(&expectedmat,
1370  10.0f, 11.0f, 19.0f, 2.0f,
1371  5.0f, 20.0f, -21.0f, 3.0f,
1372  7.0f, 16.0f, 30.f, -4.0f,
1373  8.0f, 33.0f, 43.0f, -40.0f);
1374  D3DXMatrixTranspose(&gotmat, &mat);
1375  expect_matrix(&expectedmat, &gotmat, 0);
1376 }
_STLP_DECLSPEC complex< float > _STLP_CALL sqrt(const complex< float > &)
Definition: complex.cpp:188
D3DXMATRIX *WINAPI D3DXMatrixMultiplyTranspose(D3DXMATRIX *pout, const D3DXMATRIX *pm1, const D3DXMATRIX *pm2)
Definition: math.c:416
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint GLint GLint GLenum GLenum GLenum GLint GLuint GLenum GLenum GLfloat GLenum GLfloat GLenum GLint const GLfloat GLenum GLint const GLushort GLint GLint GLsizei GLsizei GLenum GLsizei GLsizei GLenum GLenum const GLvoid GLenum plane
Definition: glfuncs.h:270
D3DXMATRIX *WINAPI D3DXMatrixTranslation(D3DXMATRIX *pout, FLOAT x, FLOAT y, FLOAT z)
Definition: math.c:866
long y
Definition: polytest.cpp:48
long x
Definition: polytest.cpp:48
static void set_matrix(D3DXMATRIX *mat, float m00, float m01, float m02, float m03, float m10, float m11, float m12, float m13, float m20, float m21, float m22, float m23, float m30, float m31, float m32, float m33)
Definition: math.c:196
POINT last
Definition: font.c:46
#define TRUE
Definition: types.h:120
D3DXMATRIX *WINAPI D3DXMatrixMultiply(D3DXMATRIX *pout, const D3DXMATRIX *pm1, const D3DXMATRIX *pm2)
Definition: math.c:397
GLdouble GLdouble GLdouble r
Definition: gl.h:2055
#define U(x)
Definition: wordpad.c:45
#define equal(x, y)
Definition: reader.cc:56
D3DXMATRIX *WINAPI D3DXMatrixOrthoLH(D3DXMATRIX *pout, FLOAT w, FLOAT h, FLOAT zn, FLOAT zf)
Definition: math.c:431
static const MAT2 mat
Definition: font.c:66
static BOOL compare_float(float f, float g, unsigned int ulps)
Definition: math.c:26
GLfloat angle
Definition: glext.h:10853
D3DXMATRIX *WINAPI D3DXMatrixOrthoRH(D3DXMATRIX *pout, FLOAT w, FLOAT h, FLOAT zn, FLOAT zf)
Definition: math.c:471
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum light
Definition: glfuncs.h:170
D3DXMATRIX *WINAPI D3DXMatrixRotationX(D3DXMATRIX *pout, FLOAT angle)
Definition: math.c:643
#define FALSE
Definition: types.h:117
unsigned int BOOL
Definition: ntddk_ex.h:94
D3DXMATRIX *WINAPI D3DXMatrixShadow(D3DXMATRIX *pout, const D3DXVECTOR4 *plight, const D3DXPLANE *pplane)
Definition: math.c:723
D3DXMATRIX *WINAPI D3DXMatrixLookAtLH(D3DXMATRIX *out, const D3DXVECTOR3 *eye, const D3DXVECTOR3 *at, const D3DXVECTOR3 *up)
Definition: math.c:331
D3DXMATRIX *WINAPI D3DXMatrixInverse(D3DXMATRIX *pout, FLOAT *pdeterminant, const D3DXMATRIX *pm)
Definition: math.c:258
D3DXMATRIX *WINAPI D3DXMatrixTranspose(D3DXMATRIX *pout, const D3DXMATRIX *pm)
Definition: math.c:877
D3DXMATRIX *WINAPI D3DXMatrixAffineTransformation(D3DXMATRIX *out, FLOAT scaling, const D3DXVECTOR3 *rotationcenter, const D3DXQUATERNION *rotation, const D3DXVECTOR3 *translation)
Definition: math.c:94
GLfloat f
Definition: glext.h:7540
D3DXMATRIX *WINAPI D3DXMatrixRotationAxis(D3DXMATRIX *out, const D3DXVECTOR3 *v, FLOAT angle)
Definition: math.c:594
D3DXMATRIX *WINAPI D3DXMatrixOrthoOffCenterRH(D3DXMATRIX *pout, FLOAT l, FLOAT r, FLOAT b, FLOAT t, FLOAT zn, FLOAT zf)
Definition: math.c:457
D3DXMATRIX *WINAPI D3DXMatrixRotationYawPitchRoll(D3DXMATRIX *out, FLOAT yaw, FLOAT pitch, FLOAT roll)
Definition: math.c:667
D3DXMATRIX *WINAPI D3DXMatrixPerspectiveFovRH(D3DXMATRIX *pout, FLOAT fovy, FLOAT aspect, FLOAT zn, FLOAT zf)
Definition: math.c:497
GLdouble GLdouble GLdouble GLdouble q
Definition: gl.h:2063
D3DXMATRIX *WINAPI D3DXMatrixOrthoOffCenterLH(D3DXMATRIX *pout, FLOAT l, FLOAT r, FLOAT b, FLOAT t, FLOAT zn, FLOAT zf)
Definition: math.c:443
int ret
#define broken(x)
Definition: _sntprintf.h:21
D3DXMATRIX *WINAPI D3DXMatrixRotationZ(D3DXMATRIX *pout, FLOAT angle)
Definition: math.c:700
D3DXMATRIX *WINAPI D3DXMatrixLookAtRH(D3DXMATRIX *out, const D3DXVECTOR3 *eye, const D3DXVECTOR3 *at, const D3DXVECTOR3 *up)
Definition: math.c:364
D3DXMATRIX *WINAPI D3DXMatrixRotationY(D3DXMATRIX *pout, FLOAT angle)
Definition: math.c:655
D3DXMATRIX *WINAPI D3DXMatrixScaling(D3DXMATRIX *pout, FLOAT sx, FLOAT sy, FLOAT sz)
Definition: math.c:712
#define ok(value,...)
Definition: atltest.h:57
D3DXMATRIX *WINAPI D3DXMatrixPerspectiveLH(D3DXMATRIX *pout, FLOAT w, FLOAT h, FLOAT zn, FLOAT zf)
Definition: math.c:511
#define NULL
Definition: types.h:112
D3DXMATRIX *WINAPI D3DXMatrixPerspectiveRH(D3DXMATRIX *pout, FLOAT w, FLOAT h, FLOAT zn, FLOAT zf)
Definition: math.c:557
D3DXMATRIX *WINAPI D3DXMatrixReflect(D3DXMATRIX *pout, const D3DXPLANE *pplane)
Definition: math.c:571
D3DXMATRIX *WINAPI D3DXMatrixRotationQuaternion(D3DXMATRIX *pout, const D3DXQUATERNION *pq)
Definition: math.c:626
D3DXMATRIX *WINAPI D3DXMatrixTransformation(D3DXMATRIX *out, const D3DXVECTOR3 *scaling_center, const D3DXQUATERNION *scaling_rotation, const D3DXVECTOR3 *scaling, const D3DXVECTOR3 *rotation_center, const D3DXQUATERNION *rotation, const D3DXVECTOR3 *translation)
Definition: math.c:751
#define expect_matrix(expected, matrix, ulps)
Definition: math.c:158
#define D3DX_PI
Definition: d3dx9math.h:27
D3DXMATRIX *WINAPI D3DXMatrixPerspectiveOffCenterLH(D3DXMATRIX *pout, FLOAT l, FLOAT r, FLOAT b, FLOAT t, FLOAT zn, FLOAT zf)
Definition: math.c:525
D3DXMATRIX *WINAPI D3DXMatrixPerspectiveOffCenterRH(D3DXMATRIX *pout, FLOAT l, FLOAT r, FLOAT b, FLOAT t, FLOAT zn, FLOAT zf)
Definition: math.c:541
D3DXMATRIX *WINAPI D3DXMatrixPerspectiveFovLH(D3DXMATRIX *pout, FLOAT fovy, FLOAT aspect, FLOAT zn, FLOAT zf)
Definition: math.c:483
FLOAT WINAPI D3DXMatrixDeterminant(const D3DXMATRIX *pm)
Definition: math.c:236
#define memset(x, y, z)
Definition: compat.h:39
BOOL expected
Definition: store.c:2063

Referenced by START_TEST().

◆ D3DXPlaneTest()

static void D3DXPlaneTest ( void  )
static

Definition at line 1378 of file math.c.

1379 {
1380  D3DXMATRIX mat;
1381  D3DXPLANE expectedplane, gotplane, nulplane, plane;
1382  D3DXVECTOR3 expectedvec, gotvec, vec1, vec2, vec3;
1383  LPD3DXVECTOR3 funcpointer;
1384  D3DXVECTOR4 vec;
1385  FLOAT expected, got;
1386 
1387  U(mat).m[0][1] = 5.0f; U(mat).m[0][2] = 7.0f; U(mat).m[0][3] = 8.0f;
1388  U(mat).m[1][0] = 11.0f; U(mat).m[1][2] = 16.0f; U(mat).m[1][3] = 33.0f;
1389  U(mat).m[2][0] = 19.0f; U(mat).m[2][1] = -21.0f; U(mat).m[2][3] = 43.0f;
1390  U(mat).m[3][0] = 2.0f; U(mat).m[3][1] = 3.0f; U(mat).m[3][2] = -4.0f;
1391  U(mat).m[0][0] = 10.0f; U(mat).m[1][1] = 20.0f; U(mat).m[2][2] = 30.0f;
1392  U(mat).m[3][3] = -40.0f;
1393 
1394  plane.a = -3.0f; plane.b = -1.0f; plane.c = 4.0f; plane.d = 7.0f;
1395 
1396  vec.x = 2.0f; vec.y = 5.0f; vec.z = -6.0f; vec.w = 11.0f;
1397 
1398 /*_______________D3DXPlaneDot________________*/
1399  expected = 42.0f;
1400  got = D3DXPlaneDot(&plane, &vec);
1401  ok( expected == got, "Expected : %f, Got : %f\n",expected, got);
1402  expected = 0.0f;
1403  got = D3DXPlaneDot(NULL, &vec);
1404  ok( expected == got, "Expected : %f, Got : %f\n",expected, got);
1405  expected = 0.0f;
1406  got = D3DXPlaneDot(NULL, NULL);
1407  ok( expected == got, "Expected : %f, Got : %f\n",expected, got);
1408 
1409 /*_______________D3DXPlaneDotCoord________________*/
1410  expected = -28.0f;
1411  got = D3DXPlaneDotCoord(&plane, &vec);
1412  ok( expected == got, "Expected : %f, Got : %f\n",expected, got);
1413  expected = 0.0f;
1414  got = D3DXPlaneDotCoord(NULL, &vec);
1415  ok( expected == got, "Expected : %f, Got : %f\n",expected, got);
1416  expected = 0.0f;
1417  got = D3DXPlaneDotCoord(NULL, NULL);
1418  ok( expected == got, "Expected : %f, Got : %f\n",expected, got);
1419 
1420 /*_______________D3DXPlaneDotNormal______________*/
1421  expected = -35.0f;
1422  got = D3DXPlaneDotNormal(&plane, &vec);
1423  ok( expected == got, "Expected : %f, Got : %f\n",expected, got);
1424  expected = 0.0f;
1425  got = D3DXPlaneDotNormal(NULL, &vec);
1426  ok( expected == got, "Expected : %f, Got : %f\n",expected, got);
1427  expected = 0.0f;
1428  got = D3DXPlaneDotNormal(NULL, NULL);
1429  ok( expected == got, "Expected : %f, Got : %f\n",expected, got);
1430 
1431 /*_______________D3DXPlaneFromPointNormal_______*/
1432  vec1.x = 11.0f; vec1.y = 13.0f; vec1.z = 15.0f;
1433  vec2.x = 17.0f; vec2.y = 31.0f; vec2.z = 24.0f;
1434  expectedplane.a = 17.0f; expectedplane.b = 31.0f; expectedplane.c = 24.0f; expectedplane.d = -950.0f;
1435  D3DXPlaneFromPointNormal(&gotplane, &vec1, &vec2);
1436  expect_plane(&expectedplane, &gotplane, 0);
1437  gotplane.a = vec2.x; gotplane.b = vec2.y; gotplane.c = vec2.z;
1438  D3DXPlaneFromPointNormal(&gotplane, &vec1, (D3DXVECTOR3 *)&gotplane);
1439  expect_plane(&expectedplane, &gotplane, 0);
1440  gotplane.a = vec1.x; gotplane.b = vec1.y; gotplane.c = vec1.z;
1441  expectedplane.d = -1826.0f;
1442  D3DXPlaneFromPointNormal(&gotplane, (D3DXVECTOR3 *)&gotplane, &vec2);
1443  expect_plane(&expectedplane, &gotplane, 0);
1444 
1445 /*_______________D3DXPlaneFromPoints_______*/
1446  vec1.x = 1.0f; vec1.y = 2.0f; vec1.z = 3.0f;
1447  vec2.x = 1.0f; vec2.y = -6.0f; vec2.z = -5.0f;
1448  vec3.x = 83.0f; vec3.y = 74.0f; vec3.z = 65.0f;
1449  expectedplane.a = 0.085914f; expectedplane.b = -0.704492f; expectedplane.c = 0.704492f; expectedplane.d = -0.790406f;
1450  D3DXPlaneFromPoints(&gotplane,&vec1,&vec2,&vec3);
1451  expect_plane(&expectedplane, &gotplane, 64);
1452 
1453 /*_______________D3DXPlaneIntersectLine___________*/
1454  vec1.x = 9.0f; vec1.y = 6.0f; vec1.z = 3.0f;
1455  vec2.x = 2.0f; vec2.y = 5.0f; vec2.z = 8.0f;
1456  expectedvec.x = 20.0f/3.0f; expectedvec.y = 17.0f/3.0f; expectedvec.z = 14.0f/3.0f;
1457  D3DXPlaneIntersectLine(&gotvec,&plane,&vec1,&vec2);
1458  expect_vec3(&expectedvec, &gotvec, 1);
1459  /* Test a parallel line */
1460  vec1.x = 11.0f; vec1.y = 13.0f; vec1.z = 15.0f;
1461  vec2.x = 17.0f; vec2.y = 31.0f; vec2.z = 24.0f;
1462  expectedvec.x = 20.0f/3.0f; expectedvec.y = 17.0f/3.0f; expectedvec.z = 14.0f/3.0f;
1463  funcpointer = D3DXPlaneIntersectLine(&gotvec,&plane,&vec1,&vec2);
1464  ok(funcpointer == NULL, "Expected: %p, Got: %p\n", NULL, funcpointer);
1465 
1466 /*_______________D3DXPlaneNormalize______________*/
1467  expectedplane.a = -3.0f/sqrt(26.0f); expectedplane.b = -1.0f/sqrt(26.0f); expectedplane.c = 4.0f/sqrt(26.0f); expectedplane.d = 7.0/sqrt(26.0f);
1468  D3DXPlaneNormalize(&gotplane, &plane);
1469  expect_plane(&expectedplane, &gotplane, 2);
1470  nulplane.a = 0.0; nulplane.b = 0.0f; nulplane.c = 0.0f; nulplane.d = 0.0f;
1471  expectedplane.a = 0.0f; expectedplane.b = 0.0f; expectedplane.c = 0.0f; expectedplane.d = 0.0f;
1472  D3DXPlaneNormalize(&gotplane, &nulplane);
1473  expect_plane(&expectedplane, &gotplane, 0);
1474 
1475 /*_______________D3DXPlaneTransform____________*/
1476  expectedplane.a = 49.0f; expectedplane.b = -98.0f; expectedplane.c = 55.0f; expectedplane.d = -165.0f;
1477  D3DXPlaneTransform(&gotplane,&plane,&mat);
1478  expect_plane(&expectedplane, &gotplane, 0);
1479 }
_STLP_DECLSPEC complex< float > _STLP_CALL sqrt(const complex< float > &)
Definition: complex.cpp:188
FT_Pos y
Definition: ftimage.h:77
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint GLint GLint GLenum GLenum GLenum GLint GLuint GLenum GLenum GLfloat GLenum GLfloat GLenum GLint const GLfloat GLenum GLint const GLushort GLint GLint GLsizei GLsizei GLenum GLsizei GLsizei GLenum GLenum const GLvoid GLenum plane
Definition: glfuncs.h:270
FT_Pos x
Definition: ftimage.h:76
#define U(x)
Definition: wordpad.c:45
FLOAT d
Definition: d3dx9math.h:221
D3DXVECTOR3 *WINAPI D3DXPlaneIntersectLine(D3DXVECTOR3 *pout, const D3DXPLANE *pp, const D3DXVECTOR3 *pv1, const D3DXVECTOR3 *pv2)
Definition: math.c:1231
static const MAT2 mat
Definition: font.c:66
#define expect_plane(expected, plane, ulps)
Definition: math.c:138
D3DXPLANE *WINAPI D3DXPlaneTransform(D3DXPLANE *pout, const D3DXPLANE *pplane, const D3DXMATRIX *pm)
Definition: math.c:1278
#define expect_vec3(expected, vector, ulps)
Definition: math.c:111
D3DXPLANE *WINAPI D3DXPlaneFromPointNormal(D3DXPLANE *pout, const D3DXVECTOR3 *pvpoint, const D3DXVECTOR3 *pvnormal)
Definition: math.c:1204
GLfloat f
Definition: glext.h:7540
D3DXPLANE *WINAPI D3DXPlaneFromPoints(D3DXPLANE *pout, const D3DXVECTOR3 *pv1, const D3DXVECTOR3 *pv2, const D3DXVECTOR3 *pv3)
Definition: math.c:1215
FT_Vector * vec
Definition: ftbbox.c:448
FLOAT c
Definition: d3dx9math.h:221
FLOAT b
Definition: d3dx9math.h:221
#define ok(value,...)
Definition: atltest.h:57
#define NULL
Definition: types.h:112
float FLOAT
Definition: typedefs.h:69
D3DXPLANE *WINAPI D3DXPlaneNormalize(D3DXPLANE *out, const D3DXPLANE *p)
Definition: math.c:1253
FLOAT a
Definition: d3dx9math.h:221
BOOL expected
Definition: store.c:2063

Referenced by START_TEST().

◆ D3DXQuaternionTest()

static void D3DXQuaternionTest ( void  )
static

Definition at line 1481 of file math.c.

1482 {
1483  D3DXMATRIX mat;
1484  D3DXQUATERNION expectedquat, gotquat, Nq, Nq1, nul, smallq, smallr, q, r, s, t, u;
1485  BOOL expectedbool, gotbool, equal;
1486  float angle, got, scale, scale2;
1487  LPD3DXQUATERNION funcpointer;
1488  D3DXVECTOR3 axis, expectedvec;
1489 
1490  nul.x = 0.0f; nul.y = 0.0f; nul.z = 0.0f; nul.w = 0.0f;
1491  q.x = 1.0f; q.y = 2.0f; q.z = 4.0f; q.w = 10.0f;
1492  r.x = -3.0f; r.y = 4.0f; r.z = -5.0f; r.w = 7.0;
1493  t.x = -1111.0f; t.y = 111.0f; t.z = -11.0f; t.w = 1.0f;
1494  u.x = 91.0f; u.y = - 82.0f; u.z = 7.3f; u.w = -6.4f;
1495  smallq.x = 0.1f; smallq.y = 0.2f; smallq.z= 0.3f; smallq.w = 0.4f;
1496  smallr.x = 0.5f; smallr.y = 0.6f; smallr.z= 0.7f; smallr.w = 0.8f;
1497 
1498  scale = 0.3f;
1499  scale2 = 0.78f;
1500 
1501 /*_______________D3DXQuaternionBaryCentric________________________*/
1502  expectedquat.x = -867.444458; expectedquat.y = 87.851111f; expectedquat.z = -9.937778f; expectedquat.w = 3.235555f;
1503  D3DXQuaternionBaryCentric(&gotquat,&q,&r,&t,scale,scale2);
1504  expect_quaternion(&expectedquat, &gotquat, 1);
1505 
1506 /*_______________D3DXQuaternionConjugate________________*/
1507  expectedquat.x = -1.0f; expectedquat.y = -2.0f; expectedquat.z = -4.0f; expectedquat.w = 10.0f;
1508  D3DXQuaternionConjugate(&gotquat,&q);
1509  expect_quaternion(&expectedquat, &gotquat, 0);
1510  /* Test the NULL case */
1511  funcpointer = D3DXQuaternionConjugate(&gotquat,NULL);
1512  ok(funcpointer == NULL, "Expected: %p, Got: %p\n", NULL, funcpointer);
1513  funcpointer = D3DXQuaternionConjugate(NULL,NULL);
1514  ok(funcpointer == NULL, "Expected: %p, Got: %p\n", NULL, funcpointer);
1515 
1516 /*_______________D3DXQuaternionDot______________________*/
1517  got = D3DXQuaternionDot(&q,&r);
1518  equal = compare_float(got, 55.0f, 0);
1519  ok(equal, "Got unexpected dot %.8e.\n", got);
1520  /* Tests the case NULL */
1521  got = D3DXQuaternionDot(NULL,&r);
1522  equal = compare_float(got, 0.0f, 0);
1523  ok(equal, "Got unexpected dot %.8e.\n", got);
1524  got = D3DXQuaternionDot(NULL,NULL);
1525  equal = compare_float(got, 0.0f, 0);
1526  ok(equal, "Got unexpected dot %.8e.\n", got);
1527 
1528 /*_______________D3DXQuaternionExp______________________________*/
1529  expectedquat.x = -0.216382f; expectedquat.y = -0.432764f; expectedquat.z = -0.8655270f; expectedquat.w = -0.129449f;
1530  D3DXQuaternionExp(&gotquat,&q);
1531  expect_quaternion(&expectedquat, &gotquat, 16);
1532  /* Test the null quaternion */
1533  expectedquat.x = 0.0f; expectedquat.y = 0.0f; expectedquat.z = 0.0f; expectedquat.w = 1.0f;
1534  D3DXQuaternionExp(&gotquat,&nul);
1535  expect_quaternion(&expectedquat, &gotquat, 0);
1536  /* Test the case where the norm of the quaternion is <1 */
1537  Nq1.x = 0.2f; Nq1.y = 0.1f; Nq1.z = 0.3; Nq1.w= 0.9f;
1538  expectedquat.x = 0.195366; expectedquat.y = 0.097683f; expectedquat.z = 0.293049f; expectedquat.w = 0.930813f;
1539  D3DXQuaternionExp(&gotquat,&Nq1);
1540  expect_quaternion(&expectedquat, &gotquat, 8);
1541 
1542 /*_______________D3DXQuaternionIdentity________________*/
1543  expectedquat.x = 0.0f; expectedquat.y = 0.0f; expectedquat.z = 0.0f; expectedquat.w = 1.0f;
1544  D3DXQuaternionIdentity(&gotquat);
1545  expect_quaternion(&expectedquat, &gotquat, 0);
1546  /* Test the NULL case */
1547  funcpointer = D3DXQuaternionIdentity(NULL);
1548  ok(funcpointer == NULL, "Expected: %p, Got: %p\n", NULL, funcpointer);
1549 
1550 /*_______________D3DXQuaternionInverse________________________*/
1551  expectedquat.x = -1.0f/121.0f; expectedquat.y = -2.0f/121.0f; expectedquat.z = -4.0f/121.0f; expectedquat.w = 10.0f/121.0f;
1552  D3DXQuaternionInverse(&gotquat,&q);
1553  expect_quaternion(&expectedquat, &gotquat, 0);
1554 
1555  expectedquat.x = 1.0f; expectedquat.y = 2.0f; expectedquat.z = 4.0f; expectedquat.w = 10.0f;
1556  D3DXQuaternionInverse(&gotquat,&gotquat);
1557  expect_quaternion(&expectedquat, &gotquat, 1);
1558 
1559 
1560 /*_______________D3DXQuaternionIsIdentity________________*/
1561  s.x = 0.0f; s.y = 0.0f; s.z = 0.0f; s.w = 1.0f;
1562  expectedbool = TRUE;
1563  gotbool = D3DXQuaternionIsIdentity(&s);
1564  ok( expectedbool == gotbool, "Expected boolean : %d, Got bool : %d\n", expectedbool, gotbool);
1565  s.x = 2.3f; s.y = -4.2f; s.z = 1.2f; s.w=0.2f;
1566  expectedbool = FALSE;
1567  gotbool = D3DXQuaternionIsIdentity(&q);
1568  ok( expectedbool == gotbool, "Expected boolean : %d, Got bool : %d\n", expectedbool, gotbool);
1569  /* Test the NULL case */
1570  gotbool = D3DXQuaternionIsIdentity(NULL);
1571  ok(gotbool == FALSE, "Expected boolean: %d, Got boolean: %d\n", FALSE, gotbool);
1572 
1573 /*_______________D3DXQuaternionLength__________________________*/
1574  got = D3DXQuaternionLength(&q);
1575  equal = compare_float(got, 11.0f, 0);
1576  ok(equal, "Got unexpected length %.8e.\n", got);
1577  /* Tests the case NULL. */
1578  got = D3DXQuaternionLength(NULL);
1579  equal = compare_float(got, 0.0f, 0);
1580  ok(equal, "Got unexpected length %.8e.\n", got);
1581 
1582 /*_______________D3DXQuaternionLengthSq________________________*/
1583  got = D3DXQuaternionLengthSq(&q);
1584  equal = compare_float(got, 121.0f, 0);
1585  ok(equal, "Got unexpected length %.8e.\n", got);
1586  /* Tests the case NULL */
1587  got = D3DXQuaternionLengthSq(NULL);
1588  equal = compare_float(got, 0.0f, 0);
1589  ok(equal, "Got unexpected length %.8e.\n", got);
1590 
1591 /*_______________D3DXQuaternionLn______________________________*/
1592  expectedquat.x = 1.0f; expectedquat.y = 2.0f; expectedquat.z = 4.0f; expectedquat.w = 0.0f;
1593  D3DXQuaternionLn(&gotquat,&q);
1594  expect_quaternion(&expectedquat, &gotquat, 0);
1595  expectedquat.x = -3.0f; expectedquat.y = 4.0f; expectedquat.z = -5.0f; expectedquat.w = 0.0f;
1596  D3DXQuaternionLn(&gotquat,&r);
1597  expect_quaternion(&expectedquat, &gotquat, 0);
1598  Nq.x = 1.0f/11.0f; Nq.y = 2.0f/11.0f; Nq.z = 4.0f/11.0f; Nq.w=10.0f/11.0f;
1599  expectedquat.x = 0.093768f; expectedquat.y = 0.187536f; expectedquat.z = 0.375073f; expectedquat.w = 0.0f;
1600  D3DXQuaternionLn(&gotquat,&Nq);
1601  expect_quaternion(&expectedquat, &gotquat, 32);
1602  Nq.x = 0.0f; Nq.y = 0.0f; Nq.z = 0.0f; Nq.w = 1.0f;
1603  expectedquat.x = 0.0f; expectedquat.y = 0.0f; expectedquat.z = 0.0f; expectedquat.w = 0.0f;
1604  D3DXQuaternionLn(&gotquat,&Nq);
1605  expect_quaternion(&expectedquat, &gotquat, 0);
1606  Nq.x = 5.4f; Nq.y = 1.2f; Nq.z = -0.3f; Nq.w = -0.3f;
1607  expectedquat.x = 10.616652f; expectedquat.y = 2.359256f; expectedquat.z = -0.589814f; expectedquat.w = 0.0f;
1608  D3DXQuaternionLn(&gotquat,&Nq);
1609  expect_quaternion(&expectedquat, &gotquat, 1);
1610  /* Test the case where the norm of the quaternion is <1 */
1611  Nq1.x = 0.2f; Nq1.y = 0.1f; Nq1.z = 0.3; Nq1.w = 0.9f;
1612  expectedquat.x = 0.206945f; expectedquat.y = 0.103473f; expectedquat.z = 0.310418f; expectedquat.w = 0.0f;
1613  D3DXQuaternionLn(&gotquat,&Nq1);
1614  expect_quaternion(&expectedquat, &gotquat, 64);
1615  /* Test the case where the real part of the quaternion is -1.0f */
1616  Nq1.x = 0.2f; Nq1.y = 0.1f; Nq1.z = 0.3; Nq1.w = -1.0f;
1617  expectedquat.x = 0.2f; expectedquat.y = 0.1f; expectedquat.z = 0.3f; expectedquat.w = 0.0f;
1618  D3DXQuaternionLn(&gotquat,&Nq1);
1619  expect_quaternion(&expectedquat, &gotquat, 0);
1620 
1621 /*_______________D3DXQuaternionMultiply________________________*/
1622  expectedquat.x = 3.0f; expectedquat.y = 61.0f; expectedquat.z = -32.0f; expectedquat.w = 85.0f;
1623  D3DXQuaternionMultiply(&gotquat,&q,&r);
1624  expect_quaternion(&expectedquat, &gotquat, 0);
1625 
1626 /*_______________D3DXQuaternionNormalize________________________*/
1627  expectedquat.x = 1.0f/11.0f; expectedquat.y = 2.0f/11.0f; expectedquat.z = 4.0f/11.0f; expectedquat.w = 10.0f/11.0f;
1628  D3DXQuaternionNormalize(&gotquat,&q);
1629  expect_quaternion(&expectedquat, &gotquat, 1);
1630 
1631 /*_______________D3DXQuaternionRotationAxis___________________*/
1632  axis.x = 2.0f; axis.y = 7.0; axis.z = 13.0f;
1633  angle = D3DX_PI/3.0f;
1634  expectedquat.x = 0.067116; expectedquat.y = 0.234905f; expectedquat.z = 0.436251f; expectedquat.w = 0.866025f;
1635  D3DXQuaternionRotationAxis(&gotquat,&axis,angle);
1636  expect_quaternion(&expectedquat, &gotquat, 64);
1637  /* Test the nul quaternion */
1638  axis.x = 0.0f; axis.y = 0.0; axis.z = 0.0f;
1639  expectedquat.x = 0.0f; expectedquat.y = 0.0f; expectedquat.z = 0.0f; expectedquat.w = 0.866025f;
1640  D3DXQuaternionRotationAxis(&gotquat,&axis,angle);
1641  expect_quaternion(&expectedquat, &gotquat, 8);
1642 
1643 /*_______________D3DXQuaternionRotationMatrix___________________*/
1644  /* test when the trace is >0 */
1645  U(mat).m[0][1] = 5.0f; U(mat).m[0][2] = 7.0f; U(mat).m[0][3] = 8.0f;
1646  U(mat).m[1][0] = 11.0f; U(mat).m[1][2] = 16.0f; U(mat).m[1][3] = 33.0f;
1647  U(mat).m[2][0] = 19.0f; U(mat).m[2][1] = -21.0f; U(mat).m[2][3] = 43.0f;
1648  U(mat).m[3][0] = 2.0f; U(mat).m[3][1] = 3.0f; U(mat).m[3][2] = -4.0f;
1649  U(mat).m[0][0] = 10.0f; U(mat).m[1][1] = 20.0f; U(mat).m[2][2] = 30.0f;
1650  U(mat).m[3][3] = 48.0f;
1651  expectedquat.x = 2.368682f; expectedquat.y = 0.768221f; expectedquat.z = -0.384111f; expectedquat.w = 3.905125f;
1652  D3DXQuaternionRotationMatrix(&gotquat,&mat);
1653  expect_quaternion(&expectedquat, &gotquat, 16);
1654  /* test the case when the greater element is (2,2) */
1655  U(mat).m[0][1] = 5.0f; U(mat).m[0][2] = 7.0f; U(mat).m[0][3] = 8.0f;
1656  U(mat).m[1][0] = 11.0f; U(mat).m[1][2] = 16.0f; U(mat).m[1][3] = 33.0f;
1657  U(mat).m[2][0] = 19.0f; U(mat).m[2][1] = -21.0f; U(mat).m[2][3] = 43.0f;
1658  U(mat).m[3][0] = 2.0f; U(mat).m[3][1] = 3.0f; U(mat).m[3][2] = -4.0f;
1659  U(mat).m[0][0] = -10.0f; U(mat).m[1][1] = -60.0f; U(mat).m[2][2] = 40.0f;
1660  U(mat).m[3][3] = 48.0f;
1661  expectedquat.x = 1.233905f; expectedquat.y = -0.237290f; expectedquat.z = 5.267827f; expectedquat.w = -0.284747f;
1662  D3DXQuaternionRotationMatrix(&gotquat,&mat);
1663  expect_quaternion(&expectedquat, &gotquat, 64);
1664  /* test the case when the greater element is (1,1) */
1665  U(mat).m[0][1] = 5.0f; U(mat).m[0][2] = 7.0f; U(mat).m[0][3] = 8.0f;
1666  U(mat).m[1][0] = 11.0f; U(mat).m[1][2] = 16.0f; U(mat).m[1][3] = 33.0f;
1667  U(mat).m[2][0] = 19.0f; U(mat).m[2][1] = -21.0f; U(mat).m[2][3] = 43.0f;
1668  U(mat).m[3][0] = 2.0f; U(mat).m[3][1] = 3.0f; U(mat).m[3][2] = -4.0f;
1669  U(mat).m[0][0] = -10.0f; U(mat).m[1][1] = 60.0f; U(mat).m[2][2] = -80.0f;
1670  U(mat).m[3][3] = 48.0f;
1671  expectedquat.x = 0.651031f; expectedquat.y = 6.144103f; expectedquat.z = -0.203447f; expectedquat.w = 0.488273f;
1672  D3DXQuaternionRotationMatrix(&gotquat,&mat);
1673  expect_quaternion(&expectedquat, &gotquat, 8);
1674  /* test the case when the trace is near 0 in a matrix which is not a rotation */
1675  U(mat).m[0][1] = 5.0f; U(mat).m[0][2] = 7.0f; U(mat).m[0][3] = 8.0f;
1676  U(mat).m[1][0] = 11.0f; U(mat).m[1][2] = 16.0f; U(mat).m[1][3] = 33.0f;
1677  U(mat).m[2][0] = 19.0f; U(mat).m[2][1] = -21.0f; U(mat).m[2][3] = 43.0f;
1678  U(mat).m[3][0] = 2.0f; U(mat).m[3][1] = 3.0f; U(mat).m[3][2] = -4.0f;
1679  U(mat).m[0][0] = -10.0f; U(mat).m[1][1] = 10.0f; U(mat).m[2][2] = -0.9f;
1680  U(mat).m[3][3] = 48.0f;
1681  expectedquat.x = 1.709495f; expectedquat.y = 2.339872f; expectedquat.z = -0.534217f; expectedquat.w = 1.282122f;
1682  D3DXQuaternionRotationMatrix(&gotquat,&mat);
1683  expect_quaternion(&expectedquat, &gotquat, 8);
1684  /* test the case when the trace is 0.49 in a matrix which is not a rotation */
1685  U(mat).m[0][1] = 5.0f; U(mat).m[0][2] = 7.0f; U(mat).m[0][3] = 8.0f;
1686  U(mat).m[1][0] = 11.0f; U(mat).m[1][2] = 16.0f; U(mat).m[1][3] = 33.0f;
1687  U(mat).m[2][0] = 19.0f; U(mat).m[2][1] = -21.0f; U(mat).m[2][3] = 43.0f;
1688  U(mat).m[3][0] = 2.0f; U(mat).m[3][1] = 3.0f; U(mat).m[3][2] = -4.0f;
1689  U(mat).m[0][0] = -10.0f; U(mat).m[1][1] = 10.0f; U(mat).m[2][2] = -0.51f;
1690  U(mat).m[3][3] = 48.0f;
1691  expectedquat.x = 1.724923f; expectedquat.y = 2.318944f; expectedquat.z = -0.539039f; expectedquat.w = 1.293692f;
1692  D3DXQuaternionRotationMatrix(&gotquat,&mat);
1693  expect_quaternion(&expectedquat, &gotquat, 8);
1694  /* test the case when the trace is 0.51 in a matrix which is not a rotation */
1695  U(mat).m[0][1] = 5.0f; U(mat).m[0][2] = 7.0f; U(mat).m[0][3] = 8.0f;
1696  U(mat).m[1][0] = 11.0f; U(mat).m[1][2] = 16.0f; U(mat).m[1][3] = 33.0f;
1697  U(mat).m[2][0] = 19.0f; U(mat).m[2][1] = -21.0f; U(mat).m[2][3] = 43.0f;
1698  U(mat).m[3][0] = 2.0f; U(mat).m[3][1] = 3.0f; U(mat).m[3][2] = -4.0f;
1699  U(mat).m[0][0] = -10.0f; U(mat).m[1][1] = 10.0f; U(mat).m[2][2] = -0.49f;
1700  U(mat).m[3][3] = 48.0f;
1701  expectedquat.x = 1.725726f; expectedquat.y = 2.317865f; expectedquat.z = -0.539289f; expectedquat.w = 1.294294f;
1702  D3DXQuaternionRotationMatrix(&gotquat,&mat);
1703  expect_quaternion(&expectedquat, &gotquat, 8);
1704  /* test the case when the trace is 0.99 in a matrix which is not a rotation */
1705  U(mat).m[0][1] = 5.0f; U(mat).m[0][2] = 7.0f; U(mat).m[0][3] = 8.0f;
1706  U(mat).m[1][0] = 11.0f; U(mat).m[1][2] = 16.0f; U(mat).m[1][3] = 33.0f;
1707  U(mat).m[2][0] = 19.0f; U(mat).m[2][1] = -21.0f; U(mat).m[2][3] = 43.0f;
1708  U(mat).m[3][0] = 2.0f; U(mat).m[3][1] = 3.0f; U(mat).m[3][2] = -4.0f;
1709  U(mat).m[0][0] = -10.0f; U(mat).m[1][1] = 10.0f; U(mat).m[2][2] = -0.01f;
1710  U(mat).m[3][3] = 48.0f;
1711  expectedquat.x = 1.745328f; expectedquat.y = 2.291833f; expectedquat.z = -0.545415f; expectedquat.w = 1.308996f;
1712  D3DXQuaternionRotationMatrix(&gotquat,&mat);
1713  expect_quaternion(&expectedquat, &gotquat, 4);
1714  /* test the case when the trace is 1.0 in a matrix which is not a rotation */
1715  U(mat).m[0][1] = 5.0f; U(mat).m[0][2] = 7.0f; U(mat).m[0][3] = 8.0f;
1716  U(mat).m[1][0] = 11.0f; U(mat).m[1][2] = 16.0f; U(mat).m[1][3] = 33.0f;
1717  U(mat).m[2][0] = 19.0f; U(mat).m[2][1] = -21.0f; U(mat).m[2][3] = 43.0f;
1718  U(mat).m[3][0] = 2.0f; U(mat).m[3][1] = 3.0f; U(mat).m[3][2] = -4.0f;
1719  U(mat).m[0][0] = -10.0f; U(mat).m[1][1] = 10.0f; U(mat).m[2][2] = 0.0f;
1720  U(mat).m[3][3] = 48.0f;
1721  expectedquat.x = 1.745743f; expectedquat.y = 2.291288f; expectedquat.z = -0.545545f; expectedquat.w = 1.309307f;
1722  D3DXQuaternionRotationMatrix(&gotquat,&mat);
1723  expect_quaternion(&expectedquat, &gotquat, 8);
1724  /* test the case when the trace is 1.01 in a matrix which is not a rotation */
1725  U(mat).m[0][1] = 5.0f; U(mat).m[0][2] = 7.0f; U(mat).m[0][3] = 8.0f;
1726  U(mat).m[1][0] = 11.0f; U(mat).m[1][2] = 16.0f; U(mat).m[1][3] = 33.0f;
1727  U(mat).m[2][0] = 19.0f; U(mat).m[2][1] = -21.0f; U(mat).m[2][3] = 43.0f;
1728  U(mat).m[3][0] = 2.0f; U(mat).m[3][1] = 3.0f; U(mat).m[3][2] = -4.0f;
1729  U(mat).m[0][0] = -10.0f; U(mat).m[1][1] = 10.0f; U(mat).m[2][2] = 0.01f;
1730  U(mat).m[3][3] = 48.0f;
1731  expectedquat.x = 18.408188f; expectedquat.y = 5.970223f; expectedquat.z = -2.985111f; expectedquat.w = 0.502494f;
1732  D3DXQuaternionRotationMatrix(&gotquat,&mat);
1733  expect_quaternion(&expectedquat, &gotquat, 4);
1734  /* test the case when the trace is 1.5 in a matrix which is not a rotation */
1735  U(mat).m[0][1] = 5.0f; U(mat).m[0][2] = 7.0f; U(mat).m[0][3] = 8.0f;
1736  U(mat).m[1][0] = 11.0f; U(mat).m[1][2] = 16.0f; U(mat).m[1][3] = 33.0f;
1737  U(mat).m[2][0] = 19.0f; U(mat).m[2][1] = -21.0f; U(mat).m[2][3] = 43.0f;
1738  U(mat).m[3][0] = 2.0f; U(mat).m[3][1] = 3.0f; U(mat).m[3][2] = -4.0f;
1739  U(mat).m[0][0] = -10.0f; U(mat).m[1][1] = 10.0f; U(mat).m[2][2] = 0.5f;
1740  U(mat).m[3][3] = 48.0f;
1741  expectedquat.x = 15.105186f; expectedquat.y = 4.898980f; expectedquat.z = -2.449490f; expectedquat.w = 0.612372f;
1742  D3DXQuaternionRotationMatrix(&gotquat,&mat);
1743  expect_quaternion(&expectedquat, &gotquat, 8);
1744  /* test the case when the trace is 1.7 in a matrix which is not a rotation */
1745  U(mat).m[0][1] = 5.0f; U(mat).m[0][2] = 7.0f; U(mat).m[0][3] = 8.0f;
1746  U(mat).m[1][0] = 11.0f; U(mat).m[1][2] = 16.0f; U(mat).m[1][3] = 33.0f;
1747  U(mat).m[2][0] = 19.0f; U(mat).m[2][1] = -21.0f; U(mat).m[2][3] = 43.0f;
1748  U(mat).m[3][0] = 2.0f; U(mat).m[3][1] = 3.0f; U(mat).m[3][2] = -4.0f;
1749  U(mat).m[0][0] = -10.0f; U(mat).m[1][1] = 10.0f; U(mat).m[2][2] = 0.70f;
1750  U(mat).m[3][3] = 48.0f;
1751  expectedquat.x = 14.188852f; expectedquat.y = 4.601790f; expectedquat.z = -2.300895f; expectedquat.w = 0.651920f;
1752  D3DXQuaternionRotationMatrix(&gotquat,&mat);
1753  expect_quaternion(&expectedquat, &gotquat, 4);
1754  /* test the case when the trace is 1.99 in a matrix which is not a rotation */
1755  U(mat).m[0][1] = 5.0f; U(mat).m[0][2] = 7.0f; U(mat).m[0][3] = 8.0f;
1756  U(mat).m[1][0] = 11.0f; U(mat).m[1][2] = 16.0f; U(mat).m[1][3] = 33.0f;
1757  U(mat).m[2][0] = 19.0f; U(mat).m[2][1] = -21.0f; U(mat).m[2][3] = 43.0f;
1758  U(mat).m[3][0] = 2.0f; U(mat).m[3][1] = 3.0f; U(mat).m[3][2] = -4.0f;
1759  U(mat).m[0][0] = -10.0f; U(mat).m[1][1] = 10.0f; U(mat).m[2][2] = 0.99f;
1760  U(mat).m[3][3] = 48.0f;
1761  expectedquat.x = 13.114303f; expectedquat.y = 4.253287f; expectedquat.z = -2.126644f; expectedquat.w = 0.705337f;
1762  D3DXQuaternionRotationMatrix(&gotquat,&mat);
1763  expect_quaternion(&expectedquat, &gotquat, 4);
1764  /* test the case when the trace is 2.0 in a matrix which is not a rotation */
1765  U(mat).m[0][1] = 5.0f; U(mat).m[0][2] = 7.0f; U(mat).m[0][3] = 8.0f;
1766  U(mat).m[1][0] = 11.0f; U(mat).m[1][2] = 16.0f; U(mat).m[1][3] = 33.0f;
1767  U(mat).m[2][0] = 19.0f; U(mat).m[2][1] = -21.0f; U(mat).m[2][3] = 43.0f;
1768  U(mat).m[3][0] = 2.0f; U(mat).m[3][1] = 3.0f; U(mat).m[3][2] = -4.0f;
1769  U(mat).m[0][0] = -10.0f; U(mat).m[1][1] = 10.0f; U(mat).m[2][2] = 2.0f;
1770  U(mat).m[3][3] = 48.0f;
1771  expectedquat.x = 10.680980f; expectedquat.y = 3.464102f; expectedquat.z = -1.732051f; expectedquat.w = 0.866025f;
1772  D3DXQuaternionRotationMatrix(&gotquat,&mat);
1773  expect_quaternion(&expectedquat, &gotquat, 8);
1774 
1775 /*_______________D3DXQuaternionRotationYawPitchRoll__________*/
1776  expectedquat.x = 0.303261f; expectedquat.y = 0.262299f; expectedquat.z = 0.410073f; expectedquat.w = 0.819190f;
1778  expect_quaternion(&expectedquat, &gotquat, 16);
1779 
1780 /*_______________D3DXQuaternionSlerp________________________*/
1781  expectedquat.x = -0.2f; expectedquat.y = 2.6f; expectedquat.z = 1.3f; expectedquat.w = 9.1f;
1782  D3DXQuaternionSlerp(&gotquat,&q,&r,scale);
1783  expect_quaternion(&expectedquat, &gotquat, 4);
1784  expectedquat.x = 334.0f; expectedquat.y = -31.9f; expectedquat.z = 6.1f; expectedquat.w = 6.7f;
1785  D3DXQuaternionSlerp(&gotquat,&q,&t,scale);
1786  expect_quaternion(&expectedquat, &gotquat, 2);
1787  expectedquat.x = 0.239485f; expectedquat.y = 0.346580f; expectedquat.z = 0.453676f; expectedquat.w = 0.560772f;
1788  D3DXQuaternionSlerp(&gotquat,&smallq,&smallr,scale);
1789  expect_quaternion(&expectedquat, &gotquat, 32);
1790 
1791 /*_______________D3DXQuaternionSquad________________________*/
1792  expectedquat.x = -156.296f; expectedquat.y = 30.242f; expectedquat.z = -2.5022f; expectedquat.w = 7.3576f;
1793  D3DXQuaternionSquad(&gotquat,&q,&r,&t,&u,scale);
1794  expect_quaternion(&expectedquat, &gotquat, 2);
1795 
1796 /*_______________D3DXQuaternionSquadSetup___________________*/
1797  r.x = 1.0f; r.y = 2.0f; r.z = 4.0f; r.w = 10.0f;
1798  s.x = -3.0f; s.y = 4.0f; s.z = -5.0f; s.w = 7.0;
1799  t.x = -1111.0f; t.y = 111.0f; t.z = -11.0f; t.w = 1.0f;
1800  u.x = 91.0f; u.y = - 82.0f; u.z = 7.3f; u.w = -6.4f;
1801  D3DXQuaternionSquadSetup(&gotquat, &Nq, &Nq1, &r, &s, &t, &u);
1802  expectedquat.x = 7.121285f; expectedquat.y = 2.159964f; expectedquat.z = -3.855094f; expectedquat.w = 5.362844f;
1803  expect_quaternion(&expectedquat, &gotquat, 2);
1804  expectedquat.x = -1113.492920f; expectedquat.y = 82.679260f; expectedquat.z = -6.696645f; expectedquat.w = -4.090050f;
1805  expect_quaternion(&expectedquat, &Nq, 4);
1806  expectedquat.x = -1111.0f; expectedquat.y = 111.0f; expectedquat.z = -11.0f; expectedquat.w = 1.0f;
1807  expect_quaternion(&expectedquat, &Nq1, 0);
1808  gotquat = s;
1809  D3DXQuaternionSquadSetup(&gotquat, &Nq, &Nq1, &r, &gotquat, &t, &u);
1810  expectedquat.x = -1113.492920f; expectedquat.y = 82.679260f; expectedquat.z = -6.696645f; expectedquat.w = -4.090050f;
1811  expect_quaternion(&expectedquat, &Nq, 4);
1812  Nq1 = u;
1813  D3DXQuaternionSquadSetup(&gotquat, &Nq, &Nq1, &r, &s, &t, &Nq1);
1814  expect_quaternion(&expectedquat, &Nq, 4);
1815  r.x = 0.2f; r.y = 0.3f; r.z = 1.3f; r.w = -0.6f;
1816  s.x = -3.0f; s.y =-2.0f; s.z = 4.0f; s.w = 0.2f;
1817  t.x = 0.4f; t.y = 8.3f; t.z = -3.1f; t.w = -2.7f;
1818  u.x = 1.1f; u.y = -0.7f; u.z = 9.2f; u.w = 0.0f;
1819  D3DXQuaternionSquadSetup(&gotquat, &Nq, &Nq1, &r, &s, &u, &t);
1820  expectedquat.x = -4.139569f; expectedquat.y = -2.469115f; expectedquat.z = 2.364477f; expectedquat.w = 0.465494f;
1821  expect_quaternion(&expectedquat, &gotquat, 16);
1822  expectedquat.x = 2.342533f; expectedquat.y = 2.365127f; expectedquat.z = 8.628538f; expectedquat.w = -0.898356f;
1823  expect_quaternion(&expectedquat, &Nq, 16);
1824  expectedquat.x = 1.1f; expectedquat.y = -0.7f; expectedquat.z = 9.2f; expectedquat.w = 0.0f;
1825  expect_quaternion(&expectedquat, &Nq1, 0);
1826  D3DXQuaternionSquadSetup(&gotquat, &Nq, &Nq1, &r, &s, &t, &u);
1827  expectedquat.x = -3.754567f; expectedquat.y = -0.586085f; expectedquat.z = 3.815818f; expectedquat.w = -0.198150f;
1828  expect_quaternion(&expectedquat, &gotquat, 32);
1829  expectedquat.x = 0.140773f; expectedquat.y = -8.737090f; expectedquat.z = -0.516593f; expectedquat.w = 3.053942f;
1830  expect_quaternion(&expectedquat, &Nq, 16);
1831  expectedquat.x = -0.4f; expectedquat.y = -8.3f; expectedquat.z = 3.1f; expectedquat.w = 2.7f;
1832  expect_quaternion(&expectedquat, &Nq1, 0);
1833  r.x = -1.0f; r.y = 0.0f; r.z = 0.0f; r.w = 0.0f;
1834  s.x = 1.0f; s.y =0.0f; s.z = 0.0f; s.w = 0.0f;
1835  t.x = 1.0f; t.y = 0.0f; t.z = 0.0f; t.w = 0.0f;
1836  u.x = -1.0f; u.y = 0.0f; u.z = 0.0f; u.w = 0.0f;
1837  D3DXQuaternionSquadSetup(&gotquat, &Nq, &Nq1, &r, &s, &t, &u);
1838  expectedquat.x = 1.0f; expectedquat.y = 0.0f; expectedquat.z = 0.0f; expectedquat.w = 0.0f;
1839  expect_quaternion(&expectedquat, &gotquat, 0);
1840  expectedquat.x = 1.0f; expectedquat.y = 0.0f; expectedquat.z = 0.0f; expectedquat.w = 0.0f;
1841  expect_quaternion(&expectedquat, &Nq, 0);
1842  expectedquat.x = 1.0f; expectedquat.y = 0.0f; expectedquat.z = 0.0f; expectedquat.w = 0.0f;
1843  expect_quaternion(&expectedquat, &Nq1, 0);
1844 
1845 /*_______________D3DXQuaternionToAxisAngle__________________*/
1846  Nq.x = 1.0f/22.0f; Nq.y = 2.0f/22.0f; Nq.z = 4.0f/22.0f; Nq.w = 10.0f/22.0f;
1847  expectedvec.x = 1.0f/22.0f; expectedvec.y = 2.0f/22.0f; expectedvec.z = 4.0f/22.0f;
1848  D3DXQuaternionToAxisAngle(&Nq,&axis,&angle);
1849  expect_vec3(&expectedvec, &axis, 0);
1850  equal = compare_float(angle, 2.197869f, 1);
1851  ok(equal, "Got unexpected angle %.8e.\n", angle);
1852  /* Test if |w|>1.0f */
1853  expectedvec.x = 1.0f; expectedvec.y = 2.0f; expectedvec.z = 4.0f;
1855  expect_vec3(&expectedvec, &axis, 0);
1856  /* Test the null quaternion */
1857  expectedvec.x = 0.0f; expectedvec.y = 0.0f; expectedvec.z = 0.0f;
1858  D3DXQuaternionToAxisAngle(&nul, &axis, &angle);
1859  expect_vec3(&expectedvec, &axis, 0);
1860  equal = compare_float(angle, 3.14159274e+00f, 0);
1861  ok(equal, "Got unexpected angle %.8e.\n", angle);
1862 
1863  D3DXQuaternionToAxisAngle(&nul, &axis, NULL);
1865  expect_vec3(&expectedvec, &axis, 0);
1866  equal = compare_float(angle, 3.14159274e+00f, 0);
1867  ok(equal, "Got unexpected angle %.8e.\n", angle);
1868 }
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble * u
Definition: glfuncs.h:240
D3DXQUATERNION *WINAPI D3DXQuaternionBaryCentric(D3DXQUATERNION *pout, const D3DXQUATERNION *pq1, const D3DXQUATERNION *pq2, const D3DXQUATERNION *pq3, FLOAT f, FLOAT g)
Definition: math.c:1308
#define expect_quaternion(expected, quaternion, ulps)
Definition: math.c:147
#define TRUE
Definition: types.h:120
D3DXQUATERNION *WINAPI D3DXQuaternionSquad(D3DXQUATERNION *pout, const D3DXQUATERNION *pq1, const D3DXQUATERNION *pq2, const D3DXQUATERNION *pq3, const D3DXQUATERNION *pq4, FLOAT t)
Definition: math.c:1531
GLdouble GLdouble GLdouble r
Definition: gl.h:2055
GLenum GLenum GLenum GLenum GLenum scale
Definition: glext.h:9032
#define U(x)
Definition: wordpad.c:45
#define equal(x, y)
Definition: reader.cc:56
GLdouble GLdouble t
Definition: gl.h:2047
static const MAT2 mat
Definition: font.c:66
static BOOL compare_float(float f, float g, unsigned int ulps)
Definition: math.c:26
GLfloat angle
Definition: glext.h:10853
D3DXQUATERNION *WINAPI D3DXQuaternionRotationAxis(D3DXQUATERNION *out, const D3DXVECTOR3 *v, FLOAT angle)
Definition: math.c:1407
#define FALSE
Definition: types.h:117
unsigned int BOOL
Definition: ntddk_ex.h:94
#define e
Definition: ke_i.h:82
#define expect_vec3(expected, vector, ulps)
Definition: math.c:111
GLfloat f
Definition: glext.h:7540
D3DXQUATERNION *WINAPI D3DXQuaternionInverse(D3DXQUATERNION *pout, const D3DXQUATERNION *pq)
Definition: math.c:1343
D3DXQUATERNION *WINAPI D3DXQuaternionRotationMatrix(D3DXQUATERNION *out, const D3DXMATRIX *m)
Definition: math.c:1423
D3DXQUATERNION *WINAPI D3DXQuaternionLn(D3DXQUATERNION *out, const D3DXQUATERNION *q)
Definition: math.c:1358
GLdouble GLdouble GLdouble GLdouble q
Definition: gl.h:2063
D3DXQUATERNION *WINAPI D3DXQuaternionNormalize(D3DXQUATERNION *out, const D3DXQUATERNION *q)
Definition: math.c:1391
GLdouble s
Definition: gl.h:2039
void WINAPI D3DXQuaternionToAxisAngle(const D3DXQUATERNION *pq, D3DXVECTOR3 *paxis, FLOAT *pangle)
Definition: math.c:1609
D3DXQUATERNION *WINAPI D3DXQuaternionSlerp(D3DXQUATERNION *out, const D3DXQUATERNION *q1, const D3DXQUATERNION *q2, FLOAT t)
Definition: math.c:1500
D3DXQUATERNION *WINAPI D3DXQuaternionMultiply(D3DXQUATERNION *pout, const D3DXQUATERNION *pq1, const D3DXQUATERNION *pq2)
Definition: math.c:1377
#define ok(value,...)
Definition: atltest.h:57
#define NULL
Definition: types.h:112
void WINAPI D3DXQuaternionSquadSetup(D3DXQUATERNION *paout, D3DXQUATERNION *pbout, D3DXQUATERNION *pcout, const D3DXQUATERNION *pq0, const D3DXQUATERNION *pq1, const D3DXQUATERNION *pq2, const D3DXQUATERNION *pq3)
Definition: math.c:1553
#define D3DX_PI
Definition: d3dx9math.h:27
D3DXQUATERNION *WINAPI D3DXQuaternionRotationYawPitchRoll(D3DXQUATERNION *out, FLOAT yaw, FLOAT pitch, FLOAT roll)
Definition: math.c:1479
D3DXQUATERNION *WINAPI D3DXQuaternionExp(D3DXQUATERNION *out, const D3DXQUATERNION *q)
Definition: math.c:1318

Referenced by START_TEST().

◆ D3DXVector2Test()

static void D3DXVector2Test ( void  )
static

Definition at line 1870 of file math.c.

1871 {
1872  D3DXVECTOR2 expectedvec, gotvec, nul, u, v, w, x;
1873  LPD3DXVECTOR2 funcpointer;
1874  D3DXVECTOR4 expectedtrans, gottrans;
1875  float coeff1, coeff2, got, scale;
1876  D3DXMATRIX mat;
1877  BOOL equal;
1878 
1879  nul.x = 0.0f; nul.y = 0.0f;
1880  u.x = 3.0f; u.y = 4.0f;
1881  v.x = -7.0f; v.y = 9.0f;
1882  w.x = 4.0f; w.y = -3.0f;
1883  x.x = 2.0f; x.y = -11.0f;
1884 
1885  set_matrix(&mat,
1886  1.0f, 2.0f, 3.0f, 4.0f,
1887  5.0f, 6.0f, 7.0f, 8.0f,
1888  9.0f, 10.0f, 11.0f, 12.0f,
1889  13.0f, 14.0f, 15.0f, 16.0f);
1890 
1891  coeff1 = 2.0f; coeff2 = 5.0f;
1892  scale = -6.5f;
1893 
1894 /*_______________D3DXVec2Add__________________________*/
1895  expectedvec.x = -4.0f; expectedvec.y = 13.0f;
1896  D3DXVec2Add(&gotvec,&u,&v);
1897  expect_vec2(&expectedvec, &gotvec, 0);
1898  /* Tests the case NULL */
1899  funcpointer = D3DXVec2Add(&gotvec,NULL,&v);
1900  ok(funcpointer == NULL, "Expected: %p, Got: %p\n", NULL, funcpointer);
1901  funcpointer = D3DXVec2Add(NULL,NULL,NULL);
1902  ok(funcpointer == NULL, "Expected: %p, Got: %p\n", NULL, funcpointer);
1903 
1904 /*_______________D3DXVec2BaryCentric___________________*/
1905  expectedvec.x = -12.0f; expectedvec.y = -21.0f;
1906  D3DXVec2BaryCentric(&gotvec,&u,&v,&w,coeff1,coeff2);
1907  expect_vec2(&expectedvec, &gotvec, 0);
1908 
1909 /*_______________D3DXVec2CatmullRom____________________*/
1910  expectedvec.x = 5820.25f; expectedvec.y = -3654.5625f;
1911  D3DXVec2CatmullRom(&gotvec,&u,&v,&w,&x,scale);
1912  expect_vec2(&expectedvec, &gotvec, 0);
1913 
1914 /*_______________D3DXVec2CCW__________________________*/
1915  got = D3DXVec2CCW(&u, &v);
1916  equal = compare_float(got, 55.0f, 0);
1917  ok(equal, "Got unexpected ccw %.8e.\n", got);
1918  /* Tests the case NULL. */
1919  got = D3DXVec2CCW(NULL, &v);
1920  equal = compare_float(got, 0.0f, 0);
1921  ok(equal, "Got unexpected ccw %.8e.\n", got);
1922  got = D3DXVec2CCW(NULL, NULL);
1923  equal = compare_float(got, 0.0f, 0);
1924  ok(equal, "Got unexpected ccw %.8e.\n", got);
1925 
1926 /*_______________D3DXVec2Dot__________________________*/
1927  got = D3DXVec2Dot(&u, &v);
1928  equal = compare_float(got, 15.0f, 0);
1929  ok(equal, "Got unexpected dot %.8e.\n", got);
1930  /* Tests the case NULL */
1931  got = D3DXVec2Dot(NULL, &v);
1932  equal = compare_float(got, 0.0f, 0);
1933  ok(equal, "Got unexpected dot %.8e.\n", got);
1934  got = D3DXVec2Dot(NULL, NULL);
1935  equal = compare_float(got, 0.0f, 0);
1936  ok(equal, "Got unexpected dot %.8e.\n", got);
1937 
1938 /*_______________D3DXVec2Hermite__________________________*/
1939  expectedvec.x = 2604.625f; expectedvec.y = -4533.0f;
1940  D3DXVec2Hermite(&gotvec,&u,&v,&w,&x,scale);
1941  expect_vec2(&expectedvec, &gotvec, 0);
1942 
1943 /*_______________D3DXVec2Length__________________________*/
1944  got = D3DXVec2Length(&u);
1945  equal = compare_float(got, 5.0f, 0);
1946  ok(equal, "Got unexpected length %.8e.\n", got);
1947  /* Tests the case NULL. */
1948  got = D3DXVec2Length(NULL);
1949  equal = compare_float(got, 0.0f, 0);
1950  ok(equal, "Got unexpected length %.8e.\n", got);
1951 
1952 /*_______________D3DXVec2LengthSq________________________*/
1953  got = D3DXVec2LengthSq(&u);
1954  equal = compare_float(got, 25.0f, 0);
1955  ok(equal, "Got unexpected length %.8e.\n", got);
1956  /* Tests the case NULL. */
1957  got = D3DXVec2LengthSq(NULL);
1958  equal = compare_float(got, 0.0f, 0);
1959  ok(equal, "Got unexpected length %.8e.\n", got);
1960 
1961 /*_______________D3DXVec2Lerp__________________________*/
1962  expectedvec.x = 68.0f; expectedvec.y = -28.5f;
1963  D3DXVec2Lerp(&gotvec, &u, &v, scale);
1964  expect_vec2(&expectedvec, &gotvec, 0);
1965  /* Tests the case NULL. */
1966  funcpointer = D3DXVec2Lerp(&gotvec,NULL,&v,scale);
1967  ok(funcpointer == NULL, "Expected: %p, Got: %p\n", NULL, funcpointer);
1968  funcpointer = D3DXVec2Lerp(NULL,NULL,NULL,scale);
1969  ok(funcpointer == NULL, "Expected: %p, Got: %p\n", NULL, funcpointer);
1970 
1971 /*_______________D3DXVec2Maximize__________________________*/
1972  expectedvec.x = 3.0f; expectedvec.y = 9.0f;
1973  D3DXVec2Maximize(&gotvec, &u, &v);
1974  expect_vec2(&expectedvec, &gotvec, 0);
1975  /* Tests the case NULL. */
1976  funcpointer = D3DXVec2Maximize(&gotvec,NULL,&v);
1977  ok(funcpointer == NULL, "Expected: %p, Got: %p\n", NULL, funcpointer);
1978  funcpointer = D3DXVec2Maximize(NULL,NULL,NULL);
1979  ok(funcpointer == NULL, "Expected: %p, Got: %p\n", NULL, funcpointer);
1980 
1981 /*_______________D3DXVec2Minimize__________________________*/
1982  expectedvec.x = -7.0f; expectedvec.y = 4.0f;
1983  D3DXVec2Minimize(&gotvec,&u,&v);
1984  expect_vec2(&expectedvec, &gotvec, 0);
1985  /* Tests the case NULL */
1986  funcpointer = D3DXVec2Minimize(&gotvec,NULL,&v);
1987  ok(funcpointer == NULL, "Expected: %p, Got: %p\n", NULL, funcpointer);
1988  funcpointer = D3DXVec2Minimize(NULL,NULL,NULL);
1989  ok(funcpointer == NULL, "Expected: %p, Got: %p\n", NULL, funcpointer);
1990 
1991 /*_______________D3DXVec2Normalize_________________________*/
1992  expectedvec.x = 0.6f; expectedvec.y = 0.8f;
1993  D3DXVec2Normalize(&gotvec,&u);
1994  expect_vec2(&expectedvec, &gotvec, 0);
1995  /* Test the nul vector */
1996  expectedvec.x = 0.0f; expectedvec.y = 0.0f;
1997  D3DXVec2Normalize(&gotvec,&nul);
1998  expect_vec2(&expectedvec, &gotvec, 0);
1999 
2000 /*_______________D3DXVec2Scale____________________________*/
2001  expectedvec.x = -19.5f; expectedvec.y = -26.0f;
2002  D3DXVec2Scale(&gotvec,&u,scale);
2003  expect_vec2(&expectedvec, &gotvec, 0);
2004  /* Tests the case NULL */
2005  funcpointer = D3DXVec2Scale(&gotvec,NULL,scale);
2006  ok(funcpointer == NULL, "Expected: %p, Got: %p\n", NULL, funcpointer);
2007  funcpointer = D3DXVec2Scale(NULL,NULL,scale);
2008  ok(funcpointer == NULL, "Expected: %p, Got: %p\n", NULL, funcpointer);
2009 
2010 /*_______________D3DXVec2Subtract__________________________*/
2011  expectedvec.x = 10.0f; expectedvec.y = -5.0f;
2012  D3DXVec2Subtract(&gotvec, &u, &v);
2013  expect_vec2(&expectedvec, &gotvec, 0);
2014  /* Tests the case NULL. */
2015  funcpointer = D3DXVec2Subtract(&gotvec,NULL,&v);
2016  ok(funcpointer == NULL, "Expected: %p, Got: %p\n", NULL, funcpointer);
2017  funcpointer = D3DXVec2Subtract(NULL,NULL,NULL);
2018  ok(funcpointer == NULL, "Expected: %p, Got: %p\n", NULL, funcpointer);
2019 
2020 /*_______________D3DXVec2Transform_______________________*/
2021  expectedtrans.x = 36.0f; expectedtrans.y = 44.0f; expectedtrans.z = 52.0f; expectedtrans.w = 60.0f;
2022  D3DXVec2Transform(&gottrans, &u, &mat);
2023  expect_vec4(&expectedtrans, &gottrans, 0);
2024  gottrans.x = u.x; gottrans.y = u.y;
2025  D3DXVec2Transform(&gottrans, (D3DXVECTOR2 *)&gottrans, &mat);
2026  expect_vec4(&expectedtrans, &gottrans, 0);
2027 
2028 /*_______________D3DXVec2TransformCoord_______________________*/
2029  expectedvec.x = 0.6f; expectedvec.y = 11.0f/15.0f;
2030  D3DXVec2TransformCoord(&gotvec, &u, &mat);
2031  expect_vec2(&expectedvec, &gotvec, 1);
2032  gotvec.x = u.x; gotvec.y = u.y;
2033  D3DXVec2TransformCoord(&gotvec, &gotvec, &mat);
2034  expect_vec2(&expectedvec, &gotvec, 1);
2035 
2036  /*_______________D3DXVec2TransformNormal______________________*/
2037  expectedvec.x = 23.0f; expectedvec.y = 30.0f;
2038  D3DXVec2TransformNormal(&gotvec,&u,&mat);
2039  expect_vec2(&expectedvec, &gotvec, 0);
2040 }
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble * u
Definition: glfuncs.h:240
D3DXVECTOR2 *WINAPI D3DXVec2BaryCentric(D3DXVECTOR2 *pout, const D3DXVECTOR2 *pv1, const D3DXVECTOR2 *pv2, const D3DXVECTOR2 *pv3, FLOAT f, FLOAT g)
Definition: math.c:1625
GLubyte GLubyte GLubyte GLubyte w
Definition: glext.h:6102
FLOAT y
Definition: d3dx9math.h:64
static void set_matrix(D3DXMATRIX *mat, float m00, float m01, float m02, float m03, float m10, float m11, float m12, float m13, float m20, float m21, float m22, float m23, float m30, float m31, float m32, float m33)
Definition: math.c:196
GLenum GLenum GLenum GLenum GLenum scale
Definition: glext.h:9032
#define equal(x, y)
Definition: reader.cc:56
D3DXVECTOR4 *WINAPI D3DXVec2Transform(D3DXVECTOR4 *pout, const D3DXVECTOR2 *pv, const D3DXMATRIX *pm)
Definition: math.c:1680
GLint GLint GLint GLint GLint x
Definition: gl.h:1548
static const MAT2 mat
Definition: font.c:66
static BOOL compare_float(float f, float g, unsigned int ulps)
Definition: math.c:26
#define expect_vec4(expected, vector, ulps)
Definition: math.c:120
#define expect_vec2(expected, vector, ulps)
Definition: math.c:102
unsigned int BOOL
Definition: ntddk_ex.h:94
D3DXVECTOR2 *WINAPI D3DXVec2Normalize(D3DXVECTOR2 *pout, const D3DXVECTOR2 *pv)
Definition: math.c:1659
D3DXVECTOR2 *WINAPI D3DXVec2TransformCoord(D3DXVECTOR2 *pout, const D3DXVECTOR2 *pv, const D3DXMATRIX *pm)
Definition: math.c:1709
GLfloat f
Definition: glext.h:7540
FLOAT x
Definition: d3dx9math.h:64
const GLdouble * v
Definition: gl.h:2040
#define ok(value,...)
Definition: atltest.h:57
#define NULL
Definition: types.h:112
D3DXVECTOR2 *WINAPI D3DXVec2TransformNormal(D3DXVECTOR2 *pout, const D3DXVECTOR2 *pv, const D3DXMATRIX *pm)
Definition: math.c:1740
D3DXVECTOR2 *WINAPI D3DXVec2CatmullRom(D3DXVECTOR2 *pout, const D3DXVECTOR2 *pv0, const D3DXVECTOR2 *pv1, const D3DXVECTOR2 *pv2, const D3DXVECTOR2 *pv3, FLOAT s)
Definition: math.c:1634
D3DXVECTOR2 *WINAPI D3DXVec2Hermite(D3DXVECTOR2 *pout, const D3DXVECTOR2 *pv1, const D3DXVECTOR2 *pt1, const D3DXVECTOR2 *pv2, const D3DXVECTOR2 *pt2, FLOAT s)
Definition: math.c:1643

Referenced by START_TEST().

◆ D3DXVector3Test()

static void D3DXVector3Test ( void  )
static

Definition at line 2042 of file math.c.

2043 {
2044  D3DVIEWPORT9 viewport;
2045  D3DXVECTOR3 expectedvec, gotvec, nul, u, v, w, x;
2046  LPD3DXVECTOR3 funcpointer;
2047  D3DXVECTOR4 expectedtrans, gottrans;
2048  D3DXMATRIX mat, projection, view, world;
2049  float coeff1, coeff2, got, scale;
2050  BOOL equal;
2051 
2052  nul.x = 0.0f; nul.y = 0.0f; nul.z = 0.0f;
2053  u.x = 9.0f; u.y = 6.0f; u.z = 2.0f;
2054  v.x = 2.0f; v.y = -3.0f; v.z = -4.0;
2055  w.x = 3.0f; w.y = -5.0f; w.z = 7.0f;
2056  x.x = 4.0f; x.y = 1.0f; x.z = 11.0f;
2057 
2058  viewport.Width = 800; viewport.MinZ = 0.2f; viewport.X = 10;
2059  viewport.Height = 680; viewport.MaxZ = 0.9f; viewport.Y = 5;
2060 
2061  set_matrix(&mat,
2062  1.0f, 2.0f, 3.0f, 4.0f,
2063  5.0f, 6.0f, 7.0f, 8.0f,
2064  9.0f, 10.0f, 11.0f, 12.0f,
2065  13.0f, 14.0f, 15.0f, 16.0f);
2066 
2067  U(view).m[0][1] = 5.0f; U(view).m[0][2] = 7.0f; U(view).m[0][3] = 8.0f;
2068  U(view).m[1][0] = 11.0f; U(view).m[1][2] = 16.0f; U(view).m[1][3] = 33.0f;
2069  U(view).m[2][0] = 19.0f; U(view).m[2][1] = -21.0f; U(view).m[2][3] = 43.0f;
2070  U(view).m[3][0] = 2.0f; U(view).m[3][1] = 3.0f; U(view).m[3][2] = -4.0f;
2071  U(view).m[0][0] = 10.0f; U(view).m[1][1] = 20.0f; U(view).m[2][2] = 30.0f;
2072  U(view).m[3][3] = -40.0f;
2073 
2074  set_matrix(&world,
2075  21.0f, 2.0f, 3.0f, 4.0f,
2076  5.0f, 23.0f, 7.0f, 8.0f,
2077  -8.0f, -7.0f, 25.0f, -5.0f,
2078  -4.0f, -3.0f, -2.0f, 27.0f);
2079 
2080  coeff1 = 2.0f; coeff2 = 5.0f;
2081  scale = -6.5f;
2082 
2083 /*_______________D3DXVec3Add__________________________*/
2084  expectedvec.x = 11.0f; expectedvec.y = 3.0f; expectedvec.z = -2.0f;
2085  D3DXVec3Add(&gotvec,&u,&v);
2086  expect_vec3(&expectedvec, &gotvec, 0);
2087  /* Tests the case NULL */
2088  funcpointer = D3DXVec3Add(&gotvec,NULL,&v);
2089  ok(funcpointer == NULL, "Expected: %p, Got: %p\n", NULL, funcpointer);
2090  funcpointer = D3DXVec3Add(NULL,NULL,NULL);
2091  ok(funcpointer == NULL, "Expected: %p, Got: %p\n", NULL, funcpointer);
2092 
2093 /*_______________D3DXVec3BaryCentric___________________*/
2094  expectedvec.x = -35.0f; expectedvec.y = -67.0; expectedvec.z = 15.0f;
2095  D3DXVec3BaryCentric(&gotvec,&u,&v,&w,coeff1,coeff2);
2096  expect_vec3(&expectedvec, &gotvec, 0);
2097 
2098 /*_______________D3DXVec3CatmullRom____________________*/
2099  expectedvec.x = 1458.0f; expectedvec.y = 22.1875f; expectedvec.z = 4141.375f;
2100  D3DXVec3CatmullRom(&gotvec,&u,&v,&w,&x,scale);
2101  expect_vec3(&expectedvec, &gotvec, 0);
2102 
2103 /*_______________D3DXVec3Cross________________________*/
2104  expectedvec.x = -18.0f; expectedvec.y = 40.0f; expectedvec.z = -39.0f;
2105  D3DXVec3Cross(&gotvec,&u,&v);
2106  expect_vec3(&expectedvec, &gotvec, 0);
2107  expectedvec.x = -277.0f; expectedvec.y = -150.0f; expectedvec.z = -26.0f;
2108  D3DXVec3Cross(&gotvec,&gotvec,&v);
2109  expect_vec3(&expectedvec, &gotvec, 0);
2110  /* Tests the case NULL */
2111  funcpointer = D3DXVec3Cross(&gotvec,NULL,&v);
2112  ok(funcpointer == NULL, "Expected: %p, Got: %p\n", NULL, funcpointer);
2113  funcpointer = D3DXVec3Cross(NULL,NULL,NULL);
2114  ok(funcpointer == NULL, "Expected: %p, Got: %p\n", NULL, funcpointer);
2115 
2116 /*_______________D3DXVec3Dot__________________________*/
2117  got = D3DXVec3Dot(&u, &v);
2118  equal = compare_float(got, -8.0f, 0);
2119  ok(equal, "Got unexpected dot %.8e.\n", got);
2120  /* Tests the case NULL */
2121  got = D3DXVec3Dot(NULL, &v);
2122  equal = compare_float(got, 0.0f, 0);
2123  ok(equal, "Got unexpected dot %.8e.\n", got);
2124  got = D3DXVec3Dot(NULL, NULL);
2125  equal = compare_float(got, 0.0f, 0);
2126  ok(equal, "Got unexpected dot %.8e.\n", got);
2127 
2128 /*_______________D3DXVec3Hermite__________________________*/
2129  expectedvec.x = -6045.75f; expectedvec.y = -6650.0f; expectedvec.z = 1358.875f;
2130  D3DXVec3Hermite(&gotvec,&u,&v,&w,&x,scale);
2131  expect_vec3(&expectedvec, &gotvec, 0);
2132 
2133 /*_______________D3DXVec3Length__________________________*/
2134  got = D3DXVec3Length(&u);
2135  equal = compare_float(got, 11.0f, 0);
2136  ok(equal, "Got unexpected length %.8e.\n", got);
2137  /* Tests the case NULL. */
2138  got = D3DXVec3Length(NULL);
2139  equal = compare_float(got, 0.0f, 0);
2140  ok(equal, "Got unexpected length %.8e.\n", got);
2141 
2142 /*_______________D3DXVec3LengthSq________________________*/
2143  got = D3DXVec3LengthSq(&u);
2144  equal = compare_float(got, 121.0f, 0);
2145  ok(equal, "Got unexpected length %.8e.\n", got);
2146  /* Tests the case NULL. */
2147  got = D3DXVec3LengthSq(NULL);
2148  equal = compare_float(got, 0.0f, 0);
2149  ok(equal, "Got unexpected length %.8e.\n", got);
2150 
2151 /*_______________D3DXVec3Lerp__________________________*/
2152  expectedvec.x = 54.5f; expectedvec.y = 64.5f; expectedvec.z = 41.0f ;
2153  D3DXVec3Lerp(&gotvec,&u,&v,scale);
2154  expect_vec3(&expectedvec, &gotvec, 0);
2155  /* Tests the case NULL */
2156  funcpointer = D3DXVec3Lerp(&gotvec,NULL,&v,scale);
2157  ok(funcpointer == NULL, "Expected: %p, Got: %p\n", NULL, funcpointer);
2158  funcpointer = D3DXVec3Lerp(NULL,NULL,NULL,scale);
2159  ok(funcpointer == NULL, "Expected: %p, Got: %p\n", NULL, funcpointer);
2160 
2161 /*_______________D3DXVec3Maximize__________________________*/
2162  expectedvec.x = 9.0f; expectedvec.y = 6.0f; expectedvec.z = 2.0f;
2163  D3DXVec3Maximize(&gotvec,&u,&v);
2164  expect_vec3(&expectedvec, &gotvec, 0);
2165  /* Tests the case NULL */
2166  funcpointer = D3DXVec3Maximize(&gotvec,NULL,&v);
2167  ok(funcpointer == NULL, "Expected: %p, Got: %p\n", NULL, funcpointer);
2168  funcpointer = D3DXVec3Maximize(NULL,NULL,NULL);
2169  ok(funcpointer == NULL, "Expected: %p, Got: %p\n", NULL, funcpointer);
2170 
2171 /*_______________D3DXVec3Minimize__________________________*/
2172  expectedvec.x = 2.0f; expectedvec.y = -3.0f; expectedvec.z = -4.0f;
2173  D3DXVec3Minimize(&gotvec,&u,&v);
2174  expect_vec3(&expectedvec, &gotvec, 0);
2175  /* Tests the case NULL */
2176  funcpointer = D3DXVec3Minimize(&gotvec,NULL,&v);
2177  ok(funcpointer == NULL, "Expected: %p, Got: %p\n", NULL, funcpointer);
2178  funcpointer = D3DXVec3Minimize(NULL,NULL,NULL);
2179  ok(funcpointer == NULL, "Expected: %p, Got: %p\n", NULL, funcpointer);
2180 
2181 /*_______________D3DXVec3Normalize_________________________*/
2182  expectedvec.x = 9.0f/11.0f; expectedvec.y = 6.0f/11.0f; expectedvec.z = 2.0f/11.0f;
2183  D3DXVec3Normalize(&gotvec,&u);
2184  expect_vec3(&expectedvec, &gotvec, 1);
2185  /* Test the nul vector */
2186  expectedvec.x = 0.0f; expectedvec.y = 0.0f; expectedvec.z = 0.0f;
2187  D3DXVec3Normalize(&gotvec,&nul);
2188  expect_vec3(&expectedvec, &gotvec, 0);
2189 
2190 /*_______________D3DXVec3Scale____________________________*/
2191  expectedvec.x = -58.5f; expectedvec.y = -39.0f; expectedvec.z = -13.0f;
2192  D3DXVec3Scale(&gotvec,&u,scale);
2193  expect_vec3(&expectedvec, &gotvec, 0);
2194  /* Tests the case NULL */
2195  funcpointer = D3DXVec3Scale(&gotvec,NULL,scale);
2196  ok(funcpointer == NULL, "Expected: %p, Got: %p\n", NULL, funcpointer);
2197  funcpointer = D3DXVec3Scale(NULL,NULL,scale);
2198  ok(funcpointer == NULL, "Expected: %p, Got: %p\n", NULL, funcpointer);
2199 
2200 /*_______________D3DXVec3Subtract_______________________*/
2201  expectedvec.x = 7.0f; expectedvec.y = 9.0f; expectedvec.z = 6.0f;
2202  D3DXVec3Subtract(&gotvec,&u,&v);
2203  expect_vec3(&expectedvec, &gotvec, 0);
2204  /* Tests the case NULL */
2205  funcpointer = D3DXVec3Subtract(&gotvec,NULL,&v);
2206  ok(funcpointer == NULL, "Expected: %p, Got: %p\n", NULL, funcpointer);
2207  funcpointer = D3DXVec3Subtract(NULL,NULL,NULL);
2208  ok(funcpointer == NULL, "Expected: %p, Got: %p\n", NULL, funcpointer);
2209 
2210 /*_______________D3DXVec3Transform_______________________*/
2211  expectedtrans.x = 70.0f; expectedtrans.y = 88.0f; expectedtrans.z = 106.0f; expectedtrans.w = 124.0f;
2212  D3DXVec3Transform(&gottrans, &u, &mat);
2213  expect_vec4(&expectedtrans, &gottrans, 0);
2214 
2215  gottrans.x = u.x; gottrans.y = u.y; gottrans.z = u.z;
2216  D3DXVec3Transform(&gottrans, (D3DXVECTOR3 *)&gottrans, &mat);
2217  expect_vec4(&expectedtrans, &gottrans, 0);
2218 
2219 /*_______________D3DXVec3TransformCoord_______________________*/
2220  expectedvec.x = 70.0f/124.0f; expectedvec.y = 88.0f/124.0f; expectedvec.z = 106.0f/124.0f;
2221  D3DXVec3TransformCoord(&gotvec,&u,&mat);
2222  expect_vec3(&expectedvec, &gotvec, 1);
2223 
2224 /*_______________D3DXVec3TransformNormal______________________*/
2225  expectedvec.x = 57.0f; expectedvec.y = 74.0f; expectedvec.z = 91.0f;
2226  D3DXVec3TransformNormal(&gotvec,&u,&mat);
2227  expect_vec3(&expectedvec, &gotvec, 0);
2228 
2229 /*_______________D3DXVec3Project_________________________*/
2230  expectedvec.x = 1135.721924f; expectedvec.y = 147.086914f; expectedvec.z = 0.153412f;
2231  D3DXMatrixPerspectiveFovLH(&projection,D3DX_PI/4.0f,20.0f/17.0f,1.0f,1000.0f);
2232  D3DXVec3Project(&gotvec,&u,&viewport,&projection,&view,&world);
2233  expect_vec3(&expectedvec, &gotvec, 32);
2234  /* World matrix can be omitted */
2235  D3DXMatrixMultiply(&mat,&world,&view);
2236  D3DXVec3Project(&gotvec,&u,&viewport,&projection,&mat,NULL);
2237  expect_vec3(&expectedvec, &gotvec, 32);
2238  /* Projection matrix can be omitted */
2239  D3DXMatrixMultiply(&mat,&view,&projection);
2240  D3DXVec3Project(&gotvec,&u,&viewport,NULL,&mat,&world);
2241  expect_vec3(&expectedvec, &gotvec, 32);
2242  /* View matrix can be omitted */
2243  D3DXMatrixMultiply(&mat,&world,&view);
2244  D3DXVec3Project(&gotvec,&u,&viewport,&projection,NULL,&mat);
2245  expect_vec3(&expectedvec, &gotvec, 32);
2246  /* All matrices can be omitted */
2247  expectedvec.x = 4010.000000f; expectedvec.y = -1695.000000f; expectedvec.z = 1.600000f;
2248  D3DXVec3Project(&gotvec,&u,&viewport,NULL,NULL,NULL);
2249  expect_vec3(&expectedvec, &gotvec, 2);
2250  /* Viewport can be omitted */
2251  expectedvec.x = 1.814305f; expectedvec.y = 0.582097f; expectedvec.z = -0.066555f;
2252  D3DXVec3Project(&gotvec,&u,NULL,&projection,&view,&world);
2253  expect_vec3(&expectedvec, &gotvec, 64);
2254 
2255 /*_______________D3DXVec3Unproject_________________________*/
2256  expectedvec.x = -2.913411f; expectedvec.y = 1.593215f; expectedvec.z = 0.380724f;
2257  D3DXMatrixPerspectiveFovLH(&projection,D3DX_PI/4.0f,20.0f/17.0f,1.0f,1000.0f);
2258  D3DXVec3Unproject(&gotvec,&u,&viewport,&projection,&view,&world);
2259  expect_vec3(&expectedvec, &gotvec, 16);
2260  /* World matrix can be omitted */
2261  D3DXMatrixMultiply(&mat,&world,&view);
2262  D3DXVec3Unproject(&gotvec,&u,&viewport,&projection,&mat,NULL);
2263  expect_vec3(&expectedvec, &gotvec, 16);
2264  /* Projection matrix can be omitted */
2265  D3DXMatrixMultiply(&mat,&view,&projection);
2266  D3DXVec3Unproject(&gotvec,&u,&viewport,NULL,&mat,&world);
2267  expect_vec3(&expectedvec, &gotvec, 32);
2268  /* View matrix can be omitted */
2269  D3DXMatrixMultiply(&mat,&world,&view);
2270  D3DXVec3Unproject(&gotvec,&u,&viewport,&projection,NULL,&mat);
2271  expect_vec3(&expectedvec, &gotvec, 16);
2272  /* All matrices can be omitted */
2273  expectedvec.x = -1.002500f; expectedvec.y = 0.997059f; expectedvec.z = 2.571429f;
2274  D3DXVec3Unproject(&gotvec,&u,&viewport,NULL,NULL,NULL);
2275  expect_vec3(&expectedvec, &gotvec, 4);
2276  /* Viewport can be omitted */
2277  expectedvec.x = -11.018396f; expectedvec.y = 3.218991f; expectedvec.z = 1.380329f;
2278  D3DXVec3Unproject(&gotvec,&u,NULL,&projection,&view,&world);
2279  expect_vec3(&expectedvec, &gotvec, 8);
2280 }
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble * u
Definition: glfuncs.h:240
D3DXVECTOR3 *WINAPI D3DXVec3CatmullRom(D3DXVECTOR3 *pout, const D3DXVECTOR3 *pv0, const D3DXVECTOR3 *pv1, const D3DXVECTOR3 *pv2, const D3DXVECTOR3 *pv3, FLOAT s)
Definition: math.c:1778
D3DXVECTOR3 *WINAPI D3DXVec3Hermite(D3DXVECTOR3 *pout, const D3DXVECTOR3 *pv1, const D3DXVECTOR3 *pt1, const D3DXVECTOR3 *pv2, const D3DXVECTOR3 *pt2, FLOAT s)
Definition: math.c:1788
GLubyte GLubyte GLubyte GLubyte w
Definition: glext.h:6102
static void set_matrix(D3DXMATRIX *mat, float m00, float m01, float m02, float m03, float m10, float m11, float m12, float m13, float m20, float m21, float m22, float m23, float m30, float m31, float m32, float m33)
Definition: math.c:196
D3DXVECTOR3 *WINAPI D3DXVec3TransformNormal(D3DXVECTOR3 *pout, const D3DXVECTOR3 *pv, const D3DXMATRIX *pm)
Definition: math.c:1928
D3DXMATRIX *WINAPI D3DXMatrixMultiply(D3DXMATRIX *pout, const D3DXMATRIX *pm1, const D3DXMATRIX *pm2)
Definition: math.c:397
GLenum GLenum GLenum GLenum GLenum scale
Definition: glext.h:9032
#define U(x)
Definition: wordpad.c:45
#define equal(x, y)
Definition: reader.cc:56
GLint GLint GLint GLint GLint x
Definition: gl.h:1548
static const MAT2 mat
Definition: font.c:66
static BOOL compare_float(float f, float g, unsigned int ulps)
Definition: math.c:26
D3DXVECTOR3 *WINAPI D3DXVec3Project(D3DXVECTOR3 *pout, const D3DXVECTOR3 *pv, const D3DVIEWPORT9 *pviewport, const D3DXMATRIX *pprojection, const D3DXMATRIX *pview, const D3DXMATRIX *pworld)
Definition: math.c:1828
#define expect_vec4(expected, vector, ulps)
Definition: math.c:120
D3DXVECTOR3 *WINAPI D3DXVec3Unproject(D3DXVECTOR3 *out, const D3DXVECTOR3 *v, const D3DVIEWPORT9 *viewport, const D3DXMATRIX *projection, const D3DXMATRIX *view, const D3DXMATRIX *world)
Definition: math.c:1956
D3DXVECTOR3 *WINAPI D3DXVec3BaryCentric(D3DXVECTOR3 *pout, const D3DXVECTOR3 *pv1, const D3DXVECTOR3 *pv2, co