diff --git a/src/Mod/MeshPart/App/CurveProjector.cpp b/src/Mod/MeshPart/App/CurveProjector.cpp index b0c151a44f33..e42760633a67 100644 --- a/src/Mod/MeshPart/App/CurveProjector.cpp +++ b/src/Mod/MeshPart/App/CurveProjector.cpp @@ -30,6 +30,7 @@ # include # include # include +# include # include # include # include @@ -688,7 +689,7 @@ MeshProjection::~MeshProjection() { } -void MeshProjection::discretize(const TopoDS_Edge& aEdge, std::vector& polyline) const +void MeshProjection::discretize(const TopoDS_Edge& aEdge, std::vector& polyline, std::size_t minPoints) const { BRepAdaptor_Curve clCurve(aEdge); @@ -703,6 +704,18 @@ void MeshProjection::discretize(const TopoDS_Edge& aEdge, std::vector(minPoints), fFirst, fLast); + if (clAbsc.IsDone() == Standard_True) { + polyline.clear(); + Standard_Integer nNbPoints = clAbsc.NbPoints(); + for (Standard_Integer i = 1; i <= nNbPoints; i++) { + gp_Pnt gpPt = clCurve.Value(clAbsc.Parameter(i)); + polyline.push_back( Base::Vector3f( (float)gpPt.X(), (float)gpPt.Y(), (float)gpPt.Z() ) ); + } + } + } } void MeshProjection::splitMeshByShape ( const TopoDS_Shape &aShape, float fMaxDist ) const @@ -765,7 +778,7 @@ void MeshProjection::projectParallelToMesh (const TopoDS_Shape &aShape, const Ba for (Ex.Init(aShape, TopAbs_EDGE); Ex.More(); Ex.Next()) { const TopoDS_Edge& aEdge = TopoDS::Edge(Ex.Current()); std::vector points; - discretize(aEdge, points); + discretize(aEdge, points, 5); typedef std::pair HitPoint; std::vector hitPoints; diff --git a/src/Mod/MeshPart/App/CurveProjector.h b/src/Mod/MeshPart/App/CurveProjector.h index fdc045f023bf..f5f77bd2e9a8 100644 --- a/src/Mod/MeshPart/App/CurveProjector.h +++ b/src/Mod/MeshPart/App/CurveProjector.h @@ -180,7 +180,7 @@ class MeshPartExport MeshProjection /// Destruction ~MeshProjection(); - void discretize(const TopoDS_Edge& aEdge, std::vector& polyline) const; + void discretize(const TopoDS_Edge& aEdge, std::vector& polyline, std::size_t minPoints=2) const; /** * Searches all edges that intersect with the projected curve \a aShape. Therefore \a aShape must * contain shapes of type TopoDS_Edge, other shape types are ignored. A possible solution is diff --git a/src/Mod/MeshPart/App/PreCompiled.h b/src/Mod/MeshPart/App/PreCompiled.h index f3e805166abc..deea45c93444 100644 --- a/src/Mod/MeshPart/App/PreCompiled.h +++ b/src/Mod/MeshPart/App/PreCompiled.h @@ -147,6 +147,7 @@ #include #include #include +#include #include #include #include