[PATCH] Implement D3DXVec2CCW with a test

David Adam DavidAdam at math.cnrs.fr
Sun Oct 14 11:33:25 CDT 2007


---
 dlls/d3dx8/tests/math.c |   12 ++++++++++++
 include/d3dx8math.h     |    1 +
 include/d3dx8math.inl   |    6 ++++++
 3 files changed, 19 insertions(+), 0 deletions(-)

diff --git a/dlls/d3dx8/tests/math.c b/dlls/d3dx8/tests/math.c
index e70ae07..6efe02c 100644
--- a/dlls/d3dx8/tests/math.c
+++ b/dlls/d3dx8/tests/math.c
@@ -32,6 +32,18 @@ static void D3X8Vector2Test(void)
     u.x=3D3.0f; u.y=3D4.0f;
     v.x=3D-7.0f; v.y=3D9.0f;
=20
+/*_______________D3DXVec2CCW__________________________*/
+   expected =3D 55.0f;
+   got =3D D3DXVec2CCW(&u,&v);
+   ok(fabs( got - expected ) < admitted_error, "Expected: %f, Got: %f\n", e=
xpected, got);
+   /* Tests the case NULL */
+    expected=3D0.0f;
+    got =3D D3DXVec2CCW(NULL,&v);
+    ok(fabs( got - expected ) < admitted_error, "Expected: %f, Got: %f\n", =
expected, got);
+    expected=3D0.0f;
+    got =3D D3DXVec2CCW(NULL,NULL);
+    ok(fabs( got - expected ) < admitted_error, "Expected: %f, Got: %f\n", =
expected, got);
+
 /*_______________D3DXVec2Dot__________________________*/
    expected =3D 15.0f;
    got =3D D3DXVec2Dot(&u,&v);
diff --git a/include/d3dx8math.h b/include/d3dx8math.h
index db75b72..e088760 100644
--- a/include/d3dx8math.h
+++ b/include/d3dx8math.h
@@ -58,6 +58,7 @@ typedef struct D3DXCOLOR
     FLOAT r, g, b, a;
 } D3DXCOLOR, *LPD3DXCOLOR;
=20
+FLOAT D3DXVec2CCW(CONST D3DXVECTOR2 *pv1, CONST D3DXVECTOR2 *pv2);
 FLOAT D3DXVec2Dot(CONST D3DXVECTOR2 *pv1, CONST D3DXVECTOR2 *pv2);
 FLOAT D3DXVec2Length(CONST D3DXVECTOR2 *pv);
 FLOAT D3DXVec2LengthSq(CONST D3DXVECTOR2 *pv);
diff --git a/include/d3dx8math.inl b/include/d3dx8math.inl
index 5c29484..8112488 100644
--- a/include/d3dx8math.inl
+++ b/include/d3dx8math.inl
@@ -19,6 +19,12 @@
 #ifndef __D3DX8MATH_INL__
 #define __D3DX8MATH_INL__
=20
+extern inline FLOAT D3DXVec2CCW(CONST D3DXVECTOR2 *pv1, CONST D3DXVECTOR2 *=
pv2)
+{
+    if ( !pv1 || !pv2) return 0.0f;
+    return ( (pv1->x) * (pv2->y) - (pv1->y) * (pv2->x) );
+}
+
 extern inline FLOAT D3DXVec2Dot(CONST D3DXVECTOR2 *pv1, CONST D3DXVECTOR2 *=
pv2)
 {
     if ( !pv1 || !pv2) return 0.0f;
--=20
1.5.3.2


--=_4gf4p3mgn2m8--



More information about the wine-patches mailing list