From 1b555044565a66ed8628d4f193ba80cb701874b4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Joachim=20Sch=C3=B6berl?= Date: Wed, 7 Sep 2016 09:06:40 +0200 Subject: [PATCH] fixed function for surface of revolution --- libsrc/csg/revolution.cpp | 20 +++++++++++++++++--- libsrc/csg/revolution.hpp | 6 +++++- 2 files changed, 22 insertions(+), 4 deletions(-) diff --git a/libsrc/csg/revolution.cpp b/libsrc/csg/revolution.cpp index 1b48676e..a8a01a07 100644 --- a/libsrc/csg/revolution.cpp +++ b/libsrc/csg/revolution.cpp @@ -551,21 +551,26 @@ namespace netgen } */ - - INSOLID_TYPE RevolutionFace :: PointInFace (const Point<3> & p, const double eps) const + + /* INSOLID_TYPE */ bool RevolutionFace :: PointInFace (const Point<3> & p, const double eps) const { Point<2> p2d; CalcProj(p,p2d); + if (!spline -> InConvexHull(p2d, eps)) return false; + double val = spline_coefficient(0)*p2d(0)*p2d(0) + spline_coefficient(1)*p2d(1)*p2d(1) + spline_coefficient(2)*p2d(0)*p2d(1) + spline_coefficient(3)*p2d(0) + spline_coefficient(4)*p2d(1) + spline_coefficient(5); + return (fabs(val) < eps); + /* if(val > eps) return IS_OUTSIDE; if(val < -eps) return IS_INSIDE; return DOES_INTERSECT; + */ } @@ -748,6 +753,15 @@ namespace netgen return IS_INSIDE; } + void Revolution :: GetTangentialSurfaceIndices (const Point<3> & p, + Array & surfind, double eps) const + { + for (int j = 0; j < faces.Size(); j++) + if (faces[j] -> PointInFace(p, eps)) + if (!surfind.Contains (GetSurfaceId(j))) + surfind.Append (GetSurfaceId(j)); + } + INSOLID_TYPE Revolution :: VecInSolid (const Point<3> & p, const Vec<3> & v, double eps) const @@ -763,7 +777,7 @@ namespace netgen Array intersecting_faces; for(int i=0; iPointInFace(p,eps) == DOES_INTERSECT) + if(faces[i]->PointInFace(p,eps)) // == DOES_INTERSECT) intersecting_faces.Append(i); Vec<3> hv; diff --git a/libsrc/csg/revolution.hpp b/libsrc/csg/revolution.hpp index f1c719fe..40dbfc7e 100644 --- a/libsrc/csg/revolution.hpp +++ b/libsrc/csg/revolution.hpp @@ -74,7 +74,7 @@ namespace netgen const SplineSeg<2> & GetSpline(void) const {return *spline;} - INSOLID_TYPE PointInFace (const Point<3> & p, const double eps) const; + /* INSOLID_TYPE */ bool PointInFace (const Point<3> & p, const double eps) const; void GetRawData(Array & data) const; @@ -125,6 +125,10 @@ namespace netgen virtual INSOLID_TYPE BoxInSolid (const BoxSphere<3> & box) const; virtual INSOLID_TYPE PointInSolid (const Point<3> & p, double eps) const; + + virtual void GetTangentialSurfaceIndices (const Point<3> & p, + Array & surfind, double eps) const; + virtual INSOLID_TYPE VecInSolid (const Point<3> & p, const Vec<3> & v, double eps) const;