The MeshKernel class is the basic class that holds the data points, the edges and the facets describing a mesh object. More...
#include <MeshKernel.h>
Public Member Functions | |
MeshKernel () | |
Construction. More... | |
MeshKernel (const MeshKernel &rclMesh) | |
Construction. More... | |
~MeshKernel () | |
Destruction. More... | |
I/O methods | |
void | Write (std::ostream &rclOut) const |
Binary streaming of data. More... | |
void | Read (std::istream &rclIn) |
Querying | |
unsigned long | CountFacets () const |
Returns the number of facets. More... | |
unsigned long | CountEdges () const |
Returns the number of edge. More... | |
unsigned long | CountPoints () const |
unsigned int | GetMemSize () const |
Returns the number of required memory in bytes. More... | |
const Base::BoundBox3f & | GetBoundBox () const |
Determines the bounding box. More... | |
void | RecalcBoundBox () const |
Forces a recalculation of the bounding box. More... | |
MeshPoint | GetPoint (PointIndex ulIndex) const |
Returns the point at the given index. More... | |
std::vector< Base::Vector3f > | CalcVertexNormals () const |
Returns an array of the vertex normals of the mesh. More... | |
std::vector< Base::Vector3f > | GetFacetNormals (const std::vector< FacetIndex > &) const |
MeshGeomFacet | GetFacet (FacetIndex ulIndex) const |
Returns the facet at the given index. More... | |
MeshGeomFacet | GetFacet (const MeshFacet &rclFacet) const |
void | GetFacetPoints (FacetIndex ulFaIndex, PointIndex &rclP0, PointIndex &rclP1, PointIndex &rclP2) const |
Returns the point indices of the given facet index. More... | |
void | SetFacetPoints (FacetIndex ulFaIndex, PointIndex rclP0, PointIndex rclP1, PointIndex rclP2) |
Returns the point indices of the given facet index. More... | |
std::vector< PointIndex > | GetFacetPoints (const std::vector< FacetIndex > &) const |
Returns the point indices of the given facet indices. More... | |
std::vector< FacetIndex > | GetPointFacets (const std::vector< PointIndex > &) const |
Returns the facet indices that share the given point indices. More... | |
void | GetFacetNeighbours (FacetIndex ulIndex, FacetIndex &rulNIdx0, FacetIndex &rulNIdx1, FacetIndex &rulNIdx2) const |
Returns the indices of the neighbour facets of the given facet index. More... | |
std::vector< FacetIndex > | HasFacets (const MeshPointIterator &rclIter) const |
Determines all facets that are associated to this point. More... | |
bool | IsValid () const |
Returns true if the data structure is valid. More... | |
const MeshPointArray & | GetPoints () const |
Returns the array of all data points. More... | |
MeshPointArray | GetPoints (const std::vector< PointIndex > &) const |
Returns an array of points to the given indices. More... | |
MeshPointModifier | ModifyPoints () |
Returns a modifier for the point array. More... | |
const MeshFacetArray & | GetFacets () const |
Returns the array of all facets. More... | |
MeshFacetArray | GetFacets (const std::vector< FacetIndex > &) const |
Returns an array of facets to the given indices. More... | |
MeshFacetModifier | ModifyFacets () |
Returns a modifier for the facet array. More... | |
void | GetEdges (std::vector< MeshGeomEdge > &) const |
Returns the array of all edges. More... | |
Evaluation | |
float | GetSurface () const |
Calculates the surface area of the mesh object. More... | |
float | GetSurface (const std::vector< FacetIndex > &aSegment) const |
Calculates the surface area of the segment defined by aSegment. More... | |
float | GetVolume () const |
Calculates the volume of the mesh object. More... | |
bool | HasOpenEdges () const |
Checks whether the mesh has open edges. More... | |
bool | HasNonManifolds () const |
Checks whether the mesh has non.manifold edges. More... | |
bool | HasSelfIntersections () const |
Checks whether the mesh intersects itself. More... | |
Facet visitors | |
The MeshKernel class provides different methods to visit "topologic connected" facets to a given start facet. Two facets are regarded as "topologic connected" if they share a common edge or a common point. All methods expect a MeshFacetVisitor as argument that can decide to continue or to stop. If there is no topologic neighbour facet any more being not marked as "VISIT" the algorithm stops anyway. | |
unsigned long | VisitNeighbourFacets (MeshFacetVisitor &rclFVisitor, FacetIndex ulStartFacet) const |
This method visits all neighbour facets, i.e facets that share a common edge starting from the facet associated to index ulStartFacet. More... | |
unsigned long | VisitNeighbourFacetsOverCorners (MeshFacetVisitor &rclFVisitor, FacetIndex ulStartFacet) const |
Does basically the same as the method above unless the facets that share just a common point are regared as neighbours. More... | |
Point visitors | |
The MeshKernel class provides a method to visit neighbour points to a given start point. Two points are regarded as neighbours if they share an edge. The method expects a MeshPointVisitor as argument that can decide to continue or to stop. If there is no topologic neighbour point any more being not marked as "VISIT" the algorithm stops anyway. | |
unsigned long | VisitNeighbourPoints (MeshPointVisitor &rclPVisitor, PointIndex ulStartPoint) const |
This method visits all neighbour points starting from the point associated to index ulStartPoint. More... | |
Iterators | |
The iterator methods are provided for convenience. They return an iterator object that points to the first element in the appropriate list. MeshKernel mesh = ...
// iterate over all facets
for ( MeshFacetIterator it = mesh.FacetIterator(); it.More(); it.Next() )
...
An iterator can also be used in the following way MeshKernel mesh = ...
// iterate over all facets
MeshFacetIterator it(mesh);
for ( it.Init(); it.More(); it.Next() )
...
| |
MeshFacetIterator | FacetIterator () const |
Returns an iterator object to go over all facets. More... | |
MeshPointIterator | PointIterator () const |
Returns an iterator object to go over all points. More... | |
Modification | |
class | MeshPointIterator |
class | MeshFacetIterator |
class | MeshFastFacetIterator |
class | MeshAlgorithm |
class | MeshTopoAlgorithm |
class | MeshFixDuplicatePoints |
class | MeshBuilder |
class | MeshTrimming |
MeshKernel & | operator+= (const MeshGeomFacet &rclSFacet) |
Adds a single facet to the data structure. More... | |
void | AddFacet (const MeshGeomFacet &rclSFacet) |
Adds a single facet to the data structure. More... | |
MeshKernel & | operator+= (const std::vector< MeshGeomFacet > &rclFAry) |
Adds an array of facets to the data structure. More... | |
void | AddFacets (const std::vector< MeshGeomFacet > &rclFAry) |
Adds an array of facets to the data structure. More... | |
unsigned long | AddFacets (const std::vector< MeshFacet > &rclFAry, bool checkManifolds) |
Adds an array of topologic facets to the data structure without inserting new points. More... | |
unsigned long | AddFacets (const std::vector< MeshFacet > &rclFAry, const std::vector< Base::Vector3f > &rclPAry, bool checkManifolds) |
Adds new points and facets to the data structure. More... | |
void | Merge (const MeshKernel &rKernel) |
Adds all facets and referenced points to the underlying mesh structure. More... | |
void | Merge (const MeshPointArray &rPoints, const MeshFacetArray &rFaces) |
This method is provided for convenience that directly accepts the point and facet arrays. More... | |
bool | DeleteFacet (const MeshFacetIterator &rclIter) |
Deletes the facet the iterator points to. More... | |
bool | DeleteFacet (FacetIndex ulInd) |
Does basically the same as the method above unless that the index of the facet is given. More... | |
void | DeleteFacets (const std::vector< FacetIndex > &raulFacets) |
Removes several facets from the data structure. More... | |
bool | DeletePoint (const MeshPointIterator &rclIter) |
Deletes the point the iterator points to. More... | |
bool | DeletePoint (PointIndex ulInd) |
Does basically the same as the method above unless that the index of the facet is given. More... | |
void | DeletePoints (const std::vector< PointIndex > &raulPoints) |
Removes several points from the data structure. More... | |
void | RemoveInvalids () |
Removes all as INVALID marked points and facets from the structure. More... | |
void | RebuildNeighbours () |
Rebuilds the neighbour indices for all facets. More... | |
void | Cleanup () |
Removes unreferenced points or facets with invalid indices from the mesh. More... | |
void | Clear () |
Clears the whole data structure. More... | |
MeshKernel & | operator= (const std::vector< MeshGeomFacet > &rclFAry) |
Replaces the current data structure with the structure built up of the array of triangles given in rclFAry. More... | |
MeshKernel & | operator= (const MeshKernel &rclMesh) |
Assignment operator. More... | |
void | Assign (const MeshPointArray &rPoints, const MeshFacetArray &rFaces, bool checkNeighbourHood=false) |
This allows to assign the mesh structure directly. More... | |
void | Adopt (MeshPointArray &rPoints, MeshFacetArray &rFaces, bool checkNeighbourHood=false) |
This method does basically the same as Assign() unless that it swaps the content of both arrays. More... | |
void | Swap (MeshKernel &mesh) |
Swaps the content of this kernel and mesh. More... | |
void | operator*= (const Base::Matrix4D &rclMat) |
Transform the data structure with the given transformation matrix. More... | |
void | Transform (const Base::Matrix4D &rclMat) |
Transform the data structure with the given transformation matrix. More... | |
void | MovePoint (PointIndex ulPtIndex, const Base::Vector3f &rclTrans) |
Moves the point at the given index along the vector rclTrans. More... | |
void | SetPoint (PointIndex ulPtIndex, const Base::Vector3f &rPoint) |
Sets the point at the given index to the new rPoint. More... | |
void | SetPoint (PointIndex ulPtIndex, float x, float y, float z) |
Sets the point at the given index to the new rPoint. More... | |
void | Smooth (int iterations, float d_max) |
Smoothes the mesh kernel. More... | |
void | CutFacets (const MeshFacetGrid &rclGrid, const Base::ViewProjMethod *pclP, const Base::Polygon2d &rclPoly, bool bCutInner, std::vector< MeshGeomFacet > &raclFacets) |
CheckFacets() is invoked within this method and all found facets get deleted from the mesh structure. More... | |
void | CutFacets (const MeshFacetGrid &rclGrid, const Base::ViewProjMethod *pclP, const Base::Polygon2d &rclPoly, bool bCutInner, std::vector< FacetIndex > &raclCutted) |
Does basically the same as method above unless that the facets to be deleted are returned with their index number in the facet array of the mesh structure. More... | |
void | RebuildNeighbours (FacetIndex) |
Rebuilds the neighbour indices for subset of all facets from index index on. More... | |
void | ErasePoint (PointIndex ulIndex, FacetIndex ulFacetIndex, bool bOnlySetInvalid=false) |
Checks if this point is associated to no other facet and deletes if so. More... | |
void | AdjustNormal (MeshFacet &rclFacet, const Base::Vector3f &rclNormal) |
Adjusts the facet's orierntation to the given normal direction. More... | |
Base::Vector3f | GetNormal (const MeshFacet &rclFacet) const |
Calculates the normal to the given facet. More... | |
Base::Vector3f | GetGravityPoint (const MeshFacet &rclFacet) const |
Calculates the gravity point to the given facet. More... | |
The MeshKernel class is the basic class that holds the data points, the edges and the facets describing a mesh object.
The bounding box is calculated during the buildup of the data structure and gets only re-caclulated after insertion of new facets but not after removal of facets.
This class provides only some rudimental querying methods.
MeshKernel::MeshKernel | ( | ) |
Construction.
MeshKernel::MeshKernel | ( | const MeshKernel & | rclMesh | ) |
Construction.
MeshCore::MeshKernel::~MeshKernel | ( | ) |
Destruction.
void MeshKernel::AddFacet | ( | const MeshGeomFacet & | rclSFacet | ) |
Adds a single facet to the data structure.
This method is very slow and should be called occasionally only. This does the same as the += operator above.
References AdjustNormal(), and MeshCore::MeshGeomFacet::GetNormal().
Referenced by operator+=().
unsigned long MeshKernel::AddFacets | ( | const std::vector< MeshFacet > & | rclFAry, |
bool | checkManifolds | ||
) |
Adds an array of topologic facets to the data structure without inserting new points.
Facets which would create non-manifolds are not inserted. The client programmer must make sure that the referenced point indices are correct and that no geometric overlaps can be created. The method returns the total number of facets. This method might be useful to close gaps or fill up holes in a mesh.
References CountFacets(), CountPoints(), MeshCore::FACET_INDEX_MAX, MeshCore::MeshPoint::INVALID, MeshCore::MeshFacet::INVALID, and RebuildNeighbours().
unsigned long MeshKernel::AddFacets | ( | const std::vector< MeshFacet > & | rclFAry, |
const std::vector< Base::Vector3f > & | rclPAry, | ||
bool | checkManifolds | ||
) |
Adds new points and facets to the data structure.
The client programmer must make sure that all new points are referenced by the new facets. All points in rclPAry get copied at the end of the internal point array to keep their order. The point indices of the facets must be related to the internal point array, not the passed array rclPAry.
Example: We have a mesh with p points and f facets where we want append new points and facets to. Let's assume that the first facet of rclFAry references the 1st, 2nd and 3rd points of rclPAry then its indices must be p, p+1, p+2 – not 0,1,2. This is due to the fact that facets of rclFAry can also reference point indices of the internal point array.
References AddFacets().
void MeshKernel::AddFacets | ( | const std::vector< MeshGeomFacet > & | rclFAry | ) |
Adds an array of facets to the data structure.
This method keeps temporarily set properties and flags. This does the same as the += operator above.
References Merge().
Referenced by AddFacets(), MeshPart::CurveProjectorWithToolMesh::Do(), MeshPart::MeshAlgos::LoftOnCurve(), and operator+=().
|
protected |
Adjusts the facet's orierntation to the given normal direction.
References MeshCore::MeshFacet::FlipNormal().
Referenced by AddFacet().
void MeshKernel::Adopt | ( | MeshPointArray & | rPoints, |
MeshFacetArray & | rFaces, | ||
bool | checkNeighbourHood = false |
||
) |
This method does basically the same as Assign() unless that it swaps the content of both arrays.
These arrays may be empty after assigning to the kernel. This method is a convenient way to build up the mesh structure from outside and assign to a mesh kernel without copying the data. Especially for huge meshes this saves memory and increases speed.
References RebuildNeighbours(), and RecalcBoundBox().
Referenced by MeshPart::BrepMesh::create(), MeshGui::SoFCMeshNode::readInstance(), Mesh::PropertyMeshKernel::Restore(), and MeshCore::MeshSimplify::simplify().
void MeshKernel::Assign | ( | const MeshPointArray & | rPoints, |
const MeshFacetArray & | rFaces, | ||
bool | checkNeighbourHood = false |
||
) |
This allows to assign the mesh structure directly.
The caller must make sure that the point indices are correctly set but the neighbourhood gets checked and corrected if checkNeighbourHood is true.
References RebuildNeighbours(), and RecalcBoundBox().
std::vector< Base::Vector3f > MeshKernel::CalcVertexNormals | ( | ) | const |
Returns an array of the vertex normals of the mesh.
A vertex normal gets calculated by summarizing the normals of the associated facets.
References CountFacets(), CountPoints(), GetFacetPoints(), and GetPoint().
void MeshKernel::Cleanup | ( | ) |
Removes unreferenced points or facets with invalid indices from the mesh.
References MeshCore::MeshCleanup::RemoveInvalids().
void MeshKernel::Clear | ( | void | ) |
Clears the whole data structure.
unsigned long MeshKernel::CountEdges | ( | ) | const |
Returns the number of edge.
References MeshCore::FACET_INDEX_MAX.
Referenced by MeshGui::DlgEvaluateMeshImp::showInformation(), and MeshGui::PropertyMeshKernelItem::value().
unsigned long MeshCore::MeshKernel::CountFacets | ( | ) | const |
Returns the number of facets.
Referenced by AddFacets(), CalcVertexNormals(), MeshCore::MeshTrimming::CheckFacets(), MeshCore::MeshCurvature::ComputePerVertex(), MeshGui::ViewProviderMeshBuilder::createMesh(), MeshGui::ViewProviderMesh::getVisibleFacets(), MeshCore::MeshCurvature::MeshCurvature(), MeshGui::ViewProviderMesh::segmentMesh(), MeshGui::DlgEvaluateMeshImp::showInformation(), MeshGui::ViewProviderMesh::splitMesh(), MeshCore::MeshFacetGrid::Validate(), MeshGui::PropertyMeshKernelItem::value(), and Write().
unsigned long MeshCore::MeshKernel::CountPoints | ( | ) | const |
Referenced by AddFacets(), CalcVertexNormals(), MeshCore::MeshCurvature::ComputePerVertex(), MeshGui::ViewProviderMeshBuilder::createMesh(), MeshGui::ViewProviderMesh::fillHole(), MeshGui::DlgEvaluateMeshImp::showInformation(), MeshCore::PlaneFitSmoothing::Smooth(), MeshCore::PlaneFitSmoothing::SmoothPoints(), MeshCore::MeshPointGrid::Validate(), MeshGui::PropertyMeshKernelItem::value(), and Write().
void MeshKernel::CutFacets | ( | const MeshFacetGrid & | rclGrid, |
const Base::ViewProjMethod * | pclP, | ||
const Base::Polygon2d & | rclPoly, | ||
bool | bCutInner, | ||
std::vector< FacetIndex > & | raclCutted | ||
) |
Does basically the same as method above unless that the facets to be deleted are returned with their index number in the facet array of the mesh structure.
References DeleteFacets(), and MeshAlgorithm.
void MeshKernel::CutFacets | ( | const MeshFacetGrid & | rclGrid, |
const Base::ViewProjMethod * | pclP, | ||
const Base::Polygon2d & | rclPoly, | ||
bool | bCutInner, | ||
std::vector< MeshGeomFacet > & | raclFacets | ||
) |
CheckFacets() is invoked within this method and all found facets get deleted from the mesh structure.
The facets to be deleted are returned with their geometric representation.
References DeleteFacets(), GetFacet(), and MeshAlgorithm.
bool MeshKernel::DeleteFacet | ( | const MeshFacetIterator & | rclIter | ) |
Deletes the facet the iterator points to.
The deletion of a facet requires the following steps:
References ErasePoint(), MeshCore::FACET_INDEX_MAX, and MeshCore::MeshFacetIterator::Position().
Referenced by DeleteFacet(), and DeletePoint().
bool MeshKernel::DeleteFacet | ( | FacetIndex | ulInd | ) |
Does basically the same as the method above unless that the index of the facet is given.
References DeleteFacet(), and MeshCore::MeshFacetIterator::Set().
void MeshKernel::DeleteFacets | ( | const std::vector< FacetIndex > & | raulFacets | ) |
Removes several facets from the data structure.
References RecalcBoundBox(), RemoveInvalids(), and MeshCore::MeshFacet::SetInvalid().
Referenced by CutFacets().
bool MeshKernel::DeletePoint | ( | const MeshPointIterator & | rclIter | ) |
Deletes the point the iterator points to.
The deletion of a point requires the following step:
References MeshCore::MeshPointIterator::Begin(), DeleteFacet(), and MeshCore::MeshFacetIterator::End().
Referenced by DeletePoint().
bool MeshKernel::DeletePoint | ( | PointIndex | ulInd | ) |
Does basically the same as the method above unless that the index of the facet is given.
References DeletePoint(), and MeshCore::MeshPointIterator::Set().
void MeshKernel::DeletePoints | ( | const std::vector< PointIndex > & | raulPoints | ) |
Removes several points from the data structure.
References MeshCore::MeshPoint::IsValid(), RecalcBoundBox(), RemoveInvalids(), and MeshCore::MeshPoint::SetInvalid().
|
protected |
Checks if this point is associated to no other facet and deletes if so.
The point indices of the facets get adjusted. ulIndex is the index of the point to be deleted. ulFacetIndex is the index of the quasi deleted facet and is ignored. If bOnlySetInvalid is true the point doesn't get deleted but marked as invalid.
Referenced by DeleteFacet().
MeshFacetIterator MeshKernel::FacetIterator | ( | ) | const |
Returns an iterator object to go over all facets.
References MeshCore::MeshFacetIterator::Begin().
const Base::BoundBox3f & MeshCore::MeshKernel::GetBoundBox | ( | ) | const |
Determines the bounding box.
Referenced by MeshCore::MeshAlgorithm::GetFacetsFromToolMesh(), MeshCore::MeshIntersection::hasIntersection(), and Inspection::InspectNominalFastMesh::InspectNominalFastMesh().
void MeshKernel::GetEdges | ( | std::vector< MeshGeomEdge > & | edges | ) | const |
Returns the array of all edges.
Notice: The Edgelist will be temporary generated. Changes on the mesh structure does not affect the Edgelist
References MeshCore::FACET_INDEX_MAX.
MeshGeomFacet MeshCore::MeshKernel::GetFacet | ( | const MeshFacet & | rclFacet | ) | const |
References MeshCore::MeshGeomFacet::CalcNormal().
MeshGeomFacet MeshCore::MeshKernel::GetFacet | ( | FacetIndex | ulIndex | ) | const |
Returns the facet at the given index.
This method is rather slow and should be called occasionally only. For fast access the MeshFacetIterator interface should be used.
References MeshCore::MeshGeomFacet::CalcNormal().
Referenced by MeshCore::MeshDistancePlanarSegment::AddFacet(), MeshCore::MeshDistanceGenericSurfaceFitSegment::AddFacet(), MeshCore::MeshPlaneVisitor::AllowVisit(), MeshCore::MeshTrimByPlane::CheckFacets(), MeshCore::MeshTrimming::CheckFacets(), MeshCore::FacetCurvature::Compute(), CutFacets(), Mesh::SegmentByMesh::execute(), MeshGui::ViewProviderMesh::faceInfo(), MeshGui::ViewProviderMesh::getVisibleFacets(), MeshCore::MeshDistancePlanarSegment::Initialize(), MeshCore::MeshDistanceGenericSurfaceFitSegment::Initialize(), MeshCore::MeshPlaneVisitor::MeshPlaneVisitor(), MeshCore::MeshProjection::projectLineOnMesh(), MeshCore::MeshDistancePlanarSegment::TestFacet(), MeshCore::MeshDistanceGenericSurfaceFitSegment::TestFacet(), MeshCore::MeshDistanceGenericSurfaceFitSegment::TestInitialFacet(), MeshCore::MeshTrimByPlane::TrimFacets(), and MeshCore::MeshPlaneVisitor::Visit().
void MeshCore::MeshKernel::GetFacetNeighbours | ( | FacetIndex | ulIndex, |
FacetIndex & | rulNIdx0, | ||
FacetIndex & | rulNIdx1, | ||
FacetIndex & | rulNIdx2 | ||
) | const |
Returns the indices of the neighbour facets of the given facet index.
std::vector< Base::Vector3f > MeshKernel::GetFacetNormals | ( | const std::vector< FacetIndex > & | facets | ) | const |
References Base::Vector3< _Precision >::Normalize().
Referenced by ReverseEngineeringGui::SegmentationManual::Private::findGeometry().
std::vector< PointIndex > MeshKernel::GetFacetPoints | ( | const std::vector< FacetIndex > & | facets | ) | const |
Returns the point indices of the given facet indices.
References GetFacetPoints().
void MeshCore::MeshKernel::GetFacetPoints | ( | FacetIndex | ulFaIndex, |
PointIndex & | rclP0, | ||
PointIndex & | rclP1, | ||
PointIndex & | rclP2 | ||
) | const |
Returns the point indices of the given facet index.
Referenced by ReverseEngineeringGui::Segmentation::accept(), MeshCore::PointCollector::Append(), MeshCore::FitPointCollector::Append(), CalcVertexNormals(), and GetFacetPoints().
const MeshFacetArray & MeshCore::MeshKernel::GetFacets | ( | ) | const |
Returns the array of all facets.
Referenced by MeshCore::MeshCurvature::ComputePerVertex(), MeshGui::ViewProviderMeshBuilder::createMesh(), MeshGui::MeshSelection::deleteSelectionBorder(), MeshGui::ViewProviderMesh::faceInfo(), MeshCore::MeshSegmentAlgorithm::FindSegments(), MeshCore::MeshIntersection::getIntersection(), MeshGui::ViewProviderMesh::invertSelection(), MeshGui::ViewProviderMesh::isFacetSelected(), MeshGui::ViewProviderIndexedFaceSet::showOpenEdges(), MeshGui::ViewProviderMeshFaceSet::showOpenEdges(), MeshGui::ViewProviderMeshNode::showOpenEdges(), and MeshCore::MeshSimplify::simplify().
MeshFacetArray MeshKernel::GetFacets | ( | const std::vector< FacetIndex > & | indices | ) | const |
Returns an array of facets to the given indices.
The indices must not be out of range.
|
protected |
Calculates the gravity point to the given facet.
References Base::Vector3< _Precision >::x, Base::Vector3< _Precision >::y, and Base::Vector3< _Precision >::z.
unsigned int MeshCore::MeshKernel::GetMemSize | ( | ) | const |
Returns the number of required memory in bytes.
|
protected |
Calculates the normal to the given facet.
References Base::Vector3< _Precision >::Normalize().
MeshPoint MeshCore::MeshKernel::GetPoint | ( | PointIndex | ulIndex | ) | const |
Returns the point at the given index.
This method is rather slow and should be called occasionally only. For fast access the MeshPointIterator interfsce should be used.
Referenced by CalcVertexNormals().
std::vector< FacetIndex > MeshKernel::GetPointFacets | ( | const std::vector< PointIndex > & | points | ) | const |
Returns the facet indices that share the given point indices.
References MeshCore::MeshPoint::IsFlag(), MeshAlgorithm, MeshCore::MeshPoint::SetFlag(), MeshCore::MeshPoint::TMP0, and MeshCore::MeshFacet::TMP0.
const MeshPointArray & MeshCore::MeshKernel::GetPoints | ( | ) | const |
Returns the array of all data points.
Referenced by ReverseEngineeringGui::Segmentation::accept(), MeshCore::FacetCurvature::Compute(), MeshGui::ViewProviderMeshBuilder::createMesh(), MeshGui::MeshSelection::deleteSelectionBorder(), ReverseEngineeringGui::SegmentationManual::Private::findGeometry(), MeshGui::ViewProviderMeshNode::showOpenEdges(), MeshCore::MeshSimplify::simplify(), MeshCore::PlaneFitSmoothing::Smooth(), MeshCore::PlaneFitSmoothing::SmoothPoints(), and MeshCore::LaplaceSmoothing::Umbrella().
MeshPointArray MeshKernel::GetPoints | ( | const std::vector< PointIndex > & | indices | ) | const |
Returns an array of points to the given indices.
The indices must not be out of range.
float MeshKernel::GetSurface | ( | ) | const |
Calculates the surface area of the mesh object.
References MeshCore::MeshGeomFacet::Area(), MeshCore::MeshFacetIterator::Init(), MeshCore::MeshFacetIterator::More(), and MeshCore::MeshFacetIterator::Next().
float MeshKernel::GetSurface | ( | const std::vector< FacetIndex > & | aSegment | ) | const |
Calculates the surface area of the segment defined by aSegment.
References MeshCore::MeshGeomFacet::Area(), and MeshCore::MeshFacetIterator::Set().
float MeshKernel::GetVolume | ( | ) | const |
Calculates the volume of the mesh object.
Therefore the mesh must be a solid, if not 0 is returned.
References MeshCore::MeshFacetIterator::Init(), MeshCore::MeshFacetIterator::More(), MeshCore::MeshFacetIterator::Next(), Base::Vector3< _Precision >::x, Base::Vector3< _Precision >::y, and Base::Vector3< _Precision >::z.
std::vector< FacetIndex > MeshKernel::HasFacets | ( | const MeshPointIterator & | rclIter | ) | const |
Determines all facets that are associated to this point.
This method is very slow and should be called occasionally only.
References MeshCore::MeshPointIterator::Position().
bool MeshKernel::HasNonManifolds | ( | ) | const |
Checks whether the mesh has non.manifold edges.
An edge is regarded as non-manifolds if it shares more than two facets.
References MeshCore::MeshEvalTopology::Evaluate().
bool MeshKernel::HasOpenEdges | ( | ) | const |
Checks whether the mesh has open edges.
References MeshCore::MeshEvalSolid::Evaluate().
bool MeshKernel::HasSelfIntersections | ( | ) | const |
Checks whether the mesh intersects itself.
References MeshCore::MeshEvalSelfIntersection::Evaluate().
bool MeshCore::MeshKernel::IsValid | ( | ) | const |
Returns true if the data structure is valid.
Referenced by RemoveInvalids().
void MeshKernel::Merge | ( | const MeshKernel & | rKernel | ) |
Adds all facets and referenced points to the underlying mesh structure.
The client programmer must be sure that both meshes don't have geometric overlaps, otherwise the resulting mesh might be invalid, i.e. has self-intersections.
References Merge().
Referenced by AddFacets(), Merge(), and Mesh::MeshObject::meshFromSegment().
void MeshKernel::Merge | ( | const MeshPointArray & | rPoints, |
const MeshFacetArray & | rFaces | ||
) |
This method is provided for convenience that directly accepts the point and facet arrays.
References RebuildNeighbours().
MeshFacetModifier MeshCore::MeshKernel::ModifyFacets | ( | ) |
Returns a modifier for the facet array.
MeshPointModifier MeshCore::MeshKernel::ModifyPoints | ( | ) |
Returns a modifier for the point array.
void MeshCore::MeshKernel::MovePoint | ( | PointIndex | ulPtIndex, |
const Base::Vector3f & | rclTrans | ||
) |
Moves the point at the given index along the vector rclTrans.
void MeshKernel::operator*= | ( | const Base::Matrix4D & | rclMat | ) |
Transform the data structure with the given transformation matrix.
References Transform().
MeshKernel & MeshKernel::operator+= | ( | const MeshGeomFacet & | rclSFacet | ) |
Adds a single facet to the data structure.
This method is very slow and should be called occasionally only.
References AddFacet().
MeshKernel & MeshKernel::operator+= | ( | const std::vector< MeshGeomFacet > & | rclFAry | ) |
Adds an array of facets to the data structure.
This method keeps temporarily set properties and flags.
References AddFacets().
MeshKernel & MeshKernel::operator= | ( | const MeshKernel & | rclMesh | ) |
Assignment operator.
MeshKernel & MeshKernel::operator= | ( | const std::vector< MeshGeomFacet > & | rclFAry | ) |
Replaces the current data structure with the structure built up of the array of triangles given in rclFAry.
References MeshCore::MeshBuilder::AddFacet(), MeshCore::MeshBuilder::Finish(), and MeshCore::MeshBuilder::Initialize().
MeshPointIterator MeshKernel::PointIterator | ( | ) | const |
Returns an iterator object to go over all points.
References MeshCore::MeshPointIterator::Begin().
void MeshKernel::Read | ( | std::istream & | rclIn | ) |
void MeshKernel::RebuildNeighbours | ( | ) |
Rebuilds the neighbour indices for all facets.
References RebuildNeighbours().
Referenced by AddFacets(), Adopt(), Assign(), Merge(), and RebuildNeighbours().
|
protected |
Rebuilds the neighbour indices for subset of all facets from index index on.
References MeshCore::Edge_Index::f, MeshCore::FACET_INDEX_MAX, MeshCore::Edge_Index::p0, MeshCore::Edge_Index::p1, MeshCore::parallel_sort(), MeshCore::POINT_INDEX_MAX, and MeshCore::MeshFacet::Side().
void MeshKernel::RecalcBoundBox | ( | ) | const |
Forces a recalculation of the bounding box.
This method should be called after the removal of points.or after a transformation of the data structure.
Referenced by Adopt(), Assign(), DeleteFacets(), and DeletePoints().
void MeshKernel::RemoveInvalids | ( | ) |
Removes all as INVALID marked points and facets from the structure.
References MeshCore::FACET_INDEX_MAX, and IsValid().
Referenced by DeleteFacets(), and DeletePoints().
void MeshCore::MeshKernel::SetFacetPoints | ( | FacetIndex | ulFaIndex, |
PointIndex | rclP0, | ||
PointIndex | rclP1, | ||
PointIndex | rclP2 | ||
) |
Returns the point indices of the given facet index.
void MeshCore::MeshKernel::SetPoint | ( | PointIndex | ulPtIndex, |
const Base::Vector3f & | rPoint | ||
) |
Sets the point at the given index to the new rPoint.
Referenced by Mesh::PropertyMeshKernel::setPointIndices(), MeshCore::PlaneFitSmoothing::Smooth(), MeshCore::PlaneFitSmoothing::SmoothPoints(), and MeshCore::LaplaceSmoothing::Umbrella().
void MeshCore::MeshKernel::SetPoint | ( | PointIndex | ulPtIndex, |
float | x, | ||
float | y, | ||
float | z | ||
) |
Sets the point at the given index to the new rPoint.
void MeshKernel::Smooth | ( | int | iterations, |
float | d_max | ||
) |
Smoothes the mesh kernel.
References MeshCore::LaplaceSmoothing::Smooth().
void MeshKernel::Swap | ( | MeshKernel & | mesh | ) |
Swaps the content of this kernel and mesh.
void MeshKernel::Transform | ( | const Base::Matrix4D & | rclMat | ) |
Transform the data structure with the given transformation matrix.
It does exactly the same as the '*=' operator.
Referenced by MeshPartGui::CrossSections::apply(), MeshPartGui::CurveOnMeshHandler::Private::createGrid(), Mesh::MeshObject::crossSections(), Mesh::MeshObject::inner(), Mesh::MeshObject::intersect(), operator*=(), Mesh::MeshObject::outer(), MeshGui::ViewProviderMesh::partMeshCallback(), Mesh::MeshObject::section(), MeshGui::ViewProviderMesh::segmMeshCallback(), Mesh::MeshObject::subtract(), Mesh::MeshObject::transformGeometry(), and Mesh::MeshObject::unite().
unsigned long MeshKernel::VisitNeighbourFacets | ( | MeshFacetVisitor & | rclFVisitor, |
FacetIndex | ulStartFacet | ||
) | const |
This method visits all neighbour facets, i.e facets that share a common edge starting from the facet associated to index ulStartFacet.
All facets having set the VISIT flag are ignored. Therefore the user have to set or unset this flag if needed. All facets that get visited during this algorithm are marked as VISIT and the Visit() method of the given MeshFacetVisitor gets invoked. If there are no unvisited neighbours any more the algorithms returns immediately and returns the number of visited facets.
References MeshCore::MeshFacetVisitor::AllowVisit(), MeshCore::FACET_INDEX_MAX, MeshCore::MeshFacet::VISIT, and MeshCore::MeshFacetVisitor::Visit().
Referenced by MeshGui::ViewProviderMesh::deselectComponent(), Mesh::SegmentByMesh::execute(), MeshCore::MeshSegmentAlgorithm::FindSegments(), and MeshGui::ViewProviderMesh::selectComponent().
unsigned long MeshKernel::VisitNeighbourFacetsOverCorners | ( | MeshFacetVisitor & | rclFVisitor, |
FacetIndex | ulStartFacet | ||
) | const |
Does basically the same as the method above unless the facets that share just a common point are regared as neighbours.
References MeshCore::MeshFacetArray::SetFlag(), MeshCore::MeshFacet::VISIT, and MeshCore::MeshFacetVisitor::Visit().
unsigned long MeshKernel::VisitNeighbourPoints | ( | MeshPointVisitor & | rclPVisitor, |
PointIndex | ulStartPoint | ||
) | const |
This method visits all neighbour points starting from the point associated to index ulStartPoint.
All points having set the VISIT flag are ignored. Therefore the user have to set or unset this flag if needed before the algorithm starts. All points that get visited during this algorithm are marked as VISIT and the Visit() method of the given MeshPointVisitor gets invoked. If there are no unvisited neighbours any more the algorithms returns immediately and returns the number of visited points.
References MeshCore::MeshPoint::VISIT, and MeshCore::MeshPointVisitor::Visit().
void MeshKernel::Write | ( | std::ostream & | rclOut | ) | const |
Binary streaming of data.
References CountFacets(), and CountPoints().
|
friend |
Referenced by CutFacets(), and GetPointFacets().
|
friend |
|
friend |
|
friend |
|
friend |
|
friend |
|
friend |
|
friend |