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. | |
void | CheckBorderFacets (const std::vector< unsigned long > &raclFacetIndices, std::vector< unsigned long > &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. | |
void | CheckFacets (const Base::ViewProjMethod *pclProj, const Base::Polygon2D &rclPoly, bool bInner, std::vector< unsigned long > &rclRes) const |
Does the same as the above method unless that it doesn't use a grid. | |
void | CheckFacets (const MeshFacetGrid &rclGrid, const Base::ViewProjMethod *pclProj, const Base::Polygon2D &rclPoly, bool bInner, std::vector< unsigned long > &rclRes) const |
Projects the determined facets through projection with pclProj into the 2D plane and checks for intersection with the polygon. | |
unsigned long | CountBorderEdges () const |
Returns the number of border edges. | |
unsigned long | CountFacetFlag (MeshFacet::TFlagType tF) const |
Count all facets with the flag tF. | |
unsigned long | CountPointFlag (MeshPoint::TFlagType tF) const |
Count all points with the flag tF. | |
void | CutBorderFacets (std::vector< unsigned long > &raclFacetIndices, unsigned short usLevel=1) const |
Invokes CheckBorderFacets() to get all border facets of raclFacetIndices. | |
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. | |
bool | Distance (const Base::Vector3f &rclPt, unsigned long ulFacetIdx, float fMaxDistance, float &rfDistance) const |
Returns true if the distance from the rclPt to the facet ulFacetIdx is less than fMaxDistance. | |
bool | FillupHole (const std::vector< unsigned long > &boundary, AbstractPolygonTriangulator &cTria, MeshFacetArray &rFaces, MeshPointArray &rPoints, int level, const MeshRefPointToFacets *pP2FStructure=0) const |
Fills up the single boundary if it is a hole with high quality triangles and a maximum area of fMaxArea. | |
bool | FirstFacetToVertex (const Base::Vector3f &rclPt, float fMaxDistance, const MeshFacetGrid &rclGrid, unsigned long &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. | |
float | GetAverageEdgeLength () const |
Calculates the average length of edges. | |
void | GetBorderPoints (const std::vector< unsigned long > &raclFacetIndices, std::set< unsigned long > &raclResultPointsIndices) const |
Determines all border points as indices of the facets in raclFacetIndices. | |
void | GetFacetBorders (const std::vector< unsigned long > &raulInd, std::list< std::vector< unsigned long > > &rclBorders, bool ignoreOrientation=false) const |
Returns all boundaries of a subset the mesh defined by raulInd. | |
void | GetFacetBorders (const std::vector< unsigned long > &raulInd, std::list< std::vector< Base::Vector3f > > &rclBorders) const |
Returns all boundaries of a subset the mesh defined by raulInd. | |
void | GetFacetsFlag (std::vector< unsigned long > &raulInds, MeshFacet::TFlagType tF) const |
Gets all facets in raulInds with the flag tF. | |
void | GetFacetsFromPlane (const MeshFacetGrid &rclGrid, const Base::Vector3f &clNormal, float dist, const Base::Vector3f &rclLeft, const Base::Vector3f &rclRight, std::vector< unsigned long > &rclRes) const |
Gets all facets that cut the plane (N,d) and that lie between the two points left and right. | |
void | GetFacetsFromToolMesh (const MeshKernel &rToolMesh, const Base::Vector3f &rcDir, const MeshFacetGrid &rGrid, std::vector< unsigned long > &raclCutted) const |
Does basically the same as method above except it uses a mesh grid to speed up the computation. | |
void | GetFacetsFromToolMesh (const MeshKernel &rToolMesh, const Base::Vector3f &rcDir, std::vector< unsigned long > &raclCutted) const |
Returns the indices of all facets that have at least one point that lies inside the tool mesh. | |
void | GetMeshBorder (unsigned long uFacet, std::list< unsigned long > &rBorder) const |
Returns the boundary of the mesh to the facet uFacet. | |
void | GetMeshBorders (std::list< std::vector< unsigned long > > &rclBorders) const |
Returns all boundaries of the mesh. | |
void | GetMeshBorders (std::list< std::vector< Base::Vector3f > > &rclBorders) const |
Returns all boundaries of the mesh. | |
void | GetPointsFlag (std::vector< unsigned long > &raulInds, MeshPoint::TFlagType tF) const |
Gets all points in raulInds with the flag tF. | |
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. | |
MeshAlgorithm (const MeshKernel &rclM) | |
Construction. | |
bool | NearestFacetOnRay (const Base::Vector3f &rclPt, const Base::Vector3f &rclDir, float fMaxSearchArea, const MeshFacetGrid &rclGrid, Base::Vector3f &rclRes, unsigned long &rulFacet) const |
Searches for the nearest facet to the ray defined by (rclPt, rclDir). | |
bool | NearestFacetOnRay (const Base::Vector3f &rclPt, const Base::Vector3f &rclDir, const std::vector< unsigned long > &raulFacets, Base::Vector3f &rclRes, unsigned long &rulFacet) const |
Searches for the nearest facet to the ray defined by (rclPt, rclDir). | |
bool | NearestFacetOnRay (const Base::Vector3f &rclPt, const Base::Vector3f &rclDir, const MeshFacetGrid &rclGrid, Base::Vector3f &rclRes, unsigned long &rulFacet) const |
Searches for the nearest facet to the ray defined by (rclPt, rclDir). | |
bool | NearestFacetOnRay (const Base::Vector3f &rclPt, const Base::Vector3f &rclDir, Base::Vector3f &rclRes, unsigned long &rulFacet) const |
Searches for the nearest facet to the ray defined by (rclPt, rclDir). | |
bool | NearestPointFromPoint (const Base::Vector3f &rclPt, const MeshFacetGrid &rclGrid, float fMaxSearchArea, unsigned long &rclResFacetIndex, Base::Vector3f &rclResPoint) const |
bool | NearestPointFromPoint (const Base::Vector3f &rclPt, const MeshFacetGrid &rclGrid, unsigned long &rclResFacetIndex, Base::Vector3f &rclResPoint) const |
bool | NearestPointFromPoint (const Base::Vector3f &rclPt, unsigned long &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. | |
void | PointsFromFacetsIndices (const std::vector< unsigned long > &rvecIndices, std::vector< Base::Vector3f > &rvecPoints) const |
Returns all geometric points from the facets in rvecIndices. | |
void | ResetFacetFlag (MeshFacet::TFlagType tF) const |
Resets of all facets the flag tF. | |
void | ResetFacetsFlag (const std::vector< unsigned long > &raulInds, MeshFacet::TFlagType tF) const |
Resets from all facets in raulInds the flag tF. | |
void | ResetPointFlag (MeshPoint::TFlagType tF) const |
Resets of all points the flag tF. | |
void | ResetPointsFlag (const std::vector< unsigned long > &raulInds, MeshPoint::TFlagType tF) const |
Resets from all points in raulInds the flag tF. | |
void | SearchFacetsFromPolyline (const std::vector< Base::Vector3f > &rclPolyline, float fRadius, const MeshFacetGrid &rclGrid, std::vector< unsigned long > &rclResultFacetsIndices) const |
Searches for all facets that intersect the "search tube" with radius r around the polyline. | |
void | SetFacetFlag (MeshFacet::TFlagType tF) const |
Sets to all facets the flag tF. | |
void | SetFacetsFlag (const std::vector< unsigned long > &raulInds, MeshFacet::TFlagType tF) const |
Sets to all facets in raulInds the flag tF. | |
void | SetFacetsProperty (const std::vector< unsigned long > &raulInds, const std::vector< unsigned long > &raulProps) const |
Sets to all facets in raulInds the properties in raulProps. | |
void | SetPointFlag (MeshPoint::TFlagType tF) const |
Sets to all points the flag tF. | |
void | SetPointsFlag (const std::vector< unsigned long > &raulInds, MeshPoint::TFlagType tF) const |
Sets to all points in raulInds the flag tF. | |
void | SplitBoundaryLoops (std::list< std::vector< unsigned long > > &aBorders) |
Boundaries that consist of several loops must be splitted in several independent boundaries to perfoom e.g. | |
void | SubSampleAllPoints (std::vector< Base::Vector3f > &rclPoints) const |
Returns only the points of the mesh without actually sampling the data. | |
void | SubSampleByCount (unsigned long ulCtPoints, std::vector< Base::Vector3f > &rclPoints) const |
Subsamples the mesh to produce around ulCtPoints. | |
void | SubSampleByDist (float fDist, std::vector< Base::Vector3f > &rclPoints) const |
Subsamples the mesh with point distance fDist and stores the points in rclPoints. | |
float | Surface (void) const |
Computes the surface of the mesh. | |
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. | |
~MeshAlgorithm (void) | |
Destruction. | |
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. | |
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< unsigned long > &raulFacets, Base::Vector3f &rclRes, unsigned long &rulFacet, float fMaxAngle=F_PI) const |
Searches the nearest facet in raulFacets to the ray (rclPt, rclDir). | |
void | SplitBoundaryLoops (const std::vector< unsigned long > &rBound, std::list< std::vector< unsigned long > > &aBorders) |
Splits the boundary rBound in several loops and append this loops to the list of borders. | |
Protected Attributes | |
const MeshKernel & | _rclMesh |
The mesh kernel. |
The MeshAlgorithm class provides algorithms base on meshes.
Definition at line 55 of file Algorithm.h.
MeshCore::MeshAlgorithm::MeshAlgorithm | ( | const MeshKernel & | rclM | ) | [inline] |
Construction.
Definition at line 59 of file Algorithm.h.
MeshCore::MeshAlgorithm::~MeshAlgorithm | ( | void | ) | [inline] |
Destruction.
Definition at line 61 of file Algorithm.h.
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.
Definition at line 1670 of file Algorithm.cpp.
References SketcherExample::f, Base::BoundBox3< _Precision >::LengthX(), Base::BoundBox3< _Precision >::LengthY(), Base::BoundBox3< _Precision >::LengthZ(), and KDL::pow().
void MeshAlgorithm::CheckBorderFacets | ( | const std::vector< unsigned long > & | raclFacetIndices, | |
std::vector< unsigned long > & | 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.
Definition at line 1268 of file Algorithm.cpp.
References MeshCore::MeshKernel::_aclFacetArray, _rclMesh, 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< unsigned long > & | rclRes | |||
) | const |
Does the same as the above method unless that it doesn't use a grid.
Definition at line 1144 of file Algorithm.cpp.
References _rclMesh, Base::Polygon2D::Contains(), SketcherExample::f, MeshCore::MeshKernel::GetFacets(), MeshCore::MeshKernel::GetPoints(), and draftTools::p.
void MeshAlgorithm::CheckFacets | ( | const MeshFacetGrid & | rclGrid, | |
const Base::ViewProjMethod * | pclProj, | |||
const Base::Polygon2D & | rclPoly, | |||
bool | bInner, | |||
std::vector< unsigned long > & | 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.
Definition at line 1058 of file Algorithm.cpp.
References MeshCore::MeshGeomFacet::_aclPoints, _rclMesh, Base::Polygon2D::CalcBoundBox(), Base::Polygon2D::Contains(), MeshCore::MeshKernel::CountFacets(), SketcherExample::f, MeshCore::MeshGridIterator::GetBoundBox(), MeshCore::MeshGridIterator::GetElements(), MeshCore::MeshKernel::GetFacet(), MeshCore::MeshFacetIterator::Init(), MeshCore::MeshGridIterator::Init(), MeshCore::MeshFacetIterator::More(), MeshCore::MeshGridIterator::More(), MeshCore::MeshFacetIterator::Next(), MeshCore::MeshGridIterator::Next(), MeshCore::MeshFacetIterator::Position(), Base::Vector3< _Precision >::Set(), Base::Vector3< _Precision >::x, and Base::Vector3< _Precision >::y.
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.
Definition at line 1435 of file Algorithm.cpp.
References Base::DistanceP2().
Referenced by CutWithPlane().
bool MeshAlgorithm::ConnectPolygons | ( | std::list< std::vector< Base::Vector3f > > & | clPolyList, | |
std::list< std::pair< Base::Vector3f, Base::Vector3f > > & | rclLines | |||
) | const [protected] |
Definition at line 1559 of file Algorithm.cpp.
References Base::Distance(), and Distance().
Referenced by CutWithPlane().
unsigned long MeshAlgorithm::CountBorderEdges | ( | ) | const |
Returns the number of border edges.
Definition at line 1253 of file Algorithm.cpp.
References MeshCore::MeshKernel::_aclFacetArray, _rclMesh, and Sketcher::end.
unsigned long MeshAlgorithm::CountFacetFlag | ( | MeshFacet::TFlagType | tF | ) | const |
Count all facets with the flag tF.
Definition at line 848 of file Algorithm.cpp.
References MeshCore::MeshKernel::_aclFacetArray, and _rclMesh.
Referenced by GetFacetsFlag(), Mesh::MeshObject::getSegmentsFromType(), and MeshCore::MeshComponents::SearchForComponents().
unsigned long MeshAlgorithm::CountPointFlag | ( | MeshPoint::TFlagType | tF | ) | const |
Count all points with the flag tF.
Definition at line 854 of file Algorithm.cpp.
References MeshCore::MeshKernel::_aclPointArray, and _rclMesh.
Referenced by GetPointsFlag().
void MeshAlgorithm::CutBorderFacets | ( | std::vector< unsigned long > & | 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.
Definition at line 1234 of file Algorithm.cpp.
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.
Definition at line 1385 of file Algorithm.cpp.
References _rclMesh, ConnectLines(), ConnectPolygons(), MeshCore::MeshGridIterator::GetBoundBox(), MeshCore::MeshGridIterator::GetElements(), MeshCore::MeshKernel::GetFacet(), MeshCore::MeshGridIterator::Init(), Base::BoundBox3< _Precision >::IsCutPlane(), MeshCore::MeshGridIterator::More(), and MeshCore::MeshGridIterator::Next().
Referenced by Mesh::MeshObject::crossSections().
bool MeshAlgorithm::Distance | ( | const Base::Vector3f & | rclPt, | |
unsigned long | 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.
Definition at line 1650 of file Algorithm.cpp.
References MeshCore::MeshKernel::_aclFacetArray, MeshCore::MeshKernel::_aclPointArray, _rclMesh, MeshCore::MeshGeomFacet::DistanceToPoint(), and MeshCore::MeshKernel::GetFacet().
Referenced by ConnectPolygons(), IsVertexVisible(), and MeshCore::MeshFacetGrid::SearchNearestFromPoint().
bool MeshAlgorithm::FillupHole | ( | const std::vector< unsigned long > & | boundary, | |
AbstractPolygonTriangulator & | cTria, | |||
MeshFacetArray & | rFaces, | |||
MeshPointArray & | rPoints, | |||
int | level, | |||
const MeshRefPointToFacets * | pP2FStructure = 0 | |||
) | 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.
Definition at line 609 of file Algorithm.cpp.
References MeshCore::MeshKernel::_aclFacetArray, MeshCore::MeshKernel::_aclPointArray, MeshCore::MeshGeomFacet::_aclPoints, MeshCore::MeshFacet::_aulPoints, _rclMesh, MeshCore::AbstractPolygonTriangulator::AddedPoints(), Base::Console(), MeshCore::AbstractPolygonTriangulator::Discard(), SketcherExample::f, Mesh2Shape::faces, MeshCore::MeshKernel::GetFacet(), MeshCore::MeshRefPointToFacets::getFacet(), MeshCore::AbstractPolygonTriangulator::GetFacets(), MeshCore::MeshGeomFacet::GetNormal(), MeshCore::AbstractPolygonTriangulator::GetPolygon(), MeshCore::MeshFacet::IsEqual(), MeshCore::MeshRefPointToFacets::NeighbourPoints(), MeshCore::AbstractPolygonTriangulator::ProjectOntoSurface(), 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, | |||
unsigned long & | 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.
Definition at line 209 of file Algorithm.cpp.
References _rclMesh, MeshCore::MeshGrid::GetElements(), MeshCore::MeshKernel::GetFacet(), MeshCore::MeshGeomFacet::IsPointOfFace(), MeshCore::MeshGeomFacet::NearestEdgeToPoint(), and MeshCore::MeshGeomFacet::ProjectPointToPlane().
float MeshAlgorithm::GetAverageEdgeLength | ( | ) | const |
Calculates the average length of edges.
Definition at line 245 of file Algorithm.cpp.
References _rclMesh, MeshCore::MeshKernel::CountFacets(), Base::Distance(), MeshCore::MeshFacetIterator::Init(), MeshCore::MeshFacetIterator::More(), and MeshCore::MeshFacetIterator::Next().
void MeshAlgorithm::GetBorderPoints | ( | const std::vector< unsigned long > & | raclFacetIndices, | |
std::set< unsigned long > & | raclResultPointsIndices | |||
) | const |
Determines all border points as indices of the facets in raclFacetIndices.
The points are unsorted.
Definition at line 1299 of file Algorithm.cpp.
References MeshCore::MeshKernel::_aclFacetArray, MeshCore::MeshFacet::_aulNeighbours, MeshCore::MeshFacet::_aulPoints, _rclMesh, ResetFacetFlag(), SetFacetsFlag(), and MeshCore::MeshFacet::TMP0.
void MeshAlgorithm::GetFacetBorders | ( | const std::vector< unsigned long > & | raulInd, | |
std::list< std::vector< unsigned long > > & | 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.
Definition at line 389 of file Algorithm.cpp.
References MeshCore::MeshKernel::_aclFacetArray, MeshCore::MeshFacet::_aulNeighbours, _rclMesh, MeshCore::MeshFacet::GetEdge(), ResetFacetFlag(), and MeshCore::MeshFacet::VISIT.
void MeshAlgorithm::GetFacetBorders | ( | const std::vector< unsigned long > & | raulInd, | |
std::list< std::vector< Base::Vector3f > > & | rclBorders | |||
) | const |
Returns all boundaries of a subset the mesh defined by raulInd.
Definition at line 278 of file Algorithm.cpp.
References MeshCore::MeshKernel::_aclFacetArray, MeshCore::MeshKernel::_aclPointArray, MeshCore::MeshFacet::_aulNeighbours, _rclMesh, MeshCore::MeshFacet::GetEdge(), ResetFacetFlag(), and MeshCore::MeshFacet::VISIT.
Referenced by GetMeshBorders(), and SpringbackCorrection::RegionEvaluate().
void MeshAlgorithm::GetFacetsFlag | ( | std::vector< unsigned long > & | raulInds, | |
MeshFacet::TFlagType | tF | |||
) | const |
Gets all facets in raulInds with the flag tF.
Definition at line 794 of file Algorithm.cpp.
References MeshCore::MeshKernel::_aclFacetArray, _rclMesh, CountFacetFlag(), and Sketcher::end.
void MeshAlgorithm::GetFacetsFromPlane | ( | const MeshFacetGrid & | rclGrid, | |
const Base::Vector3f & | clNormal, | |||
float | dist, | |||
const Base::Vector3f & | rclLeft, | |||
const Base::Vector3f & | rclRight, | |||
std::vector< unsigned long > & | 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.
Definition at line 1593 of file Algorithm.cpp.
References MeshCore::MeshGeomFacet::_aclPoints, _rclMesh, Base::Vector3< _Precision >::DistanceToPlane(), MeshCore::MeshGridIterator::GetBoundBox(), MeshCore::MeshGridIterator::GetElements(), MeshCore::MeshKernel::GetFacet(), 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< unsigned long > & | raclCutted | |||
) | const |
Does basically the same as method above except it uses a mesh grid to speed up the computation.
Definition at line 902 of file Algorithm.cpp.
References _rclMesh, Base::Vector3< _Precision >::epsilon(), MeshCore::MeshGridIterator::GetBoundBox(), MeshCore::MeshKernel::GetBoundBox(), MeshCore::MeshGridIterator::GetElements(), MeshCore::MeshFacetIterator::Init(), MeshCore::MeshGridIterator::Init(), MeshCore::MeshFacetIterator::More(), MeshCore::MeshGridIterator::More(), MeshCore::MeshFacetIterator::Next(), MeshCore::MeshGridIterator::Next(), MeshCore::MeshFacetIterator::Position(), MeshCore::MeshFacetIterator::Set(), and Surround().
void MeshAlgorithm::GetFacetsFromToolMesh | ( | const MeshKernel & | rToolMesh, | |
const Base::Vector3f & | rcDir, | |||
std::vector< unsigned long > & | 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.
Definition at line 860 of file Algorithm.cpp.
References _rclMesh, MeshCore::MeshKernel::CountFacets(), Base::Vector3< _Precision >::epsilon(), MeshCore::MeshKernel::GetBoundBox(), MeshCore::MeshFacetIterator::Init(), MeshCore::MeshFacetIterator::More(), MeshCore::MeshFacetIterator::Next(), and MeshCore::MeshFacetIterator::Position().
Referenced by Mesh::SegmentByMesh::execute(), MeshGui::ViewProviderMesh::segmentMesh(), and MeshGui::ViewProviderMesh::splitMesh().
void MeshAlgorithm::GetMeshBorder | ( | unsigned long | uFacet, | |
std::list< unsigned long > & | 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.
Definition at line 484 of file Algorithm.cpp.
References MeshCore::MeshKernel::_aclFacetArray, and _rclMesh.
Referenced by MeshGui::ViewProviderMesh::fillHole().
void MeshAlgorithm::GetMeshBorders | ( | std::list< std::vector< unsigned long > > & | 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.
Definition at line 268 of file Algorithm.cpp.
References _rclMesh, MeshCore::MeshKernel::CountFacets(), GetFacetBorders(), and k.
void MeshAlgorithm::GetMeshBorders | ( | std::list< std::vector< Base::Vector3f > > & | rclBorders | ) | const |
Returns all boundaries of the mesh.
Definition at line 258 of file Algorithm.cpp.
References _rclMesh, MeshCore::MeshKernel::CountFacets(), GetFacetBorders(), and k.
Referenced by MeshCore::MeshTopoAlgorithm::FillupHoles(), MeshCore::MeshTopoAlgorithm::FindHoles(), SpringbackCorrection::GetBoundary(), Approximate::ParameterBoundary(), and useMesh().
void MeshAlgorithm::GetPointsFlag | ( | std::vector< unsigned long > & | raulInds, | |
MeshPoint::TFlagType | tF | |||
) | const |
Gets all points in raulInds with the flag tF.
Definition at line 805 of file Algorithm.cpp.
References MeshCore::MeshKernel::_aclPointArray, _rclMesh, CountPointFlag(), and Sketcher::end.
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.
Definition at line 46 of file Algorithm.cpp.
References Base::Distance(), Distance(), SketcherExample::f, Base::Vector3< _Precision >::Length(), and NearestFacetOnRay().
bool MeshAlgorithm::NearestFacetOnRay | ( | const Base::Vector3f & | rclPt, | |
const Base::Vector3f & | rclDir, | |||
float | fMaxSearchArea, | |||
const MeshFacetGrid & | rclGrid, | |||
Base::Vector3f & | rclRes, | |||
unsigned long & | 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.
Definition at line 125 of file Algorithm.cpp.
References SketcherExample::f, MeshCore::MeshGridIterator::InitOnRay(), MeshCore::MeshGridIterator::NextOnRay(), and RayNearestField().
bool MeshAlgorithm::NearestFacetOnRay | ( | const Base::Vector3f & | rclPt, | |
const Base::Vector3f & | rclDir, | |||
const std::vector< unsigned long > & | raulFacets, | |||
Base::Vector3f & | rclRes, | |||
unsigned long & | 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.
Definition at line 146 of file Algorithm.cpp.
References _rclMesh, MeshCore::MeshGeomFacet::Foraminate(), MeshCore::MeshKernel::GetFacet(), and Base::Length.
bool MeshAlgorithm::NearestFacetOnRay | ( | const Base::Vector3f & | rclPt, | |
const Base::Vector3f & | rclDir, | |||
const MeshFacetGrid & | rclGrid, | |||
Base::Vector3f & | rclRes, | |||
unsigned long & | 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.
Definition at line 104 of file Algorithm.cpp.
References MeshCore::MeshGridIterator::InitOnRay(), MeshCore::MeshGridIterator::NextOnRay(), and RayNearestField().
bool MeshAlgorithm::NearestFacetOnRay | ( | const Base::Vector3f & | rclPt, | |
const Base::Vector3f & | rclDir, | |||
Base::Vector3f & | rclRes, | |||
unsigned long & | 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.
Definition at line 71 of file Algorithm.cpp.
References _rclMesh, MeshCore::MeshFacetIterator::Init(), Base::Length, MeshCore::MeshFacetIterator::More(), MeshCore::MeshFacetIterator::Next(), and MeshCore::MeshFacetIterator::Position().
Referenced by UniGridApprox::CompMeshError(), best_fit::CompTotalError(), Deviation::Compute(), IsVertexVisible(), UniGridApprox::MeshOffset(), and Mesh::MeshPy::nearestFacetOnRay().
bool MeshAlgorithm::NearestPointFromPoint | ( | const Base::Vector3f & | rclPt, | |
const MeshFacetGrid & | rclGrid, | |||
float | fMaxSearchArea, | |||
unsigned long & | rclResFacetIndex, | |||
Base::Vector3f & | rclResPoint | |||
) | const |
Definition at line 1370 of file Algorithm.cpp.
References _rclMesh, MeshCore::MeshGeomFacet::DistanceToPoint(), MeshCore::MeshKernel::GetFacet(), and MeshCore::MeshFacetGrid::SearchNearestFromPoint().
bool MeshAlgorithm::NearestPointFromPoint | ( | const Base::Vector3f & | rclPt, | |
const MeshFacetGrid & | rclGrid, | |||
unsigned long & | rclResFacetIndex, | |||
Base::Vector3f & | rclResPoint | |||
) | const |
Definition at line 1354 of file Algorithm.cpp.
References _rclMesh, MeshCore::MeshGeomFacet::DistanceToPoint(), MeshCore::MeshKernel::GetFacet(), and MeshCore::MeshFacetGrid::SearchNearestFromPoint().
bool MeshAlgorithm::NearestPointFromPoint | ( | const Base::Vector3f & | rclPt, | |
unsigned long & | 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.
Definition at line 1328 of file Algorithm.cpp.
References _rclMesh, MeshCore::MeshKernel::CountFacets(), MeshCore::MeshGeomFacet::DistanceToPoint(), FLOAT_MAX, MeshCore::MeshKernel::GetFacet(), MeshCore::MeshFacetIterator::Init(), MeshCore::MeshFacetIterator::More(), MeshCore::MeshFacetIterator::Next(), and MeshCore::MeshFacetIterator::Position().
void MeshAlgorithm::PointsFromFacetsIndices | ( | const std::vector< unsigned long > & | rvecIndices, | |
std::vector< Base::Vector3f > & | rvecPoints | |||
) | const |
Returns all geometric points from the facets in rvecIndices.
Definition at line 1632 of file Algorithm.cpp.
References MeshCore::MeshKernel::_aclFacetArray, MeshCore::MeshKernel::_aclPointArray, and _rclMesh.
bool MeshAlgorithm::RayNearestField | ( | const Base::Vector3f & | rclPt, | |
const Base::Vector3f & | rclDir, | |||
const std::vector< unsigned long > & | raulFacets, | |||
Base::Vector3f & | rclRes, | |||
unsigned long & | rulFacet, | |||
float | fMaxAngle = F_PI | |||
) | const [protected] |
Searches the nearest facet in raulFacets to the ray (rclPt, rclDir).
Definition at line 178 of file Algorithm.cpp.
References _rclMesh, MeshCore::MeshGeomFacet::Foraminate(), MeshCore::MeshKernel::GetFacet(), and Base::Length.
Referenced by NearestFacetOnRay().
void MeshAlgorithm::ResetFacetFlag | ( | MeshFacet::TFlagType | tF | ) | const |
Resets of all facets the flag tF.
Definition at line 838 of file Algorithm.cpp.
References MeshCore::MeshKernel::_aclFacetArray, _rclMesh, and MeshCore::MeshFacetArray::ResetFlag().
Referenced by CheckBorderFacets(), GetBorderPoints(), GetFacetBorders(), MeshCore::MeshEvalOrientation::GetIndices(), Mesh::MeshObject::getSegmentsFromType(), and Mesh::MeshObject::splitEdges().
void MeshAlgorithm::ResetFacetsFlag | ( | const std::vector< unsigned long > & | raulInds, | |
MeshFacet::TFlagType | tF | |||
) | const |
Resets from all facets in raulInds the flag tF.
Definition at line 816 of file Algorithm.cpp.
References MeshCore::MeshKernel::_aclFacetArray, _rclMesh, and MeshCore::MeshFacetArray::ResetFlag().
Referenced by Mesh::SegmentByMesh::execute(), MeshCore::MeshEvalOrientation::GetIndices(), Mesh::MeshObject::getSegmentsFromType(), and MeshCore::MeshComponents::SearchForComponents().
void MeshAlgorithm::ResetPointFlag | ( | MeshPoint::TFlagType | tF | ) | const |
Resets of all points the flag tF.
Definition at line 843 of file Algorithm.cpp.
References MeshCore::MeshKernel::_aclPointArray, _rclMesh, and MeshCore::MeshPointArray::ResetFlag().
void MeshAlgorithm::ResetPointsFlag | ( | const std::vector< unsigned long > & | raulInds, | |
MeshPoint::TFlagType | tF | |||
) | const |
Resets from all points in raulInds the flag tF.
Definition at line 822 of file Algorithm.cpp.
References MeshCore::MeshKernel::_aclPointArray, _rclMesh, and MeshCore::MeshPointArray::ResetFlag().
void MeshAlgorithm::SearchFacetsFromPolyline | ( | const std::vector< Base::Vector3f > & | rclPolyline, | |
float | fRadius, | |||
const MeshFacetGrid & | rclGrid, | |||
std::vector< unsigned long > & | rclResultFacetsIndices | |||
) | const |
Searches for all facets that intersect the "search tube" with radius r around the polyline.
Definition at line 1205 of file Algorithm.cpp.
References _rclMesh, MeshCore::MeshGeomFacet::DistanceToLineSegment(), MeshCore::MeshKernel::GetFacet(), MeshCore::MeshGrid::Inside(), k, Base::Vector3< _Precision >::x, Base::Vector3< _Precision >::y, and Base::Vector3< _Precision >::z.
void MeshAlgorithm::SetFacetFlag | ( | MeshFacet::TFlagType | tF | ) | const |
Sets to all facets the flag tF.
Definition at line 828 of file Algorithm.cpp.
References MeshCore::MeshKernel::_aclFacetArray, _rclMesh, and MeshCore::MeshFacetArray::SetFlag().
Referenced by Mesh::SegmentByMesh::execute(), Mesh::MeshObject::getSegmentsFromType(), and MeshCore::MeshComponents::SearchForComponents().
void MeshAlgorithm::SetFacetsFlag | ( | const std::vector< unsigned long > & | raulInds, | |
MeshFacet::TFlagType | tF | |||
) | const |
Sets to all facets in raulInds the flag tF.
Definition at line 782 of file Algorithm.cpp.
References MeshCore::MeshKernel::_aclFacetArray, _rclMesh, and MeshCore::MeshFacetArray::SetFlag().
Referenced by CheckBorderFacets(), GetBorderPoints(), and MeshCore::MeshEvalOrientation::GetIndices().
void MeshAlgorithm::SetFacetsProperty | ( | const std::vector< unsigned long > & | raulInds, | |
const std::vector< unsigned long > & | raulProps | |||
) | const |
Sets to all facets in raulInds the properties in raulProps.
Definition at line 773 of file Algorithm.cpp.
References MeshCore::MeshKernel::_aclFacetArray, _rclMesh, and MeshCore::MeshFacetArray::SetProperty().
void MeshAlgorithm::SetPointFlag | ( | MeshPoint::TFlagType | tF | ) | const |
Sets to all points the flag tF.
Definition at line 833 of file Algorithm.cpp.
References MeshCore::MeshKernel::_aclPointArray, _rclMesh, and MeshCore::MeshPointArray::SetFlag().
void MeshAlgorithm::SetPointsFlag | ( | const std::vector< unsigned long > & | raulInds, | |
MeshPoint::TFlagType | tF | |||
) | const |
Sets to all points in raulInds the flag tF.
Definition at line 788 of file Algorithm.cpp.
References MeshCore::MeshKernel::_aclPointArray, _rclMesh, and MeshCore::MeshPointArray::SetFlag().
void MeshAlgorithm::SplitBoundaryLoops | ( | const std::vector< unsigned long > & | rBound, | |
std::list< std::vector< unsigned long > > & | aBorders | |||
) | [protected] |
Splits the boundary rBound in several loops and append this loops to the list of borders.
Definition at line 584 of file Algorithm.cpp.
void MeshAlgorithm::SplitBoundaryLoops | ( | std::list< std::vector< unsigned long > > & | aBorders | ) |
Boundaries that consist of several loops must be splitted in several independent boundaries to perfoom e.g.
a polygon triangulation algorithm on them.
Definition at line 548 of file Algorithm.cpp.
References MeshCore::MeshKernel::_aclFacetArray, _rclMesh, and split.
Referenced by MeshGui::ViewProviderMesh::fillHole(), and MeshCore::MeshTopoAlgorithm::FillupHoles().
void MeshAlgorithm::SubSampleAllPoints | ( | std::vector< Base::Vector3f > & | rclPoints | ) | const |
Returns only the points of the mesh without actually sampling the data.
Definition at line 1187 of file Algorithm.cpp.
References _rclMesh, 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.
Definition at line 1199 of file Algorithm.cpp.
References KDL::sqrt(), 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.
Definition at line 1175 of file Algorithm.cpp.
References _rclMesh, MeshCore::MeshFacetIterator::Init(), k, MeshCore::MeshFacetIterator::More(), and MeshCore::MeshFacetIterator::Next().
Referenced by SubSampleByCount().
float MeshAlgorithm::Surface | ( | void | ) | const |
Computes the surface of the mesh.
Definition at line 1164 of file Algorithm.cpp.
References _rclMesh, 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.
Definition at line 989 of file Algorithm.cpp.
References _rclMesh, Base::Vector3< _Precision >::epsilon(), MeshCore::MeshKernel::GetBoundBox(), MeshCore::MeshFacetIterator::Init(), 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().
const MeshKernel& MeshCore::MeshAlgorithm::_rclMesh [protected] |
The mesh kernel.
Definition at line 310 of file Algorithm.h.
Referenced by CheckBorderFacets(), CheckFacets(), CountBorderEdges(), CountFacetFlag(), CountPointFlag(), CutWithPlane(), Distance(), FillupHole(), FirstFacetToVertex(), GetAverageEdgeLength(), GetBorderPoints(), GetFacetBorders(), GetFacetsFlag(), GetFacetsFromPlane(), GetFacetsFromToolMesh(), GetMeshBorder(), GetMeshBorders(), GetPointsFlag(), NearestFacetOnRay(), NearestPointFromPoint(), PointsFromFacetsIndices(), RayNearestField(), ResetFacetFlag(), ResetFacetsFlag(), ResetPointFlag(), ResetPointsFlag(), SearchFacetsFromPolyline(), SetFacetFlag(), SetFacetsFlag(), SetFacetsProperty(), SetPointFlag(), SetPointsFlag(), SplitBoundaryLoops(), SubSampleAllPoints(), SubSampleByDist(), Surface(), and Surround().