The MeshAlgorithm class provides algorithms base on meshes. More...
#include <Algorithm.h>
Public Member Functions | |
float | CalculateMinimumGridLength (float fLength, const Base::BoundBox3f &rBBox, unsigned long maxElements) const |
Calculates the minimum grid length so that not more elements than maxElements will be created when the grid gets built up. More... | |
void | CheckBorderFacets (const std::vector< FacetIndex > &raclFacetIndices, std::vector< FacetIndex > &raclResultIndices, unsigned short usLevel=1) const |
Determines all facets of the given array raclFacetIndices that lie at the edge or that have at least neighbour facet that is not inside the array. More... | |
void | CheckFacets (const Base::ViewProjMethod *pclProj, const Base::Polygon2d &rclPoly, bool bInner, std::vector< FacetIndex > &rclRes) const |
Does the same as the above method unless that it doesn't use a grid. More... | |
void | CheckFacets (const MeshFacetGrid &rclGrid, const Base::ViewProjMethod *pclProj, const Base::Polygon2d &rclPoly, bool bInner, std::vector< FacetIndex > &rclRes) const |
Projects the determined facets through projection with pclProj into the 2D plane and checks for intersection with the polygon. More... | |
unsigned long | CountBorderEdges () const |
Returns the number of border edges. More... | |
unsigned long | CountFacetFlag (MeshFacet::TFlagType tF) const |
Count all facets with the flag tF. More... | |
unsigned long | CountPointFlag (MeshPoint::TFlagType tF) const |
Count all points with the flag tF. More... | |
void | CutBorderFacets (std::vector< FacetIndex > &raclFacetIndices, unsigned short usLevel=1) const |
Invokes CheckBorderFacets() to get all border facets of raclFacetIndices. More... | |
bool | CutWithPlane (const Base::Vector3f &clBase, const Base::Vector3f &clNormal, const MeshFacetGrid &rclGrid, std::list< std::vector< Base::Vector3f > > &rclResult, float fMinEps=1.0e-2f, bool bConnectPolygons=false) const |
Cuts the mesh with a plane. More... | |
bool | Distance (const Base::Vector3f &rclPt, FacetIndex ulFacetIdx, float fMaxDistance, float &rfDistance) const |
Returns true if the distance from the rclPt to the facet ulFacetIdx is less than fMaxDistance. More... | |
bool | FillupHole (const std::vector< PointIndex > &boundary, AbstractPolygonTriangulator &cTria, MeshFacetArray &rFaces, MeshPointArray &rPoints, int level, const MeshRefPointToFacets *pP2FStructure=nullptr) const |
Fills up the single boundary if it is a hole with high quality triangles and a maximum area of fMaxArea. More... | |
bool | FirstFacetToVertex (const Base::Vector3f &rclPt, float fMaxDistance, const MeshFacetGrid &rclGrid, FacetIndex &rulFacet) const |
Searches for the first facet of the grid element (rclGrid) in that the point rclPt lies into which is a distance not higher than fMaxDistance. More... | |
float | GetAverageEdgeLength () const |
Calculates the average length of edges. More... | |
void | GetBorderPoints (const std::vector< FacetIndex > &raclFacetIndices, std::set< PointIndex > &raclResultPointsIndices) const |
Determines all border points as indices of the facets in raclFacetIndices. More... | |
void | GetFacetBorder (FacetIndex uFacet, std::list< PointIndex > &rBorder) const |
Returns the boundary of the mesh to the facet uFacet. More... | |
void | GetFacetBorders (const std::vector< FacetIndex > &raulInd, std::list< std::vector< Base::Vector3f > > &rclBorders) const |
Returns all boundaries of a subset the mesh defined by raulInd. More... | |
void | GetFacetBorders (const std::vector< FacetIndex > &raulInd, std::list< std::vector< PointIndex > > &rclBorders, bool ignoreOrientation=false) const |
Returns all boundaries of a subset the mesh defined by raulInd. More... | |
void | GetFacetsBorders (const std::vector< FacetIndex > &uFacets, std::list< std::vector< PointIndex > > &rBorders) const |
Returns the boundary of the mesh to the facets uFacest. More... | |
void | GetFacetsFlag (std::vector< FacetIndex > &raulInds, MeshFacet::TFlagType tF) const |
Gets all facets in raulInds with the flag tF. More... | |
void | GetFacetsFromPlane (const MeshFacetGrid &rclGrid, const Base::Vector3f &clNormal, float dist, const Base::Vector3f &rclLeft, const Base::Vector3f &rclRight, std::vector< FacetIndex > &rclRes) const |
Gets all facets that cut the plane (N,d) and that lie between the two points left and right. More... | |
void | GetFacetsFromToolMesh (const MeshKernel &rToolMesh, const Base::Vector3f &rcDir, const MeshFacetGrid &rGrid, std::vector< FacetIndex > &raclCutted) const |
Does basically the same as method above except it uses a mesh grid to speed up the computation. More... | |
void | GetFacetsFromToolMesh (const MeshKernel &rToolMesh, const Base::Vector3f &rcDir, std::vector< FacetIndex > &raclCutted) const |
Returns the indices of all facets that have at least one point that lies inside the tool mesh. More... | |
Base::Vector3f | GetGravityPoint () const |
Calculates the gravity point of the mesh. More... | |
float | GetMaximumEdgeLength () const |
Calculates the maximum length of edges. More... | |
void | GetMeshBorders (std::list< std::vector< Base::Vector3f > > &rclBorders) const |
Returns all boundaries of the mesh. More... | |
void | GetMeshBorders (std::list< std::vector< PointIndex > > &rclBorders) const |
Returns all boundaries of the mesh. More... | |
float | GetMinimumEdgeLength () const |
Calculates the minimum length of edges. More... | |
void | GetPointsFlag (std::vector< PointIndex > &raulInds, MeshPoint::TFlagType tF) const |
Gets all points in raulInds with the flag tF. More... | |
bool | IsVertexVisible (const Base::Vector3f &rcVertex, const Base::Vector3f &rcView, const MeshFacetGrid &rclGrid) const |
Checks from the viewpoint rcView if the vertex rcVertex is visible or it is hidden by a facet. More... | |
MeshAlgorithm (const MeshKernel &rclM) | |
Construction. More... | |
bool | NearestFacetOnRay (const Base::Vector3f &rclPt, const Base::Vector3f &rclDir, Base::Vector3f &rclRes, FacetIndex &rulFacet) const |
Searches for the nearest facet to the ray defined by (rclPt, rclDir). More... | |
bool | NearestFacetOnRay (const Base::Vector3f &rclPt, const Base::Vector3f &rclDir, const MeshFacetGrid &rclGrid, Base::Vector3f &rclRes, FacetIndex &rulFacet) const |
Searches for the nearest facet to the ray defined by (rclPt, rclDir). More... | |
bool | NearestFacetOnRay (const Base::Vector3f &rclPt, const Base::Vector3f &rclDir, const std::vector< FacetIndex > &raulFacets, Base::Vector3f &rclRes, FacetIndex &rulFacet) const |
Searches for the nearest facet to the ray defined by (rclPt, rclDir). More... | |
bool | NearestFacetOnRay (const Base::Vector3f &rclPt, const Base::Vector3f &rclDir, float fMaxAngle, Base::Vector3f &rclRes, FacetIndex &rulFacet) const |
Searches for the nearest facet to the ray defined by (rclPt, rclDir). More... | |
bool | NearestFacetOnRay (const Base::Vector3f &rclPt, const Base::Vector3f &rclDir, float fMaxSearchArea, const MeshFacetGrid &rclGrid, Base::Vector3f &rclRes, FacetIndex &rulFacet) const |
Searches for the nearest facet to the ray defined by (rclPt, rclDir). More... | |
bool | NearestPointFromPoint (const Base::Vector3f &rclPt, const MeshFacetGrid &rclGrid, FacetIndex &rclResFacetIndex, Base::Vector3f &rclResPoint) const |
bool | NearestPointFromPoint (const Base::Vector3f &rclPt, const MeshFacetGrid &rclGrid, float fMaxSearchArea, FacetIndex &rclResFacetIndex, Base::Vector3f &rclResPoint) const |
bool | NearestPointFromPoint (const Base::Vector3f &rclPt, FacetIndex &rclResFacetIndex, Base::Vector3f &rclResPoint) const |
Projects a point directly to the mesh (means nearest facet), the result is the facet index and the foraminate point, use second version with grid for more performance. More... | |
void | PointsFromFacetsIndices (const std::vector< FacetIndex > &rvecIndices, std::vector< Base::Vector3f > &rvecPoints) const |
Returns all geometric points from the facets in rvecIndices. More... | |
void | ResetFacetFlag (MeshFacet::TFlagType tF) const |
Resets of all facets the flag tF. More... | |
void | ResetFacetsFlag (const std::vector< FacetIndex > &raulInds, MeshFacet::TFlagType tF) const |
Resets from all facets in raulInds the flag tF. More... | |
void | ResetPointFlag (MeshPoint::TFlagType tF) const |
Resets of all points the flag tF. More... | |
void | ResetPointsFlag (const std::vector< PointIndex > &raulInds, MeshPoint::TFlagType tF) const |
Resets from all points in raulInds the flag tF. More... | |
void | SearchFacetsFromPolyline (const std::vector< Base::Vector3f > &rclPolyline, float fRadius, const MeshFacetGrid &rclGrid, std::vector< FacetIndex > &rclResultFacetsIndices) const |
Searches for all facets that intersect the "search tube" with radius r around the polyline. More... | |
void | SetFacetFlag (MeshFacet::TFlagType tF) const |
Sets to all facets the flag tF. More... | |
void | SetFacetsFlag (const std::vector< FacetIndex > &raulInds, MeshFacet::TFlagType tF) const |
Sets to all facets in raulInds the flag tF. More... | |
void | SetFacetsProperty (const std::vector< FacetIndex > &raulInds, const std::vector< unsigned long > &raulProps) const |
Sets to all facets in raulInds the properties in raulProps. More... | |
void | SetPointFlag (MeshPoint::TFlagType tF) const |
Sets to all points the flag tF. More... | |
void | SetPointsFlag (const std::vector< PointIndex > &raulInds, MeshPoint::TFlagType tF) const |
Sets to all points in raulInds the flag tF. More... | |
void | SplitBoundaryLoops (std::list< std::vector< PointIndex > > &aBorders) |
Boundaries that consist of several loops must be split in several independent boundaries to perform e.g. More... | |
void | SubSampleAllPoints (std::vector< Base::Vector3f > &rclPoints) const |
Returns only the points of the mesh without actually sampling the data. More... | |
void | SubSampleByCount (unsigned long ulCtPoints, std::vector< Base::Vector3f > &rclPoints) const |
Subsamples the mesh to produce around ulCtPoints. More... | |
void | SubSampleByDist (float fDist, std::vector< Base::Vector3f > &rclPoints) const |
Subsamples the mesh with point distance fDist and stores the points in rclPoints. More... | |
float | Surface () const |
Computes the surface of the mesh. More... | |
int | Surround (const Base::BoundBox3f &rBox, const Base::Vector3f &rcDir) |
Checks whether the bounding box rBox is surrounded by the attached mesh which must be a solid. More... | |
~MeshAlgorithm () | |
Destruction. More... | |
Protected Member Functions | |
bool | ConnectLines (std::list< std::pair< Base::Vector3f, Base::Vector3f > > &rclLines, std::list< std::vector< Base::Vector3f > > &rclPolylines, float fMinEps) const |
Helper method to connect the intersection points to polylines. More... | |
bool | ConnectPolygons (std::list< std::vector< Base::Vector3f > > &clPolyList, std::list< std::pair< Base::Vector3f, Base::Vector3f > > &rclLines) const |
bool | RayNearestField (const Base::Vector3f &rclPt, const Base::Vector3f &rclDir, const std::vector< FacetIndex > &raulFacets, Base::Vector3f &rclRes, FacetIndex &rulFacet, float fMaxAngle=Mathf::PI) const |
Searches the nearest facet in raulFacets to the ray (rclPt, rclDir). More... | |
void | SplitBoundaryFromOpenEdges (std::list< std::pair< PointIndex, PointIndex > > &openEdges, std::list< PointIndex > &boundary) const |
From the given openEdges a boundary is split and added to boundary. More... | |
void | SplitBoundaryLoops (const std::vector< PointIndex > &rBound, std::list< std::vector< PointIndex > > &aBorders) |
Splits the boundary rBound in several loops and append this loops to the list of borders. More... | |
The MeshAlgorithm class provides algorithms base on meshes.
MeshCore::MeshAlgorithm::MeshAlgorithm | ( | const MeshKernel & | rclM | ) |
Construction.
MeshCore::MeshAlgorithm::~MeshAlgorithm | ( | ) |
Destruction.
float MeshAlgorithm::CalculateMinimumGridLength | ( | float | fLength, |
const Base::BoundBox3f & | rBBox, | ||
unsigned long | maxElements | ||
) | const |
Calculates the minimum grid length so that not more elements than maxElements will be created when the grid gets built up.
The minimum grid length must be at least fLength.
References Base::BoundBox3< _Precision >::LengthX(), Base::BoundBox3< _Precision >::LengthY(), and Base::BoundBox3< _Precision >::LengthZ().
void MeshAlgorithm::CheckBorderFacets | ( | const std::vector< FacetIndex > & | raclFacetIndices, |
std::vector< FacetIndex > & | raclResultIndices, | ||
unsigned short | usLevel = 1 |
||
) | const |
Determines all facets of the given array raclFacetIndices that lie at the edge or that have at least neighbour facet that is not inside the array.
The resulting array raclResultIndices is not be deleted before the algorithm starts. usLevel indicates how often the algorithm is repeated.
References MeshCore::FACET_INDEX_MAX, ResetFacetFlag(), MeshCore::MeshFacetArray::ResetFlag(), SetFacetsFlag(), and MeshCore::MeshFacet::TMP0.
Referenced by CutBorderFacets().
void MeshAlgorithm::CheckFacets | ( | const Base::ViewProjMethod * | pclProj, |
const Base::Polygon2d & | rclPoly, | ||
bool | bInner, | ||
std::vector< FacetIndex > & | rclRes | ||
) | const |
Does the same as the above method unless that it doesn't use a grid.
References Base::Polygon2d::CalcBoundBox(), Base::Polygon2d::Contains(), Base::BoundBox2d::Contains(), Base::ViewProjMethod::getComposedProjectionMatrix(), Base::Vector3< _Precision >::x, and Base::Vector3< _Precision >::y.
void MeshAlgorithm::CheckFacets | ( | const MeshFacetGrid & | rclGrid, |
const Base::ViewProjMethod * | pclProj, | ||
const Base::Polygon2d & | rclPoly, | ||
bool | bInner, | ||
std::vector< FacetIndex > & | rclRes | ||
) | const |
Projects the determined facets through projection with pclProj into the 2D plane and checks for intersection with the polygon.
If bInner is true than all facets with at least one corner inside the polygon get deleted. If bInner is false then all facets with at least one corner outside the polygon get deleted. This algorithm is optimized by using a grid.
References Base::Polygon2d::CalcBoundBox(), Base::Polygon2d::Contains(), Base::BoundBox2d::Contains(), MeshCore::MeshGridIterator::GetBoundBox(), Base::ViewProjMethod::getComposedProjectionMatrix(), MeshCore::MeshGridIterator::GetElements(), MeshCore::MeshGridIterator::Init(), MeshCore::MeshFacetIterator::Init(), Base::BoundBox2d::Intersect(), MeshCore::MeshGridIterator::More(), MeshCore::MeshFacetIterator::More(), MeshCore::MeshGridIterator::Next(), MeshCore::MeshFacetIterator::Next(), Base::SequencerLauncher::next(), MeshCore::MeshFacetIterator::Position(), Base::Vector3< _Precision >::Set(), Base::Vector3< _Precision >::x, and Base::Vector3< _Precision >::y.
Referenced by Mesh::MeshObject::cut(), and MeshGui::ViewProviderMesh::getFacetsFromPolygon().
|
protected |
Helper method to connect the intersection points to polylines.
References Base::DistanceP2().
Referenced by CutWithPlane().
|
protected |
References Base::Distance().
Referenced by CutWithPlane().
unsigned long MeshAlgorithm::CountBorderEdges | ( | ) | const |
Returns the number of border edges.
References MeshCore::FACET_INDEX_MAX.
unsigned long MeshAlgorithm::CountFacetFlag | ( | MeshFacet::TFlagType | tF | ) | const |
Count all facets with the flag tF.
Referenced by Mesh::MeshObject::countSelectedFacets(), ReverseEngineeringGui::SegmentationManual::createSegment(), MeshCore::MeshSegmentAlgorithm::FindSegments(), GetFacetsFlag(), and MeshCore::MeshComponents::SearchForComponents().
unsigned long MeshAlgorithm::CountPointFlag | ( | MeshPoint::TFlagType | tF | ) | const |
Count all points with the flag tF.
Referenced by Mesh::MeshObject::countSelectedPoints(), and GetPointsFlag().
void MeshAlgorithm::CutBorderFacets | ( | std::vector< FacetIndex > & | raclFacetIndices, |
unsigned short | usLevel = 1 |
||
) | const |
Invokes CheckBorderFacets() to get all border facets of raclFacetIndices.
Then the content of raclFacetIndices is replaced by all facets that can be deleted.
References CheckBorderFacets().
bool MeshAlgorithm::CutWithPlane | ( | const Base::Vector3f & | clBase, |
const Base::Vector3f & | clNormal, | ||
const MeshFacetGrid & | rclGrid, | ||
std::list< std::vector< Base::Vector3f > > & | rclResult, | ||
float | fMinEps = 1.0e-2f , |
||
bool | bConnectPolygons = false |
||
) | const |
Cuts the mesh with a plane.
The result is a list of polylines.
References ConnectLines(), ConnectPolygons(), MeshCore::MeshGridIterator::GetBoundBox(), MeshCore::MeshGridIterator::GetElements(), MeshCore::MeshGridIterator::Init(), MeshCore::MeshGeomFacet::IntersectWithPlane(), Base::BoundBox3< _Precision >::IsCutPlane(), MeshCore::MeshGridIterator::More(), and MeshCore::MeshGridIterator::Next().
Referenced by Mesh::MeshObject::crossSections(), and MeshPartGui::MeshCrossSection::section().
bool MeshAlgorithm::Distance | ( | const Base::Vector3f & | rclPt, |
FacetIndex | ulFacetIdx, | ||
float | fMaxDistance, | ||
float & | rfDistance | ||
) | const |
Returns true if the distance from the rclPt to the facet ulFacetIdx is less than fMaxDistance.
If this restriction is met rfDistance is set to the actual distance, otherwise false is returned.
Referenced by MeshCore::MeshFacetGrid::SearchNearestFromPoint().
bool MeshAlgorithm::FillupHole | ( | const std::vector< PointIndex > & | boundary, |
AbstractPolygonTriangulator & | cTria, | ||
MeshFacetArray & | rFaces, | ||
MeshPointArray & | rPoints, | ||
int | level, | ||
const MeshRefPointToFacets * | pP2FStructure = nullptr |
||
) | const |
Fills up the single boundary if it is a hole with high quality triangles and a maximum area of fMaxArea.
The triangulation information is stored in rFaces and rPoints. To speed up the calculations the optional parameter pStructure can be specified that holds a facet-to-points structure of the underlying mesh. If the boundary is not a hole or the algorithm failed false is returned, otherwise true.
References MeshCore::TriangulationVerifier::Accept(), MeshCore::AbstractPolygonTriangulator::AddedPoints(), Base::Console(), MeshCore::AbstractPolygonTriangulator::Discard(), MeshCore::AbstractPolygonTriangulator::GetFacets(), MeshCore::MeshGeomFacet::GetNormal(), MeshCore::AbstractPolygonTriangulator::GetPolygon(), MeshCore::AbstractPolygonTriangulator::GetTriangle(), MeshCore::AbstractPolygonTriangulator::GetVerifier(), Base::ConsoleSingleton::Log(), MeshCore::TriangulationVerifier::MustFlip(), MeshCore::AbstractPolygonTriangulator::NeedsReindexing(), MeshCore::MeshRefPointToFacets::NeighbourPoints(), MeshCore::AbstractPolygonTriangulator::PostProcessing(), MeshCore::AbstractPolygonTriangulator::SetIndices(), MeshCore::AbstractPolygonTriangulator::SetPolygon(), MeshCore::MeshFacet::Side(), and MeshCore::AbstractPolygonTriangulator::TriangulatePolygon().
Referenced by MeshGui::ViewProviderMesh::fillHole(), and MeshCore::MeshTopoAlgorithm::FillupHoles().
bool MeshAlgorithm::FirstFacetToVertex | ( | const Base::Vector3f & | rclPt, |
float | fMaxDistance, | ||
const MeshFacetGrid & | rclGrid, | ||
FacetIndex & | rulFacet | ||
) | const |
Searches for the first facet of the grid element (rclGrid) in that the point rclPt lies into which is a distance not higher than fMaxDistance.
Of no such facet is found rulFacet is undefined and false is returned, otherwise true.
References MeshCore::MeshGrid::GetElements(), MeshCore::MeshGeomFacet::IsPointOfFace(), MeshCore::MeshGeomFacet::NearestEdgeToPoint(), and MeshCore::MeshGeomFacet::ProjectPointToPlane().
float MeshAlgorithm::GetAverageEdgeLength | ( | ) | const |
Calculates the average length of edges.
References Base::Distance(), MeshCore::MeshFacetIterator::Init(), MeshCore::MeshFacetIterator::More(), and MeshCore::MeshFacetIterator::Next().
Referenced by MeshPartGui::CurveOnMeshHandler::Private::createGrid(), MeshPart::MeshProjection::findSectionParameters(), Inspection::InspectNominalFastMesh::InspectNominalFastMesh(), Inspection::InspectNominalMesh::InspectNominalMesh(), MeshGui::SoFCMeshPickNode::notify(), MeshPart::MeshProjection::projectOnMesh(), MeshPart::MeshProjection::projectParallelToMesh(), and MeshPart::MeshProjection::projectToMesh().
void MeshAlgorithm::GetBorderPoints | ( | const std::vector< FacetIndex > & | raclFacetIndices, |
std::set< PointIndex > & | raclResultPointsIndices | ||
) | const |
Determines all border points as indices of the facets in raclFacetIndices.
The points are unsorted.
References MeshCore::FACET_INDEX_MAX, ResetFacetFlag(), SetFacetsFlag(), and MeshCore::MeshFacet::TMP0.
Referenced by MeshGui::MeshSelection::deleteSelectionBorder().
void MeshAlgorithm::GetFacetBorder | ( | FacetIndex | uFacet, |
std::list< PointIndex > & | rBorder | ||
) | const |
Returns the boundary of the mesh to the facet uFacet.
If this facet does not have an open edge the returned boundary is empty.
References MeshCore::FACET_INDEX_MAX, and SplitBoundaryFromOpenEdges().
Referenced by MeshGui::ViewProviderMesh::fillHole().
void MeshAlgorithm::GetFacetBorders | ( | const std::vector< FacetIndex > & | raulInd, |
std::list< std::vector< Base::Vector3f > > & | rclBorders | ||
) | const |
Returns all boundaries of a subset the mesh defined by raulInd.
References GetFacetBorders().
Referenced by ReverseEngineeringGui::Segmentation::accept(), GetFacetBorders(), and GetMeshBorders().
void MeshAlgorithm::GetFacetBorders | ( | const std::vector< FacetIndex > & | raulInd, |
std::list< std::vector< PointIndex > > & | rclBorders, | ||
bool | ignoreOrientation = false |
||
) | const |
Returns all boundaries of a subset the mesh defined by raulInd.
This method does basically the same as above unless that it returns the point indices of the boundaries. If ignoreOrientation is false (the default) we may get a broken boundary curve if the mesh has facets with wrong orientation. However, if ignoreOrientation is true we may get a boundary curve with wrong orientation even if the mesh is topologically correct. You should let the default value unless you exactly know what you do.
References MeshCore::FACET_INDEX_MAX, MeshCore::MeshFacet::GetEdge(), ResetFacetFlag(), MeshCore::MeshFacetArray::SetFlag(), and MeshCore::MeshFacet::VISIT.
void MeshAlgorithm::GetFacetsBorders | ( | const std::vector< FacetIndex > & | uFacets, |
std::list< std::vector< PointIndex > > & | rBorders | ||
) | const |
Returns the boundary of the mesh to the facets uFacest.
If none of the facets have an open edge the returned boundary is empty.
References MeshCore::FACET_INDEX_MAX, ResetFacetFlag(), ResetPointFlag(), SetFacetsFlag(), MeshCore::MeshPointArray::SetFlag(), SplitBoundaryFromOpenEdges(), MeshCore::MeshPoint::TMP0, and MeshCore::MeshFacet::TMP0.
void MeshAlgorithm::GetFacetsFlag | ( | std::vector< FacetIndex > & | raulInds, |
MeshFacet::TFlagType | tF | ||
) | const |
Gets all facets in raulInds with the flag tF.
References CountFacetFlag().
Referenced by ReverseEngineeringGui::Segmentation::accept(), ReverseEngineeringGui::SegmentationManual::createSegment(), Mesh::MeshObject::deleteSelectedFacets(), MeshGui::MeshSelection::deleteSelectionBorder(), and Mesh::MeshObject::getFacetsFromSelection().
void MeshAlgorithm::GetFacetsFromPlane | ( | const MeshFacetGrid & | rclGrid, |
const Base::Vector3f & | clNormal, | ||
float | dist, | ||
const Base::Vector3f & | rclLeft, | ||
const Base::Vector3f & | rclRight, | ||
std::vector< FacetIndex > & | rclRes | ||
) | const |
Gets all facets that cut the plane (N,d) and that lie between the two points left and right.
The plane is defined by it normalized normal and the signed distance to the origin.
References Base::Vector3< _Precision >::DistanceToPlane(), MeshCore::MeshGridIterator::GetBoundBox(), MeshCore::MeshGridIterator::GetElements(), MeshCore::MeshGridIterator::Init(), MeshCore::MeshGeomFacet::IntersectWithPlane(), Base::BoundBox3< _Precision >::IsCutPlane(), MeshCore::MeshGridIterator::More(), MeshCore::MeshGridIterator::Next(), and Base::Vector3< _Precision >::Normalize().
void MeshAlgorithm::GetFacetsFromToolMesh | ( | const MeshKernel & | rToolMesh, |
const Base::Vector3f & | rcDir, | ||
const MeshFacetGrid & | rGrid, | ||
std::vector< FacetIndex > & | raclCutted | ||
) | const |
Does basically the same as method above except it uses a mesh grid to speed up the computation.
References Base::Vector3< float >::epsilon(), MeshCore::MeshGeomFacet::Foraminate(), MeshCore::MeshGridIterator::GetBoundBox(), MeshCore::MeshKernel::GetBoundBox(), MeshCore::MeshGridIterator::GetElements(), MeshCore::MeshGridIterator::Init(), MeshCore::MeshFacetIterator::Init(), MeshCore::MeshGeomFacet::IsPointOfFace(), MeshCore::MeshGridIterator::More(), MeshCore::MeshFacetIterator::More(), MeshCore::MeshGridIterator::Next(), MeshCore::MeshFacetIterator::Next(), Base::SequencerLauncher::next(), MeshCore::MeshFacetIterator::Position(), MeshCore::MeshFacetIterator::Set(), and Surround().
void MeshAlgorithm::GetFacetsFromToolMesh | ( | const MeshKernel & | rToolMesh, |
const Base::Vector3f & | rcDir, | ||
std::vector< FacetIndex > & | raclCutted | ||
) | const |
Returns the indices of all facets that have at least one point that lies inside the tool mesh.
The direction dir is used to try to foraminate the facets of the tool mesh and counts the number of foraminated facets. If this number is odd the considered point lies inside otherwise outside.
References Base::Vector3< float >::epsilon(), MeshCore::MeshGeomFacet::Foraminate(), MeshCore::MeshKernel::GetBoundBox(), MeshCore::MeshFacetIterator::Init(), MeshCore::MeshGeomFacet::IsPointOfFace(), MeshCore::MeshFacetIterator::More(), MeshCore::MeshFacetIterator::Next(), Base::SequencerLauncher::next(), and MeshCore::MeshFacetIterator::Position().
Referenced by Mesh::SegmentByMesh::execute(), MeshGui::ViewProviderMeshNode::handleEvent(), MeshGui::ViewProviderMesh::segmentMesh(), and MeshGui::ViewProviderMesh::splitMesh().
Base::Vector3f MeshAlgorithm::GetGravityPoint | ( | ) | const |
Calculates the gravity point of the mesh.
References MeshCore::MeshPointIterator::Init(), MeshCore::MeshPointIterator::More(), and MeshCore::MeshPointIterator::Next().
Referenced by Mesh::MeshObject::getCenterOfGravity().
float MeshAlgorithm::GetMaximumEdgeLength | ( | ) | const |
Calculates the maximum length of edges.
References Base::Distance(), MeshCore::MeshFacetIterator::Init(), MeshCore::MeshFacetIterator::More(), and MeshCore::MeshFacetIterator::Next().
void MeshAlgorithm::GetMeshBorders | ( | std::list< std::vector< Base::Vector3f > > & | rclBorders | ) | const |
Returns all boundaries of the mesh.
References GetFacetBorders().
Referenced by MeshCore::MeshTopoAlgorithm::FillupHoles(), and MeshCore::MeshTopoAlgorithm::FindHoles().
void MeshAlgorithm::GetMeshBorders | ( | std::list< std::vector< PointIndex > > & | rclBorders | ) | const |
Returns all boundaries of the mesh.
This method does basically the same as above unless that it returns the point indices of the boundaries.
References GetFacetBorders().
float MeshAlgorithm::GetMinimumEdgeLength | ( | ) | const |
Calculates the minimum length of edges.
References Base::Distance(), MeshCore::MeshFacetIterator::Init(), MeshCore::MeshFacetIterator::More(), and MeshCore::MeshFacetIterator::Next().
void MeshAlgorithm::GetPointsFlag | ( | std::vector< PointIndex > & | raulInds, |
MeshPoint::TFlagType | tF | ||
) | const |
Gets all points in raulInds with the flag tF.
References CountPointFlag().
Referenced by Mesh::MeshObject::deleteSelectedPoints(), and Mesh::MeshObject::getPointsFromSelection().
bool MeshAlgorithm::IsVertexVisible | ( | const Base::Vector3f & | rcVertex, |
const Base::Vector3f & | rcView, | ||
const MeshFacetGrid & | rclGrid | ||
) | const |
Checks from the viewpoint rcView if the vertex rcVertex is visible or it is hidden by a facet.
If the vertex is visible true is returned, false otherwise.
References Base::Distance(), Base::Vector3< _Precision >::Length(), and NearestFacetOnRay().
Referenced by MeshGui::Vertex::visible().
bool MeshAlgorithm::NearestFacetOnRay | ( | const Base::Vector3f & | rclPt, |
const Base::Vector3f & | rclDir, | ||
Base::Vector3f & | rclRes, | ||
FacetIndex & | rulFacet | ||
) | const |
Searches for the nearest facet to the ray defined by (rclPt, rclDir).
The point rclRes holds the intersection point with the ray and the nearest facet with index rulFacet.
References NearestFacetOnRay(), and MeshCore::Math< Prec >::PI.
Referenced by IsVertexVisible(), NearestFacetOnRay(), MeshGui::SoFCMeshPickNode::pick(), MeshPart::MeshProjection::projectOnMesh(), and MeshPart::MeshProjection::projectParallelToMesh().
bool MeshAlgorithm::NearestFacetOnRay | ( | const Base::Vector3f & | rclPt, |
const Base::Vector3f & | rclDir, | ||
const MeshFacetGrid & | rclGrid, | ||
Base::Vector3f & | rclRes, | ||
FacetIndex & | rulFacet | ||
) | const |
Searches for the nearest facet to the ray defined by (rclPt, rclDir).
The point rclRes holds the intersection point with the ray and the nearest facet with index rulFacet.
References MeshCore::MeshGridIterator::InitOnRay(), MeshCore::MeshGridIterator::NextOnRay(), and RayNearestField().
bool MeshAlgorithm::NearestFacetOnRay | ( | const Base::Vector3f & | rclPt, |
const Base::Vector3f & | rclDir, | ||
const std::vector< FacetIndex > & | raulFacets, | ||
Base::Vector3f & | rclRes, | ||
FacetIndex & | rulFacet | ||
) | const |
Searches for the nearest facet to the ray defined by (rclPt, rclDir).
The point rclRes holds the intersection point with the ray and the nearest facet with index rulFacet.
References MeshCore::MeshGeomFacet::Foraminate().
bool MeshAlgorithm::NearestFacetOnRay | ( | const Base::Vector3f & | rclPt, |
const Base::Vector3f & | rclDir, | ||
float | fMaxAngle, | ||
Base::Vector3f & | rclRes, | ||
FacetIndex & | rulFacet | ||
) | const |
Searches for the nearest facet to the ray defined by (rclPt, rclDir).
The point rclRes holds the intersection point with the ray and the nearest facet with index rulFacet. The angle between the ray and the normal of the triangle must be less than or equal to fMaxAngle.
References MeshCore::MeshGeomFacet::Foraminate(), MeshCore::MeshFacetIterator::Init(), MeshCore::MeshFacetIterator::More(), MeshCore::MeshFacetIterator::Next(), and MeshCore::MeshFacetIterator::Position().
bool MeshAlgorithm::NearestFacetOnRay | ( | const Base::Vector3f & | rclPt, |
const Base::Vector3f & | rclDir, | ||
float | fMaxSearchArea, | ||
const MeshFacetGrid & | rclGrid, | ||
Base::Vector3f & | rclRes, | ||
FacetIndex & | rulFacet | ||
) | const |
Searches for the nearest facet to the ray defined by (rclPt, rclDir).
The point rclRes holds the intersection point with the ray and the nearest facet with index rulFacet. More a search radius around the ray of fMaxSearchArea is defined.
References MeshCore::MeshGridIterator::InitOnRay(), MeshCore::MeshGridIterator::NextOnRay(), and RayNearestField().
bool MeshAlgorithm::NearestPointFromPoint | ( | const Base::Vector3f & | rclPt, |
const MeshFacetGrid & | rclGrid, | ||
FacetIndex & | rclResFacetIndex, | ||
Base::Vector3f & | rclResPoint | ||
) | const |
bool MeshAlgorithm::NearestPointFromPoint | ( | const Base::Vector3f & | rclPt, |
const MeshFacetGrid & | rclGrid, | ||
float | fMaxSearchArea, | ||
FacetIndex & | rclResFacetIndex, | ||
Base::Vector3f & | rclResPoint | ||
) | const |
bool MeshAlgorithm::NearestPointFromPoint | ( | const Base::Vector3f & | rclPt, |
FacetIndex & | rclResFacetIndex, | ||
Base::Vector3f & | rclResPoint | ||
) | const |
Projects a point directly to the mesh (means nearest facet), the result is the facet index and the foraminate point, use second version with grid for more performance.
References MeshCore::MeshGeomFacet::DistanceToPoint(), MeshCore::FACET_INDEX_MAX, MeshCore::MeshFacetIterator::Init(), MeshCore::MeshFacetIterator::More(), MeshCore::MeshFacetIterator::Next(), and MeshCore::MeshFacetIterator::Position().
void MeshAlgorithm::PointsFromFacetsIndices | ( | const std::vector< FacetIndex > & | rvecIndices, |
std::vector< Base::Vector3f > & | rvecPoints | ||
) | const |
Returns all geometric points from the facets in rvecIndices.
|
protected |
Searches the nearest facet in raulFacets to the ray (rclPt, rclDir).
Referenced by NearestFacetOnRay().
void MeshAlgorithm::ResetFacetFlag | ( | MeshFacet::TFlagType | tF | ) | const |
Resets of all facets the flag tF.
Referenced by CheckBorderFacets(), Mesh::MeshObject::clearFacetSelection(), MeshGui::MeshSelection::deleteSelectionBorder(), MeshGui::ViewProviderMesh::deselectComponent(), MeshCore::MeshSegmentAlgorithm::FindSegments(), GetBorderPoints(), GetFacetBorders(), GetFacetsBorders(), MeshCore::MeshEvalOrientation::GetIndices(), MeshCore::MeshSearchNeighbours::MeshSearchNeighbours(), MeshCore::MeshSearchNeighbours::Reinit(), MeshGui::ViewProviderMesh::selectComponent(), and Mesh::MeshObject::splitEdges().
void MeshAlgorithm::ResetFacetsFlag | ( | const std::vector< FacetIndex > & | raulInds, |
MeshFacet::TFlagType | tF | ||
) | const |
Resets from all facets in raulInds the flag tF.
Referenced by ReverseEngineeringGui::Segmentation::accept(), Mesh::SegmentByMesh::execute(), MeshCore::MeshSegmentAlgorithm::FindSegments(), MeshCore::MeshSearchNeighbourFacetsVisitor::GetAndReset(), MeshCore::MeshEvalOrientation::GetIndices(), Mesh::MeshObject::removeFacetsFromSelection(), and MeshCore::MeshComponents::SearchForComponents().
void MeshAlgorithm::ResetPointFlag | ( | MeshPoint::TFlagType | tF | ) | const |
Resets of all points the flag tF.
Referenced by Mesh::MeshObject::clearPointSelection(), MeshGui::MeshSelection::deleteSelectionBorder(), GetFacetsBorders(), MeshCore::MeshSearchNeighbours::MeshSearchNeighbours(), and MeshCore::MeshSearchNeighbours::Reinit().
void MeshAlgorithm::ResetPointsFlag | ( | const std::vector< PointIndex > & | raulInds, |
MeshPoint::TFlagType | tF | ||
) | const |
Resets from all points in raulInds the flag tF.
Referenced by Mesh::MeshObject::removePointsFromSelection().
void MeshAlgorithm::SearchFacetsFromPolyline | ( | const std::vector< Base::Vector3f > & | rclPolyline, |
float | fRadius, | ||
const MeshFacetGrid & | rclGrid, | ||
std::vector< FacetIndex > & | rclResultFacetsIndices | ||
) | const |
Searches for all facets that intersect the "search tube" with radius r around the polyline.
References MeshCore::MeshGrid::Inside(), Base::Vector3< _Precision >::x, Base::Vector3< _Precision >::y, and Base::Vector3< _Precision >::z.
Referenced by MeshPart::MeshProjection::projectEdgeToEdge().
void MeshAlgorithm::SetFacetFlag | ( | MeshFacet::TFlagType | tF | ) | const |
Sets to all facets the flag tF.
Referenced by ReverseEngineeringGui::Segmentation::accept(), Mesh::SegmentByMesh::execute(), and MeshCore::MeshComponents::SearchForComponents().
void MeshAlgorithm::SetFacetsFlag | ( | const std::vector< FacetIndex > & | raulInds, |
MeshFacet::TFlagType | tF | ||
) | const |
Sets to all facets in raulInds the flag tF.
Referenced by Mesh::MeshObject::addFacetsToSelection(), CheckBorderFacets(), MeshGui::MeshSelection::deleteSelectionBorder(), GetBorderPoints(), GetFacetsBorders(), and MeshCore::MeshEvalOrientation::GetIndices().
void MeshAlgorithm::SetFacetsProperty | ( | const std::vector< FacetIndex > & | raulInds, |
const std::vector< unsigned long > & | raulProps | ||
) | const |
Sets to all facets in raulInds the properties in raulProps.
void MeshAlgorithm::SetPointFlag | ( | MeshPoint::TFlagType | tF | ) | const |
Sets to all points the flag tF.
void MeshAlgorithm::SetPointsFlag | ( | const std::vector< PointIndex > & | raulInds, |
MeshPoint::TFlagType | tF | ||
) | const |
Sets to all points in raulInds the flag tF.
Referenced by Mesh::MeshObject::addPointsToSelection(), and MeshGui::MeshSelection::deleteSelectionBorder().
|
protected |
From the given openEdges a boundary is split and added to boundary.
Referenced by GetFacetBorder(), and GetFacetsBorders().
|
protected |
Splits the boundary rBound in several loops and append this loops to the list of borders.
void MeshAlgorithm::SplitBoundaryLoops | ( | std::list< std::vector< PointIndex > > & | aBorders | ) |
Boundaries that consist of several loops must be split in several independent boundaries to perform e.g.
a polygon triangulation algorithm on them.
References MeshCore::FACET_INDEX_MAX, and SplitBoundaryLoops().
Referenced by MeshGui::ViewProviderMesh::fillHole(), MeshCore::MeshTopoAlgorithm::FillupHoles(), and SplitBoundaryLoops().
void MeshAlgorithm::SubSampleAllPoints | ( | std::vector< Base::Vector3f > & | rclPoints | ) | const |
Returns only the points of the mesh without actually sampling the data.
References MeshCore::MeshPointIterator::Init(), MeshCore::MeshPointIterator::More(), and MeshCore::MeshPointIterator::Next().
void MeshAlgorithm::SubSampleByCount | ( | unsigned long | ulCtPoints, |
std::vector< Base::Vector3f > & | rclPoints | ||
) | const |
Subsamples the mesh to produce around ulCtPoints.
ulCtPoints should be greater than 5 * number of facets.
References SubSampleByDist(), and Surface().
void MeshAlgorithm::SubSampleByDist | ( | float | fDist, |
std::vector< Base::Vector3f > & | rclPoints | ||
) | const |
Subsamples the mesh with point distance fDist and stores the points in rclPoints.
References MeshCore::MeshGeomFacet::GetGravityPoint(), MeshCore::MeshFacetIterator::Init(), MeshCore::MeshFacetIterator::More(), MeshCore::MeshFacetIterator::Next(), and MeshCore::MeshGeomFacet::SubSample().
Referenced by SubSampleByCount().
float MeshAlgorithm::Surface | ( | ) | const |
Computes the surface of the mesh.
References MeshCore::MeshGeomFacet::Area(), MeshCore::MeshFacetIterator::Init(), MeshCore::MeshFacetIterator::More(), and MeshCore::MeshFacetIterator::Next().
Referenced by SubSampleByCount().
int MeshAlgorithm::Surround | ( | const Base::BoundBox3f & | rBox, |
const Base::Vector3f & | rcDir | ||
) |
Checks whether the bounding box rBox is surrounded by the attached mesh which must be a solid.
The direction rcDir is used to try to foraminate the facets of the tool mesh and counts the number of foraminated facets. 1 is returned if the box is completely inside the mesh 0 is returned if the box is partially inside (i.e. intersects) the mesh -1 is returned if the box is completely outside the mesh. This could also mean that the mesh is surrounded by rBox.
References Base::Vector3< float >::epsilon(), MeshCore::MeshGeomFacet::Foraminate(), MeshCore::MeshFacetIterator::Init(), MeshCore::MeshGeomFacet::IntersectWithFacet(), MeshCore::MeshGeomFacet::IsPointOfFace(), Base::BoundBox3< _Precision >::MaxX, Base::BoundBox3< _Precision >::MaxY, Base::BoundBox3< _Precision >::MaxZ, Base::BoundBox3< _Precision >::MinX, Base::BoundBox3< _Precision >::MinY, Base::BoundBox3< _Precision >::MinZ, MeshCore::MeshFacetIterator::More(), and MeshCore::MeshFacetIterator::Next().
Referenced by GetFacetsFromToolMesh().