From 2600ba173168b6e9b32c713f2c217d322aab043e Mon Sep 17 00:00:00 2001 From: Gael Guennebaud Date: Sat, 10 Dec 2011 12:17:42 +0100 Subject: feature 297: s/intersectionPoint/pointAt, fix documentation, add a unit test --- test/geo_parametrizedline.cpp | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'test/geo_parametrizedline.cpp') diff --git a/test/geo_parametrizedline.cpp b/test/geo_parametrizedline.cpp index 13f98fdd6..a289e70de 100644 --- a/test/geo_parametrizedline.cpp +++ b/test/geo_parametrizedline.cpp @@ -40,6 +40,7 @@ template void parametrizedline(const LineType& _line) typedef Matrix VectorType; typedef Matrix MatrixType; + typedef Hyperplane HyperplaneType; VectorType p0 = VectorType::Random(dim); VectorType p1 = VectorType::Random(dim); @@ -64,6 +65,16 @@ template void parametrizedline(const LineType& _line) VERIFY_IS_APPROX(hp1f.template cast(),l0); ParametrizedLine hp1d = l0.template cast(); VERIFY_IS_APPROX(hp1d.template cast(),l0); + + // intersections + VectorType p2 = VectorType::Random(dim); + VectorType n2 = VectorType::Random(dim).normalized(); + HyperplaneType hp(p2,n2); + Scalar t = l0.intersectionParameter(hp); + VectorType pi = l0.pointAt(t); + VERIFY_IS_MUCH_SMALLER_THAN(hp.signedDistance(pi), RealScalar(1)); + VERIFY_IS_MUCH_SMALLER_THAN(l0.distance(pi), RealScalar(1)); + VERIFY_IS_APPROX(l0.intersectionPoint(hp), pi); } template void parametrizedline_alignment() -- cgit v1.2.3