#include <Triangulation.h>
Public Member Functions | |
AbstractPolygonTriangulator () | |
std::vector< Base::Vector3f > | AddedPoints () const |
The triangulation algorithm may create new points when calling Triangulate(). More... | |
virtual void | Discard () |
const std::vector< MeshFacet > & | GetFacets () const |
Returns the topologic facets of the polygon. More... | |
std::vector< PointIndex > | GetInfo () const |
Get information about the polygons that were processed. More... | |
float | GetLength () const |
Returns the length of the polygon. More... | |
std::vector< Base::Vector3f > | GetPolygon () const |
Get the polygon points to be triangulated. More... | |
Base::Matrix4D | GetTransformToFitPlane () const |
Computes the best-fit plane and returns a transformation matrix built out of the axes of the plane. More... | |
virtual MeshGeomFacet | GetTriangle (const MeshPointArray &, const MeshFacet &) const |
Returns the triangle to a given topologic facet. More... | |
const std::vector< MeshGeomFacet > & | GetTriangles () const |
Returns the geometric triangles of the polygon. More... | |
TriangulationVerifier * | GetVerifier () const |
virtual bool | NeedsReindexing () const |
Usually the created faces use the indices of the polygon points from [0, n]. More... | |
virtual void | PostProcessing (const std::vector< Base::Vector3f > &) |
If points were added then we get the 3D points by projecting the added 2D points onto a surface which fits into the given points. More... | |
std::vector< Base::Vector3f > | ProjectToFitPlane () |
If the points of the polygon set by SetPolygon() doesn't lie in a plane this method can be used to project the points in a common plane. More... | |
virtual void | Reset () |
Resets some internals. More... | |
void | SetIndices (const std::vector< PointIndex > &d) |
void | SetPolygon (const std::vector< Base::Vector3f > &raclPoints) |
Sets the polygon to be triangulated. More... | |
void | SetVerifier (TriangulationVerifier *v) |
Set a verifier object that checks if the generated triangulation can be accepted and added to the mesh kernel. More... | |
bool | TriangulatePolygon () |
Computes the triangulation of a polygon. More... | |
virtual | ~AbstractPolygonTriangulator () |
Protected Member Functions | |
void | Done () |
virtual bool | Triangulate ()=0 |
Computes the triangulation of a polygon. More... | |
AbstractPolygonTriangulator::AbstractPolygonTriangulator | ( | ) |
|
virtual |
std::vector< Base::Vector3f > AbstractPolygonTriangulator::AddedPoints | ( | ) | const |
The triangulation algorithm may create new points when calling Triangulate().
This method returns these added points.
Referenced by MeshCore::MeshAlgorithm::FillupHole().
|
virtual |
Referenced by MeshCore::MeshAlgorithm::FillupHole().
|
protected |
Referenced by TriangulatePolygon().
const std::vector< MeshFacet > & MeshCore::AbstractPolygonTriangulator::GetFacets | ( | ) | const |
Returns the topologic facets of the polygon.
Referenced by MeshGui::ViewProviderMesh::createToolMesh(), MeshCore::MeshAlgorithm::FillupHole(), MeshCore::FlatTriangulator::Triangulate(), and MeshCore::ConstraintDelaunayTriangulator::Triangulate().
std::vector< PointIndex > AbstractPolygonTriangulator::GetInfo | ( | ) | const |
Get information about the polygons that were processed.
It returns an array of the number of edges for each closed polygon.
float AbstractPolygonTriangulator::GetLength | ( | ) | const |
Returns the length of the polygon.
References Base::Distance().
std::vector< Base::Vector3f > AbstractPolygonTriangulator::GetPolygon | ( | ) | const |
Get the polygon points to be triangulated.
The points may be projected onto its average plane.
Referenced by MeshCore::MeshAlgorithm::FillupHole(), MeshCore::FlatTriangulator::Triangulate(), and MeshCore::ConstraintDelaunayTriangulator::Triangulate().
Base::Matrix4D AbstractPolygonTriangulator::GetTransformToFitPlane | ( | ) | const |
Computes the best-fit plane and returns a transformation matrix built out of the axes of the plane.
References MeshCore::Approximation::AddPoint(), MeshCore::PlaneFit::Fit(), MeshCore::PlaneFit::GetBase(), MeshCore::PlaneFit::GetDirU(), MeshCore::PlaneFit::GetDirV(), MeshCore::PlaneFit::GetNormal(), Base::Matrix4D::setToUnity(), Base::Vector3< _Precision >::x, Base::Vector3< _Precision >::y, and Base::Vector3< _Precision >::z.
Referenced by ProjectToFitPlane().
|
virtual |
Returns the triangle to a given topologic facet.
Referenced by MeshCore::MeshAlgorithm::FillupHole().
const std::vector< MeshGeomFacet > & MeshCore::AbstractPolygonTriangulator::GetTriangles | ( | ) | const |
Returns the geometric triangles of the polygon.
Referenced by MeshCore::FlatTriangulator::Triangulate(), and MeshCore::ConstraintDelaunayTriangulator::Triangulate().
TriangulationVerifier * AbstractPolygonTriangulator::GetVerifier | ( | ) | const |
Referenced by MeshCore::MeshAlgorithm::FillupHole().
|
virtual |
Usually the created faces use the indices of the polygon points from [0, n].
If the faces should be appended to an existing mesh they may need to be reindexed from the calling instance. However, there may other algorithms that directly use the indices of the mesh and thus do not need to be touched afterwards. In this case the method should be reimplemented to return false.
Referenced by MeshCore::MeshAlgorithm::FillupHole(), and MeshCore::MeshTopoAlgorithm::FillupHoles().
|
virtual |
If points were added then we get the 3D points by projecting the added 2D points onto a surface which fits into the given points.
Reimplemented in MeshCore::FlatTriangulator.
References MeshCore::Approximation::AddPoint(), MeshCore::Approximation::CountPoints(), MeshCore::PolynomialFit::Fit(), Base::Vector3< _Precision >::TransformToCoordinateSystem(), and MeshCore::PolynomialFit::Value().
Referenced by MeshCore::MeshAlgorithm::FillupHole().
std::vector< Base::Vector3f > AbstractPolygonTriangulator::ProjectToFitPlane | ( | ) |
If the points of the polygon set by SetPolygon() doesn't lie in a plane this method can be used to project the points in a common plane.
References GetTransformToFitPlane().
Referenced by MeshCore::EarClippingTriangulator::Triangulate(), MeshCore::FlatTriangulator::Triangulate(), and MeshCore::ConstraintDelaunayTriangulator::Triangulate().
|
virtual |
Resets some internals.
The default implementation does nothing.
void MeshCore::AbstractPolygonTriangulator::SetIndices | ( | const std::vector< PointIndex > & | d | ) |
Referenced by MeshCore::MeshAlgorithm::FillupHole().
void AbstractPolygonTriangulator::SetPolygon | ( | const std::vector< Base::Vector3f > & | raclPoints | ) |
Sets the polygon to be triangulated.
Referenced by MeshGui::ViewProviderMesh::createToolMesh(), MeshCore::MeshAlgorithm::FillupHole(), MeshCore::FlatTriangulator::Triangulate(), and MeshCore::ConstraintDelaunayTriangulator::Triangulate().
void AbstractPolygonTriangulator::SetVerifier | ( | TriangulationVerifier * | v | ) |
Set a verifier object that checks if the generated triangulation can be accepted and added to the mesh kernel.
The triangulator takes ownership of the passed verifier.
Referenced by MeshGui::ViewProviderMesh::fillHole().
|
protectedpure virtual |
Computes the triangulation of a polygon.
The resulting facets can be accessed by GetTriangles() or GetFacets().
Implemented in MeshCore::EarClippingTriangulator, MeshCore::QuasiDelaunayTriangulator, MeshCore::DelaunayTriangulator, MeshCore::FlatTriangulator, and MeshCore::ConstraintDelaunayTriangulator.
Referenced by TriangulatePolygon().
bool AbstractPolygonTriangulator::TriangulatePolygon | ( | ) |
Computes the triangulation of a polygon.
The resulting facets can be accessed by GetTriangles() or GetFacets().
References Base::Console(), Done(), Base::ConsoleSingleton::Log(), and Triangulate().
Referenced by MeshGui::ViewProviderMesh::createToolMesh(), MeshCore::MeshAlgorithm::FillupHole(), MeshCore::FlatTriangulator::Triangulate(), and MeshCore::ConstraintDelaunayTriangulator::Triangulate().