The MeshProjection class projects a shape onto a mesh. More...
#include <CurveProjector.h>
Classes | |
struct | Edge |
struct | PolyLine |
struct | SplitEdge |
Helper class. More... | |
Public Member Functions | |
void | discretize (const TopoDS_Edge &aEdge, std::vector< Base::Vector3f > &polyline, std::size_t minPoints=2) const |
void | findSectionParameters (const TopoDS_Edge &edge, const Base::Vector3f &dir, std::set< double > ¶meters) const |
findSectionParameters Find the parameters of the edge where when projecting the corresponding point will lie on an edge of the mesh. More... | |
MeshProjection (const MeshKernel &rMesh) | |
Construction. More... | |
void | projectOnMesh (const std::vector< Base::Vector3f > &pointsIn, const Base::Vector3f &dir, float tolerance, std::vector< Base::Vector3f > &pointsOut) const |
projectOnMesh Projects the given points onto the mesh along a given direction. More... | |
void | projectParallelToMesh (const std::vector< PolyLine > &aEdges, const Base::Vector3f &dir, std::vector< PolyLine > &rPolyLines) const |
Project all polylines onto the mesh using parallel projection. More... | |
void | projectParallelToMesh (const TopoDS_Shape &aShape, const Base::Vector3f &dir, std::vector< PolyLine > &rPolyLines) const |
Project all edges of the shape onto the mesh using parallel projection. More... | |
void | projectToMesh (const TopoDS_Shape &aShape, float fMaxDist, std::vector< PolyLine > &rPolyLines) const |
Searches all edges that intersect with the projected curve aShape. More... | |
void | splitMeshByShape (const TopoDS_Shape &aShape, float fMaxDist) const |
Cuts the mesh at the curve defined by aShape. More... | |
~MeshProjection () | |
Destruction. More... | |
Protected Member Functions | |
bool | findIntersection (const Edge &, const Edge &, const Base::Vector3f &dir, Base::Vector3f &res) const |
void | projectEdgeToEdge (const TopoDS_Edge &aCurve, float fMaxDist, const MeshCore::MeshFacetGrid &rGrid, std::vector< SplitEdge > &rSplitEdges) const |
The MeshProjection class projects a shape onto a mesh.
MeshProjection::MeshProjection | ( | const MeshKernel & | rMesh | ) |
Construction.
MeshProjection::~MeshProjection | ( | ) |
Destruction.
void MeshProjection::discretize | ( | const TopoDS_Edge & | aEdge, |
std::vector< Base::Vector3f > & | polyline, | ||
std::size_t | minPoints = 2 |
||
) | const |
Referenced by findSectionParameters(), projectEdgeToEdge(), and projectParallelToMesh().
|
protected |
void MeshProjection::findSectionParameters | ( | const TopoDS_Edge & | edge, |
const Base::Vector3f & | dir, | ||
std::set< double > & | parameters | ||
) | const |
findSectionParameters Find the parameters of the edge where when projecting the corresponding point will lie on an edge of the mesh.
edge | |
dir | |
parameters |
References MeshPart::MeshProjection::Edge::cPt1, MeshPart::MeshProjection::Edge::cPt2, discretize(), findIntersection(), and MeshCore::MeshAlgorithm::GetAverageEdgeLength().
|
protected |
References Base::Console(), MeshPart::MeshProjection::SplitEdge::cPt, discretize(), Base::Distance(), MeshCore::MeshGeomFacet::GetNormal(), Base::ConsoleSingleton::Log(), Base::SequencerLauncher::next(), MeshCore::MeshAlgorithm::SearchFacetsFromPolyline(), Base::Vector3< _Precision >::Set(), MeshCore::MeshFacetIterator::Set(), MeshCore::MeshPointIterator::Set(), MeshPart::MeshProjection::SplitEdge::uE0, MeshPart::MeshProjection::SplitEdge::uE1, Base::Vector3< _Precision >::x, Base::Vector3< _Precision >::y, and Base::Vector3< _Precision >::z.
Referenced by projectToMesh().
void MeshProjection::projectOnMesh | ( | const std::vector< Base::Vector3f > & | pointsIn, |
const Base::Vector3f & | dir, | ||
float | tolerance, | ||
std::vector< Base::Vector3f > & | pointsOut | ||
) | const |
projectOnMesh Projects the given points onto the mesh along a given direction.
The points can can be projected will be saved to pointsOut
projectOnMesh
pointsIn | |
dir | |
tolerance | |
pointsOut |
References MeshCore::MeshAlgorithm::GetAverageEdgeLength(), MeshCore::MeshGeomFacet::IntersectPlaneWithLine(), MeshCore::MeshGeomFacet::IsPointOfFace(), MeshCore::MeshAlgorithm::NearestFacetOnRay(), Base::SequencerLauncher::next(), draftutils.utils::tolerance(), and draftgeoutils.general::vec().
void MeshProjection::projectParallelToMesh | ( | const std::vector< PolyLine > & | aEdges, |
const Base::Vector3f & | dir, | ||
std::vector< PolyLine > & | rPolyLines | ||
) | const |
Project all polylines onto the mesh using parallel projection.
References MeshCore::MeshAlgorithm::GetAverageEdgeLength(), MeshCore::MeshAlgorithm::NearestFacetOnRay(), Base::SequencerLauncher::next(), MeshPart::MeshProjection::PolyLine::points, and MeshCore::MeshProjection::projectLineOnMesh().
void MeshProjection::projectParallelToMesh | ( | const TopoDS_Shape & | aShape, |
const Base::Vector3f & | dir, | ||
std::vector< PolyLine > & | rPolyLines | ||
) | const |
Project all edges of the shape onto the mesh using parallel projection.
References discretize(), MeshCore::MeshAlgorithm::GetAverageEdgeLength(), MeshCore::MeshAlgorithm::NearestFacetOnRay(), Base::SequencerLauncher::next(), MeshPart::MeshProjection::PolyLine::points, and MeshCore::MeshProjection::projectLineOnMesh().
void MeshProjection::projectToMesh | ( | const TopoDS_Shape & | aShape, |
float | fMaxDist, | ||
std::vector< PolyLine > & | rPolyLines | ||
) | const |
Searches all edges that intersect with the projected curve aShape.
Therefore aShape must contain shapes of type TopoDS_Edge, other shape types are ignored. A possible solution is taken if the distance between the curve point and the projected point is <= fMaxDist.
References MeshCore::MeshAlgorithm::GetAverageEdgeLength(), Base::SequencerLauncher::next(), MeshPart::MeshProjection::PolyLine::points, and projectEdgeToEdge().
Referenced by splitMeshByShape().
void MeshProjection::splitMeshByShape | ( | const TopoDS_Shape & | aShape, |
float | fMaxDist | ||
) | const |
Cuts the mesh at the curve defined by aShape.
This method call projectToMesh() to get the split the facet at the found points.
References projectToMesh().