#include <Triangulation.h>
Public Member Functions | |
AbstractPolygonTriangulator () | |
std::vector< Base::Vector3f > | AddedPoints () const |
The triangulation algorithm may create new points when calling Triangulate(). | |
void | Discard () |
const std::vector< MeshFacet > & | GetFacets () const |
Returns the topologic facets of the polygon. | |
std::vector< unsigned long > | GetInfo () const |
Get information about the pol<gons that were processed. | |
float | GetLength () const |
Returns the length of the polygon. | |
std::vector< Base::Vector3f > | GetPolygon () const |
Get the polygon points to be triangulated. | |
Base::Matrix4D | GetTransformToFitPlane () const |
Computes the best-fit plane and returns a transformation matrix built out of the axes of the plane. | |
const std::vector < MeshGeomFacet > & | GetTriangles () const |
Returns the geometric triangles of the polygon. | |
virtual void | ProjectOntoSurface (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. | |
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. | |
void | SetPolygon (const std::vector< Base::Vector3f > &raclPoints) |
Sets the polygon to be triangulated. | |
bool | TriangulatePolygon () |
Computes the triangulation of a polygon. | |
virtual | ~AbstractPolygonTriangulator () |
Protected Member Functions | |
void | Done () |
virtual bool | Triangulate ()=0 |
Computes the triangulation of a polygon. | |
Protected Attributes | |
bool | _discard |
std::vector< MeshFacet > | _facets |
std::vector< unsigned long > | _info |
Base::Matrix4D | _inverse |
std::vector< Base::Vector3f > | _newpoints |
std::vector< Base::Vector3f > | _points |
std::vector< MeshGeomFacet > | _triangles |
Definition at line 34 of file Triangulation.h.
AbstractPolygonTriangulator::AbstractPolygonTriangulator | ( | ) |
Definition at line 41 of file Triangulation.cpp.
References _discard.
AbstractPolygonTriangulator::~AbstractPolygonTriangulator | ( | ) | [virtual] |
Definition at line 46 of file Triangulation.cpp.
std::vector< Base::Vector3f > AbstractPolygonTriangulator::AddedPoints | ( | ) | const |
The triangulation algorithm may create new points when calling Triangulate().
This method returns these added points.
Definition at line 78 of file Triangulation.cpp.
References _inverse, and _newpoints.
Referenced by MeshCore::MeshAlgorithm::FillupHole().
void AbstractPolygonTriangulator::Discard | ( | ) |
Definition at line 172 of file Triangulation.cpp.
References _discard, and _info.
Referenced by MeshCore::MeshAlgorithm::FillupHole().
void AbstractPolygonTriangulator::Done | ( | ) | [protected] |
Definition at line 180 of file Triangulation.cpp.
References _discard, _info, and _points.
Referenced by TriangulatePolygon().
const std::vector<MeshFacet>& MeshCore::AbstractPolygonTriangulator::GetFacets | ( | void | ) | const [inline] |
Returns the topologic facets of the polygon.
Definition at line 72 of file Triangulation.h.
Referenced by MeshGui::ViewProviderMesh::createToolMesh(), MeshCore::MeshAlgorithm::FillupHole(), MeshCore::ConstraintDelaunayTriangulator::Triangulate(), and MeshCore::FlatTriangulator::Triangulate().
std::vector< unsigned long > AbstractPolygonTriangulator::GetInfo | ( | ) | const |
Get information about the pol<gons that were processed.
It returns an array of the number of edges for each closed polygon.
Definition at line 167 of file Triangulation.cpp.
References _info.
float AbstractPolygonTriangulator::GetLength | ( | ) | const |
Returns the length of the polygon.
Definition at line 64 of file Triangulation.cpp.
References _points, and Sketcher::Distance.
std::vector< Base::Vector3f > AbstractPolygonTriangulator::GetPolygon | ( | ) | const |
Get the polygon points to be triangulated.
The points may be projected onto its average plane.
Definition at line 59 of file Triangulation.cpp.
References _points.
Referenced by MeshCore::MeshAlgorithm::FillupHole(), MeshCore::ConstraintDelaunayTriangulator::Triangulate(), and MeshCore::FlatTriangulator::Triangulate().
Base::Matrix4D AbstractPolygonTriangulator::GetTransformToFitPlane | ( | ) | const |
Computes the best-fit plane and returns a transformation matrix built out of the axes of the plane.
Definition at line 88 of file Triangulation.cpp.
References _points, MeshCore::Approximation::AddPoint(), MeshCore::PlaneFit::Fit(), FLOAT_MAX, 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().
const std::vector<MeshGeomFacet>& MeshCore::AbstractPolygonTriangulator::GetTriangles | ( | ) | const [inline] |
Returns the geometric triangles of the polygon.
Definition at line 70 of file Triangulation.h.
Referenced by MeshCore::ConstraintDelaunayTriangulator::Triangulate(), and MeshCore::FlatTriangulator::Triangulate().
void AbstractPolygonTriangulator::ProjectOntoSurface | ( | const std::vector< Base::Vector3f > & | points | ) | [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.
Definition at line 124 of file Triangulation.cpp.
References _inverse, _newpoints, MeshCore::Approximation::AddPoint(), MeshCore::Approximation::CountPoints(), MeshCore::PolynomialFit::Fit(), FLOAT_MAX, 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.
Definition at line 112 of file Triangulation.cpp.
References _inverse, _points, and GetTransformToFitPlane().
Referenced by MeshCore::ConstraintDelaunayTriangulator::Triangulate(), MeshCore::FlatTriangulator::Triangulate(), and MeshCore::EarClippingTriangulator::Triangulate().
void AbstractPolygonTriangulator::SetPolygon | ( | const std::vector< Base::Vector3f > & | raclPoints | ) |
Sets the polygon to be triangulated.
Definition at line 50 of file Triangulation.cpp.
References _points.
Referenced by MeshGui::ViewProviderMesh::createToolMesh(), MeshCore::MeshAlgorithm::FillupHole(), MeshCore::ConstraintDelaunayTriangulator::Triangulate(), and MeshCore::FlatTriangulator::Triangulate().
virtual bool MeshCore::AbstractPolygonTriangulator::Triangulate | ( | ) | [protected, pure 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, MeshCore::ConstraintDelaunayTriangulator, and MeshCore::Triangulator.
Referenced by TriangulatePolygon().
bool AbstractPolygonTriangulator::TriangulatePolygon | ( | ) |
Computes the triangulation of a polygon.
The resulting facets can be accessed by GetTriangles() or GetFacets().
Definition at line 147 of file Triangulation.cpp.
References Base::Console(), Done(), Triangulate(), and Base::Exception::what().
Referenced by MeshGui::ViewProviderMesh::createToolMesh(), MeshCore::MeshAlgorithm::FillupHole(), MeshCore::ConstraintDelaunayTriangulator::Triangulate(), and MeshCore::FlatTriangulator::Triangulate().
bool MeshCore::AbstractPolygonTriangulator::_discard [protected] |
Definition at line 90 of file Triangulation.h.
Referenced by AbstractPolygonTriangulator(), Discard(), and Done().
std::vector<MeshFacet> MeshCore::AbstractPolygonTriangulator::_facets [protected] |
Definition at line 95 of file Triangulation.h.
Referenced by MeshCore::ConstraintDelaunayTriangulator::Triangulate(), MeshCore::FlatTriangulator::Triangulate(), MeshCore::DelaunayTriangulator::Triangulate(), MeshCore::QuasiDelaunayTriangulator::Triangulate(), and MeshCore::EarClippingTriangulator::Triangulate().
std::vector<unsigned long> MeshCore::AbstractPolygonTriangulator::_info [protected] |
Definition at line 96 of file Triangulation.h.
Definition at line 91 of file Triangulation.h.
Referenced by AddedPoints(), ProjectOntoSurface(), and ProjectToFitPlane().
std::vector<Base::Vector3f> MeshCore::AbstractPolygonTriangulator::_newpoints [protected] |
Definition at line 93 of file Triangulation.h.
Referenced by AddedPoints(), ProjectOntoSurface(), MeshCore::ConstraintDelaunayTriangulator::Triangulate(), and MeshCore::FlatTriangulator::Triangulate().
std::vector<Base::Vector3f> MeshCore::AbstractPolygonTriangulator::_points [protected] |
Definition at line 92 of file Triangulation.h.
Referenced by Done(), GetLength(), GetPolygon(), GetTransformToFitPlane(), ProjectToFitPlane(), SetPolygon(), MeshCore::DelaunayTriangulator::Triangulate(), MeshCore::QuasiDelaunayTriangulator::Triangulate(), and MeshCore::EarClippingTriangulator::Triangulate().
std::vector<MeshGeomFacet> MeshCore::AbstractPolygonTriangulator::_triangles [protected] |
Definition at line 94 of file Triangulation.h.
Referenced by MeshCore::ConstraintDelaunayTriangulator::Triangulate(), MeshCore::FlatTriangulator::Triangulate(), MeshCore::DelaunayTriangulator::Triangulate(), and MeshCore::EarClippingTriangulator::Triangulate().