MeshCore::MeshAlgorithm Class Reference

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...
 

Detailed Description

The MeshAlgorithm class provides algorithms base on meshes.

Constructor & Destructor Documentation

◆ MeshAlgorithm()

MeshCore::MeshAlgorithm::MeshAlgorithm ( const MeshKernel rclM)

Construction.

◆ ~MeshAlgorithm()

MeshCore::MeshAlgorithm::~MeshAlgorithm ( )

Destruction.

Member Function Documentation

◆ CalculateMinimumGridLength()

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().

◆ CheckBorderFacets()

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().

◆ CheckFacets() [1/2]

void MeshAlgorithm::CheckFacets ( const Base::ViewProjMethod pclProj,
const Base::Polygon2d rclPoly,
bool  bInner,
std::vector< FacetIndex > &  rclRes 
) const

◆ CheckFacets() [2/2]

void MeshAlgorithm::CheckFacets ( const MeshFacetGrid rclGrid,
const Base::ViewProjMethod pclProj,
const Base::Polygon2d rclPoly,
bool  bInner,
std::vector< FacetIndex > &  rclRes 
) const

◆ ConnectLines()

bool MeshAlgorithm::ConnectLines ( std::list< std::pair< Base::Vector3f, Base::Vector3f > > &  rclLines,
std::list< std::vector< Base::Vector3f > > &  rclPolylines,
float  fMinEps 
) const
protected

Helper method to connect the intersection points to polylines.

References Base::DistanceP2().

Referenced by CutWithPlane().

◆ ConnectPolygons()

bool MeshAlgorithm::ConnectPolygons ( std::list< std::vector< Base::Vector3f > > &  clPolyList,
std::list< std::pair< Base::Vector3f, Base::Vector3f > > &  rclLines 
) const
protected

References Base::Distance().

Referenced by CutWithPlane().

◆ CountBorderEdges()

unsigned long MeshAlgorithm::CountBorderEdges ( ) const

Returns the number of border edges.

References MeshCore::FACET_INDEX_MAX.

◆ CountFacetFlag()

◆ CountPointFlag()

unsigned long MeshAlgorithm::CountPointFlag ( MeshPoint::TFlagType  tF) const

Count all points with the flag tF.

Referenced by Mesh::MeshObject::countSelectedPoints(), and GetPointsFlag().

◆ CutBorderFacets()

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.

Note
The mesh structure is not modified by this method. This is in the responsibility of the user.

References CheckBorderFacets().

◆ CutWithPlane()

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

◆ Distance()

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().

◆ FillupHole()

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.

Note
boundary contains the point indices of the mesh data structure. The first and last index must therefore be equal.
rPoints contains the geometric points of the triangulation. The number of points can be the same as or exceed the number of boundary indices but it cannot be lower.
If the number of geometric points exceeds the number of boundary indices then the triangulation algorithm has introduced new points which are added to the end of rPoints.

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().

◆ FirstFacetToVertex()

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.

Note
If the point rclPt is outside of the grid rclGrid nothing is done.

References MeshCore::MeshGrid::GetElements(), MeshCore::MeshGeomFacet::IsPointOfFace(), MeshCore::MeshGeomFacet::NearestEdgeToPoint(), and MeshCore::MeshGeomFacet::ProjectPointToPlane().

◆ GetAverageEdgeLength()

◆ GetBorderPoints()

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().

◆ GetFacetBorder()

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().

◆ GetFacetBorders() [1/2]

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().

◆ GetFacetBorders() [2/2]

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.

◆ GetFacetsBorders()

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.

◆ GetFacetsFlag()

◆ GetFacetsFromPlane()

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

◆ GetFacetsFromToolMesh() [1/2]

◆ GetFacetsFromToolMesh() [2/2]

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.

Note
The tool mesh must be a valid solid.
It's not tested if rToolMesh is a valid solid. In case it is not the result is undefined.

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().

◆ GetGravityPoint()

Base::Vector3f MeshAlgorithm::GetGravityPoint ( ) const

◆ GetMaximumEdgeLength()

float MeshAlgorithm::GetMaximumEdgeLength ( ) const

◆ GetMeshBorders() [1/2]

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().

◆ GetMeshBorders() [2/2]

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().

◆ GetMinimumEdgeLength()

float MeshAlgorithm::GetMinimumEdgeLength ( ) const

◆ GetPointsFlag()

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().

◆ IsVertexVisible()

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().

◆ NearestFacetOnRay() [1/5]

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.

Note
This method tests all facets so it should only be used occasionally.

References NearestFacetOnRay(), and MeshCore::Math< Prec >::PI.

Referenced by IsVertexVisible(), NearestFacetOnRay(), MeshGui::SoFCMeshPickNode::pick(), MeshPart::MeshProjection::projectOnMesh(), and MeshPart::MeshProjection::projectParallelToMesh().

◆ NearestFacetOnRay() [2/5]

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.

Note
This method is optimized by using a grid. So this method can be used for a lot of tests.

References MeshCore::MeshGridIterator::InitOnRay(), MeshCore::MeshGridIterator::NextOnRay(), and RayNearestField().

◆ NearestFacetOnRay() [3/5]

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.

Note
This method tests all facets taken from raulFacets instead of the attached mesh. So the caller must ensure that the indices are valid facets.

References MeshCore::MeshGeomFacet::Foraminate().

◆ NearestFacetOnRay() [4/5]

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.

Note
This method tests all facets so it should only be used occasionally.

References MeshCore::MeshGeomFacet::Foraminate(), MeshCore::MeshFacetIterator::Init(), MeshCore::MeshFacetIterator::More(), MeshCore::MeshFacetIterator::Next(), and MeshCore::MeshFacetIterator::Position().

◆ NearestFacetOnRay() [5/5]

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.

Note
This method is optimized by using a grid. So this method can be used for a lot of tests.

References MeshCore::MeshGridIterator::InitOnRay(), MeshCore::MeshGridIterator::NextOnRay(), and RayNearestField().

◆ NearestPointFromPoint() [1/3]

bool MeshAlgorithm::NearestPointFromPoint ( const Base::Vector3f rclPt,
const MeshFacetGrid rclGrid,
FacetIndex rclResFacetIndex,
Base::Vector3f rclResPoint 
) const

◆ NearestPointFromPoint() [2/3]

bool MeshAlgorithm::NearestPointFromPoint ( const Base::Vector3f rclPt,
const MeshFacetGrid rclGrid,
float  fMaxSearchArea,
FacetIndex rclResFacetIndex,
Base::Vector3f rclResPoint 
) const

◆ NearestPointFromPoint() [3/3]

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().

◆ PointsFromFacetsIndices()

void MeshAlgorithm::PointsFromFacetsIndices ( const std::vector< FacetIndex > &  rvecIndices,
std::vector< Base::Vector3f > &  rvecPoints 
) const

Returns all geometric points from the facets in rvecIndices.

◆ RayNearestField()

bool MeshAlgorithm::RayNearestField ( const Base::Vector3f rclPt,
const Base::Vector3f rclDir,
const std::vector< FacetIndex > &  raulFacets,
Base::Vector3f rclRes,
FacetIndex rulFacet,
float  fMaxAngle = Mathf::PI 
) const
protected

Searches the nearest facet in raulFacets to the ray (rclPt, rclDir).

Referenced by NearestFacetOnRay().

◆ ResetFacetFlag()

◆ ResetFacetsFlag()

◆ ResetPointFlag()

◆ ResetPointsFlag()

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().

◆ SearchFacetsFromPolyline()

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().

◆ SetFacetFlag()

void MeshAlgorithm::SetFacetFlag ( MeshFacet::TFlagType  tF) const

◆ SetFacetsFlag()

void MeshAlgorithm::SetFacetsFlag ( const std::vector< FacetIndex > &  raulInds,
MeshFacet::TFlagType  tF 
) const

◆ SetFacetsProperty()

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.

Note
Both arrays must have the same size.

◆ SetPointFlag()

void MeshAlgorithm::SetPointFlag ( MeshPoint::TFlagType  tF) const

Sets to all points the flag tF.

◆ SetPointsFlag()

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().

◆ SplitBoundaryFromOpenEdges()

void MeshAlgorithm::SplitBoundaryFromOpenEdges ( std::list< std::pair< PointIndex, PointIndex > > &  openEdges,
std::list< PointIndex > &  boundary 
) const
protected

From the given openEdges a boundary is split and added to boundary.

Referenced by GetFacetBorder(), and GetFacetsBorders().

◆ SplitBoundaryLoops() [1/2]

void MeshAlgorithm::SplitBoundaryLoops ( const std::vector< PointIndex > &  rBound,
std::list< std::vector< PointIndex > > &  aBorders 
)
protected

Splits the boundary rBound in several loops and append this loops to the list of borders.

◆ SplitBoundaryLoops() [2/2]

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().

◆ SubSampleAllPoints()

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().

◆ SubSampleByCount()

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().

◆ SubSampleByDist()

void MeshAlgorithm::SubSampleByDist ( float  fDist,
std::vector< Base::Vector3f > &  rclPoints 
) const

◆ Surface()

float MeshAlgorithm::Surface ( ) const

◆ Surround()

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().


The documentation for this class was generated from the following files: