From 103f0e62801cf4690dac90f0b3432e03129069da Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Joachim=20Sch=C3=B6berl?= Date: Wed, 7 Sep 2016 09:03:29 +0200 Subject: [PATCH] use convex hulls --- libsrc/gprim/spline.hpp | 28 +++++++++++++++++++++++++++- 1 file changed, 27 insertions(+), 1 deletion(-) diff --git a/libsrc/gprim/spline.hpp b/libsrc/gprim/spline.hpp index a872d6e9..97b2e9a0 100644 --- a/libsrc/gprim/spline.hpp +++ b/libsrc/gprim/spline.hpp @@ -95,6 +95,9 @@ namespace netgen Array < Point > & points, const double eps) const {points.SetSize(0);} + // is the point in the convex hull (increased by eps) of the spline ? + virtual bool InConvexHull (Point p, double eps) const = 0; + virtual double MaxCurvature(void) const = 0; virtual string GetType(void) const {return "splinebase";} @@ -140,7 +143,12 @@ namespace netgen virtual void LineIntersections (const double a, const double b, const double c, Array < Point > & points, const double eps) const; - + + virtual bool InConvexHull (Point p, double eps) const + { + return MinDistLP2 (p1, p2, p) < sqr(eps); + } + virtual double MaxCurvature(void) const {return 0;} virtual void Project (const Point point, Point & point_on_curve, double & t) const; @@ -186,6 +194,11 @@ namespace netgen DLL_HEADER virtual void LineIntersections (const double a, const double b, const double c, Array < Point > & points, const double eps) const; + virtual bool InConvexHull (Point p, double eps) const + { + return MinDistTP2 (p1, p2, p3, p) < sqr(eps); + } + DLL_HEADER virtual double MaxCurvature(void) const; DLL_HEADER virtual void Project (const Point point, Point & point_on_curve, double & t) const; @@ -232,6 +245,11 @@ namespace netgen virtual void LineIntersections (const double a, const double b, const double c, Array < Point > & points, const double eps) const; + virtual bool InConvexHull (Point p, double eps) const + { + return (Dist2 (p, pm) < sqr(radius+eps)); + } + virtual double MaxCurvature(void) const {return 1./radius;} }; @@ -261,6 +279,10 @@ namespace netgen virtual void GetCoeff (Vector & coeffs) const {;} virtual double MaxCurvature(void) const {return 1;} + + // needs implementation ... + virtual bool InConvexHull (Point p, double eps) const + { return true; } }; @@ -597,6 +619,10 @@ namespace netgen virtual void GetCoeff (Vector & coeffs) const {;} virtual double MaxCurvature(void) const {return 1;} + + // needs implementation ... + virtual bool InConvexHull (Point p, double eps) const + { return true; } }; // Constructor