Permalink
Browse files

Add a test for projecting a point onto a plane

  • Loading branch information...
1 parent de773a8 commit 5b6a8a9fef9318625e7fb029eec12a177326f5f6 @Kazade committed Aug 20, 2016
Showing with 15 additions and 0 deletions.
  1. +15 −0 tests/test_vec3.h
View
15 tests/test_vec3.h
@@ -46,4 +46,19 @@ class TestVec3 : public TestCase {
assert_close(0.0, normalized_projection.y, kmEpsilon);
assert_close(0.0, normalized_projection.z, kmEpsilon);
}
+
+ void test_vec3_project_onto_plane() {
+ kmPlane plane;
+ kmPlaneFill(&plane, 0, 1, 0, 0);
+
+ kmVec3 v;
+ kmVec3Fill(&v, 1.0, 1.0, 0.0);
+
+ kmVec3 o;
+ kmVec3ProjectOnToPlane(&o, &v, &plane);
+
+ assert_close(o.x, 1, 0.001);
+ assert_close(o.y, 0, 0.001);
+ assert_close(o.z, 0, 0.001);
+ }
};

0 comments on commit 5b6a8a9

Please sign in to comment.