patch [6/15]: Implements D3DRMVectorModulus [try2]
David.Adam at math.cnrs.fr
David.Adam at math.cnrs.fr
Thu Apr 19 14:08:56 CDT 2007
-------------- next part --------------
>From d30b014883290421dac0f5acddddffdef50e6368 Mon Sep 17 00:00:00 2001
From: Adam <David.Adam at math.cnrs.fr>
Date: Fri, 20 Apr 2007 01:55:20 +0200
Subject: [PATCH] Implements D3DVectorModulus with test.
---
dlls/d3drm/d3drm.spec | 2 +-
dlls/d3drm/math.c | 8 ++++++++
dlls/d3drm/tests/vector.c | 4 ++++
3 files changed, 13 insertions(+), 1 deletions(-)
diff --git a/dlls/d3drm/d3drm.spec b/dlls/d3drm/d3drm.spec
index b0a190f..f2e8805 100644
--- a/dlls/d3drm/d3drm.spec
+++ b/dlls/d3drm/d3drm.spec
@@ -11,7 +11,7 @@
@ stdcall D3DRMVectorAdd(ptr ptr ptr)
@ stdcall D3DRMVectorCrossProduct(ptr ptr ptr)
@ stdcall D3DRMVectorDotProduct(ptr)
-@ stub D3DRMVectorModulus
+@ stdcall D3DRMVectorModulus(ptr)
@ stub D3DRMVectorNormalize
@ stub D3DRMVectorRandom
@ stub D3DRMVectorReflect
diff --git a/dlls/d3drm/math.c b/dlls/d3drm/math.c
index 2f452f4..372eb18 100644
--- a/dlls/d3drm/math.c
+++ b/dlls/d3drm/math.c
@@ -65,3 +65,11 @@ D3DVALUE WINAPI D3DRMVectorDotProduct(LP
dot_product=s1->x * s2->x + s1->y * s2->y + s1->z * s2->z;
return dot_product;
}
+
+/* Norm of a vector */
+D3DVALUE WINAPI D3DRMVectorModulus(LPD3DVECTOR v)
+{
+ D3DVALUE result;
+ result=sqrt(v->x * v->x + v->y * v->y + v->z * v->z);
+ return result;
+}
diff --git a/dlls/d3drm/tests/vector.c b/dlls/d3drm/tests/vector.c
index f7b35bf..d77e272 100644
--- a/dlls/d3drm/tests/vector.c
+++ b/dlls/d3drm/tests/vector.c
@@ -56,6 +56,10 @@ void VectorTest(void)
/*_______________________VectorDotProduct__________________________*/
mod=D3DRMVectorDotProduct(&u,&v);
ok((mod == 16.0), "Expected 16.0, Got %f",mod);
+
+/*_______________________VectorModulus_____________________________*/
+ mod=D3DRMVectorModulus(&u);
+ ok((mod == 3.0), "Expected 3.0, Got %f",mod);
}
START_TEST(vector)
--
1.4.2
More information about the wine-patches
mailing list