The MeshGeomFacet class is geometric counterpart to MeshFacet that holds the geometric data points of a triangle. More...
#include <Elements.h>
Public Member Functions | |
Construction | |
MeshGeomFacet () | |
default constructor More... | |
MeshGeomFacet (const Base::Vector3f &v1, const Base::Vector3f &v2, const Base::Vector3f &v3) | |
Constructor with the corner points. More... | |
~MeshGeomFacet () | |
Destruction. More... | |
bool | IsPointOf (const Base::Vector3f &rclPoint, float fDistance) const |
Checks if the point is part of the facet. More... | |
bool | IsPointOf (const Base::Vector3f &rclPoint) const |
Checks if the point is inside or at the border of the facet. More... | |
bool | IsPointOfFace (const Base::Vector3f &rclP, float fDistance) const |
Checks whether the given point is inside the facet with tolerance fDistance. More... | |
bool | Weights (const Base::Vector3f &rclP, float &w0, float &w1, float &w2) const |
Calculates the weights w1, ..., w3 of the corners to get the point rclP, i.e. More... | |
float | DistancePlaneToPoint (const Base::Vector3f &rclPoint) const |
Calculates the distance of a point to the plane defined by the triangle. More... | |
void | ProjectPointToPlane (const Base::Vector3f &rclPoint, Base::Vector3f &rclProj) const |
Calculates the projection of a point onto the plane defined by the triangle. More... | |
void | ProjectFacetToPlane (MeshGeomFacet &rclFacet) const |
Calculates the projection of a facet onto the plane defined by the triangle. More... | |
bool | IsDegenerated (float epsilon) const |
Checks whether the triangle is degenerated. More... | |
bool | IsDeformed (float fCosOfMinAngle, float fCosOfMaxAngle) const |
Checks whether the triangle is deformed. More... | |
void | Enlarge (float fDist) |
Enlarges the triangle. More... | |
void | CalcNormal () const |
Calculates the facet normal for storing internally. More... | |
void | ArrangeNormal (const Base::Vector3f &rclN) |
Arrange the facet normal so the both vectors have the same orientation. More... | |
void | AdjustCirculationDirection () |
Adjusts the facet's orientation to its normal. More... | |
void | NormalInvalid () |
Invalidate the normal. More... | |
bool | IsFlag (MeshFacet::TFlagType tF) const |
Query the flag state of the facet. More... | |
void | SetFlag (MeshFacet::TFlagType tF) |
Set flag state. More... | |
void | ResetFlag (MeshFacet::TFlagType tF) |
Reset flag state. More... | |
Base::Vector3f | GetGravityPoint () const |
Calculates the facet's gravity point. More... | |
Base::Vector3f | GetNormal () const |
Returns the normal of the facet. More... | |
void | SetNormal (const Base::Vector3f &rclNormal) |
Sets the facet's normal. More... | |
Base::BoundBox3f | GetBoundBox () const |
Returns the wrapping bounding box. More... | |
float | Perimeter () const |
Calculates the perimeter of the facet. More... | |
float | Area () const |
Calculates the area of a facet. More... | |
float | MaximumAngle () const |
Calculates the maximum angle of a facet. More... | |
float | MinimumAngle () const |
Calculates the minimum angle of a facet. More... | |
bool | ContainedByOrIntersectBoundingBox (const Base::BoundBox3f &rcBB) const |
Checks if the facet is inside the bounding box or intersects with it. More... | |
bool | IntersectBoundingBox (const Base::BoundBox3f &rclBB) const |
Checks if the facet intersects with the given bounding box. More... | |
bool | IntersectWithFacet (const MeshGeomFacet &rclFacet) const |
This method checks if both facets intersect. More... | |
int | IntersectWithFacet (const MeshGeomFacet &facet, Base::Vector3f &rclPt0, Base::Vector3f &rclPt1) const |
Intersect the facet with the other facet The result is line given by two points (if intersected). More... | |
float | DistanceToLineSegment (const Base::Vector3f &rcP1, const Base::Vector3f &rcP2) const |
Calculates the shortest distance from the line segment defined by rcP1 and rcP2 to this facet. More... | |
float | DistanceToPoint (const Base::Vector3f &rcPt) const |
Calculates the shortest distance from the point rcPt to the facet. More... | |
float | DistanceToPoint (const Base::Vector3f &rclPt, Base::Vector3f &rclNt) const |
Calculates the shortest distance from the point rcPt to the facet. More... | |
bool | IntersectWithLine (const Base::Vector3f &rclPt, const Base::Vector3f &rclDir, Base::Vector3f &rclRes) const |
Calculates the intersection point of the line defined by the base rclPt and the direction rclDir with the facet. More... | |
bool | Foraminate (const Base::Vector3f &rclPt, const Base::Vector3f &rclDir, Base::Vector3f &rclRes, float fMaxAngle=Mathf::PI) const |
Calculates the intersection point of the line defined by the base rclPt and the direction rclDir with the facet. More... | |
bool | IntersectWithPlane (const Base::Vector3f &rclBase, const Base::Vector3f &rclNormal, Base::Vector3f &rclP1, Base::Vector3f &rclP2) const |
Checks if the facet intersects with the plane defined by the base rclBase and the normal rclNormal and returns true if two points are found, false otherwise. More... | |
bool | IntersectWithPlane (const Base::Vector3f &rclBase, const Base::Vector3f &rclNormal) const |
Checks if the facet intersects with the plane defined by the base rclBase and the normal rclNormal. More... | |
bool | IntersectPlaneWithLine (const Base::Vector3f &rclBase, const Base::Vector3f &rclNormal, Base::Vector3f &rclRes) const |
Checks if the plane defined by the facet rclFacet intersects with the line defined by the base rclBase and the direction rclNormal and returns the intersection point rclRes if possible. More... | |
float | VolumeOfPrism (const MeshGeomFacet &rclF) const |
Calculates the volume of the prism defined by two facets. More... | |
void | SubSample (float fStep, std::vector< Base::Vector3f > &rclPoints) const |
Subsamples the facet into points with resolution fStep. More... | |
float | CenterOfInscribedCircle (Base::Vector3f &rclCenter) const |
Calculates the center and radius of the inscribed circle of the facet. More... | |
float | CenterOfCircumCircle (Base::Vector3f &rclCenter) const |
Calculates the center and radius of the circum circle of the facet. More... | |
unsigned short | NearestEdgeToPoint (const Base::Vector3f &rclPt) const |
Returns the edge number of the facet that is nearest to the point rclPt. More... | |
void | NearestEdgeToPoint (const Base::Vector3f &rclPt, float &fDistance, unsigned short &side) const |
Returns the edge number side of the facet and the distance to the edge that is nearest to the point rclPt. More... | |
MeshGeomEdge | GetEdge (short side) const |
Returns the edge for side. More... | |
bool | IsPointOfSphere (const Base::Vector3f &rP) const |
The center and radius of the circum circle define a sphere in 3D. More... | |
bool | IsPointOfSphere (const MeshGeomFacet &rFacet) const |
This is an overloaded member function, provided for convenience. More... | |
float | AspectRatio () const |
The aspect ratio is the longest edge length divided by its height. More... | |
float | AspectRatio2 () const |
The alternative aspect ration is the ratio of the radius of the circum-circle and twice the radius of the in-circle. More... | |
float | Roundness () const |
The roundness is in the range between 0.0 (colinear) and 1.0 (equilateral). More... | |
void | Transform (const Base::Matrix4D &) |
Apply a transformation on the triangle. More... | |
bool | IsCoplanar (const MeshGeomFacet &facet) const |
Checks if the two triangles are coplanar. More... | |
The MeshGeomFacet class is geometric counterpart to MeshFacet that holds the geometric data points of a triangle.
MeshGeomFacet::MeshGeomFacet | ( | ) |
default constructor
Referenced by Weights().
MeshGeomFacet::MeshGeomFacet | ( | const Base::Vector3f & | v1, |
const Base::Vector3f & | v2, | ||
const Base::Vector3f & | v3 | ||
) |
Constructor with the corner points.
References draftgeoutils.general::v1().
MeshCore::MeshGeomFacet::~MeshGeomFacet | ( | ) |
Destruction.
void MeshCore::MeshGeomFacet::AdjustCirculationDirection | ( | ) |
Adjusts the facet's orientation to its normal.
float MeshCore::MeshGeomFacet::Area | ( | ) | const |
Calculates the area of a facet.
Referenced by CenterOfCircumCircle(), CenterOfInscribedCircle(), MeshCore::MeshKernel::GetSurface(), Roundness(), MeshCore::MeshAlgorithm::Surface(), and Weights().
void MeshCore::MeshGeomFacet::ArrangeNormal | ( | const Base::Vector3f & | rclN | ) |
Arrange the facet normal so the both vectors have the same orientation.
References GetNormal().
float MeshGeomFacet::AspectRatio | ( | ) | const |
The aspect ratio is the longest edge length divided by its height.
References Base::Vector3< _Precision >::Sqr().
float MeshGeomFacet::AspectRatio2 | ( | ) | const |
The alternative aspect ration is the ratio of the radius of the circum-circle and twice the radius of the in-circle.
References Base::Distance().
void MeshCore::MeshGeomFacet::CalcNormal | ( | ) | const |
Calculates the facet normal for storing internally.
Referenced by Mesh::MeshObject::createCube(), Mesh::MeshObject::createMeshFromList(), MeshGui::ViewProviderMesh::createToolMesh(), MeshCore::MeshKernel::GetFacet(), and GetNormal().
float MeshGeomFacet::CenterOfCircumCircle | ( | Base::Vector3f & | rclCenter | ) | const |
Calculates the center and radius of the circum circle of the facet.
References Area(), Base::Vector3< _Precision >::x, Base::Vector3< _Precision >::y, and Base::Vector3< _Precision >::z.
Referenced by MeshCore::MeshTopoAlgorithm::DelaunayFlip(), and IsPointOfSphere().
float MeshGeomFacet::CenterOfInscribedCircle | ( | Base::Vector3f & | rclCenter | ) | const |
Calculates the center and radius of the inscribed circle of the facet.
References Area(), Base::Distance(), Base::Vector3< _Precision >::x, Base::Vector3< _Precision >::y, and Base::Vector3< _Precision >::z.
bool MeshCore::MeshGeomFacet::ContainedByOrIntersectBoundingBox | ( | const Base::BoundBox3f & | rcBB | ) | const |
Checks if the facet is inside the bounding box or intersects with it.
References GetBoundBox(), IntersectBoundingBox(), and Base::BoundBox3< _Precision >::IsInBox().
float MeshCore::MeshGeomFacet::DistancePlaneToPoint | ( | const Base::Vector3f & | rclPoint | ) | const |
Calculates the distance of a point to the plane defined by the triangle.
References Base::Vector3< _Precision >::DistanceToPlane(), and GetNormal().
Referenced by IsCoplanar(), and IsPointOf().
float MeshGeomFacet::DistanceToLineSegment | ( | const Base::Vector3f & | rcP1, |
const Base::Vector3f & | rcP2 | ||
) | const |
Calculates the shortest distance from the line segment defined by rcP1 and rcP2 to this facet.
References Base::Vector3< _Precision >::x, Base::Vector3< _Precision >::y, and Base::Vector3< _Precision >::z.
float MeshGeomFacet::DistanceToPoint | ( | const Base::Vector3f & | rclPt, |
Base::Vector3f & | rclNt | ||
) | const |
Calculates the shortest distance from the point rcPt to the facet.
rclNt is the point of the facet with shortest distance.
References Base::Vector3< _Precision >::Set(), Base::Vector3< _Precision >::x, Base::Vector3< _Precision >::y, and Base::Vector3< _Precision >::z.
float MeshCore::MeshGeomFacet::DistanceToPoint | ( | const Base::Vector3f & | rcPt | ) | const |
Calculates the shortest distance from the point rcPt to the facet.
Referenced by Inspection::InspectNominalMesh::getDistance(), Inspection::InspectNominalFastMesh::getDistance(), and MeshCore::MeshAlgorithm::NearestPointFromPoint().
void MeshGeomFacet::Enlarge | ( | float | fDist | ) |
Enlarges the triangle.
References Base::Vector3< _Precision >::GetAngle(), Base::Vector3< _Precision >::Normalize(), and Base::Vector3< _Precision >::Scale().
bool MeshGeomFacet::Foraminate | ( | const Base::Vector3f & | rclPt, |
const Base::Vector3f & | rclDir, | ||
Base::Vector3f & | rclRes, | ||
float | fMaxAngle = Mathf::PI |
||
) | const |
Calculates the intersection point of the line defined by the base rclPt and the direction rclDir with the facet.
The intersection must be inside the facet. If there is no intersection false is returned. This does actually the same as IntersectWithLine() with one additionally constraint that the angle between the direction of the line and the normal of the plane must not exceed fMaxAngle.
References Base::Vector3< _Precision >::GetAngle(), and GetNormal().
Referenced by MeshPart::CurveProjectorShape::findStartPoint(), MeshPart::CurveProjectorSimple::findStartPoint(), MeshCore::MeshAlgorithm::GetFacetsFromToolMesh(), MeshCore::MeshAlgorithm::NearestFacetOnRay(), and MeshCore::MeshAlgorithm::Surround().
Base::BoundBox3f MeshCore::MeshGeomFacet::GetBoundBox | ( | ) | const |
Returns the wrapping bounding box.
Referenced by ContainedByOrIntersectBoundingBox(), MeshCore::MeshEvalSelfIntersection::GetIntersections(), IntersectWithFacet(), and MeshCore::MeshProjection::projectLineOnMesh().
MeshGeomEdge MeshGeomFacet::GetEdge | ( | short | side | ) | const |
Returns the edge for side.
Referenced by IntersectWithFacet().
Base::Vector3f MeshCore::MeshGeomFacet::GetGravityPoint | ( | ) | const |
Calculates the facet's gravity point.
Referenced by MeshCore::PlaneSurfaceFit::AddTriangle(), Mesh::SegmentByMesh::execute(), MeshGui::ViewProviderMesh::getVisibleFacets(), MeshCore::PlaneSurfaceFit::Initialize(), IntersectPlaneWithLine(), Mesh::MeshObject::offsetSpecial2(), MeshPart::MeshAlgos::offsetSpecial2(), MeshCore::MeshFaceIterator::operator()(), Mesh::MeshObject::refine(), SubSample(), and MeshCore::MeshAlgorithm::SubSampleByDist().
Base::Vector3f MeshCore::MeshGeomFacet::GetNormal | ( | ) | const |
Returns the normal of the facet.
References CalcNormal().
Referenced by MeshCore::MeshBuilder::AddFacet(), MeshCore::MeshKernel::AddFacet(), MeshCore::MeshTopoAlgorithm::AdjustEdgesToCurvatureDirection(), ArrangeNormal(), MeshGui::ViewProviderMeshTransformDemolding::calcNormalVector(), MeshGui::ViewProviderMesh::createToolMesh(), DistancePlaneToPoint(), MeshCore::MeshEvalDentsOnSurface::Evaluate(), MeshCore::MeshEvalFoldsOnBoundary::Evaluate(), MeshCore::MeshAlgorithm::FillupHole(), MeshPart::CurveProjectorShape::findStartPoint(), MeshPart::CurveProjectorSimple::findStartPoint(), Foraminate(), Inspection::InspectNominalMesh::getDistance(), Inspection::InspectNominalFastMesh::getDistance(), MeshCore::PlaneSurfaceFit::Initialize(), IntersectPlaneWithLine(), IntersectWithFacet(), MeshCore::MeshTopoAlgorithm::IsCollapseEdgeLegal(), IsCoplanar(), IsPointOf(), MeshPart::CurveProjectorWithToolMesh::makeToolMesh(), Mesh::MeshObject::offsetSpecial2(), MeshPart::MeshAlgos::offsetSpecial2(), MeshPart::CurveProjectorSimple::projectCurve(), MeshPart::CurveProjectorShape::projectCurve(), MeshPart::MeshProjection::projectEdgeToEdge(), ProjectFacetToPlane(), ProjectPointToPlane(), MeshCore::MeshOutput::SaveAsciiSTL(), MeshCore::MeshOutput::SaveBinarySTL(), MeshCore::MeshOutput::SaveInventor(), MeshCore::MeshOutput::SaveOBJ(), MeshCore::MeshTopoAlgorithm::ShouldSwapEdge(), MeshGui::ViewProviderMeshOrientation::showDefects(), MeshGui::ViewProviderMeshDuplicatedFaces::showDefects(), MeshGui::ViewProviderMeshIndices::showDefects(), MeshGui::ViewProviderMeshFolds::showDefects(), and MeshCore::CylinderSurfaceFit::TestTriangle().
bool MeshGeomFacet::IntersectBoundingBox | ( | const Base::BoundBox3f & | rclBB | ) | const |
Checks if the facet intersects with the given bounding box.
References Base::BoundBox3< _Precision >::GetCenter(), Base::BoundBox3< _Precision >::IsInBox(), Base::BoundBox3< _Precision >::LengthX(), Base::BoundBox3< _Precision >::LengthY(), Base::BoundBox3< _Precision >::LengthZ(), draftgeoutils.general::v1(), Base::Vector3< _Precision >::x, Base::Vector3< _Precision >::y, and Base::Vector3< _Precision >::z.
Referenced by Inspection::MeshInspectGrid::AddFacet(), MeshCore::MeshFacetGrid::AddFacet(), ContainedByOrIntersectBoundingBox(), and MeshCore::MeshFacetGrid::Verify().
bool MeshGeomFacet::IntersectPlaneWithLine | ( | const Base::Vector3f & | rclBase, |
const Base::Vector3f & | rclNormal, | ||
Base::Vector3f & | rclRes | ||
) | const |
Checks if the plane defined by the facet rclFacet intersects with the line defined by the base rclBase and the direction rclNormal and returns the intersection point rclRes if possible.
References GetGravityPoint(), and GetNormal().
Referenced by IntersectWithLine(), ProjectFacetToPlane(), and MeshPart::MeshProjection::projectOnMesh().
int MeshGeomFacet::IntersectWithFacet | ( | const MeshGeomFacet & | facet, |
Base::Vector3f & | rclPt0, | ||
Base::Vector3f & | rclPt1 | ||
) | const |
Intersect the facet with the other facet The result is line given by two points (if intersected).
Fast Triangle-Triangle Intersection Test by Tomas Moeller http://www.acm.org/jgt/papers/Moller97/tritri.html http://www.cs.lth.se/home/Tomas_Akenine_Moller/code/.
Return is the number of intersections points: 0: no intersection, 1: one intersection point (rclPt0), 2: two intersections points (rclPt0, rclPt1)
References Base::BoundBox3< _Precision >::Enlarge(), GetBoundBox(), GetEdge(), GetNormal(), MeshCore::MeshGeomEdge::IntersectWithEdge(), IsCoplanar(), Base::BoundBox3< _Precision >::IsInBox(), IsPointOf(), Base::Vector3< _Precision >::x, Base::Vector3< _Precision >::y, and Base::Vector3< _Precision >::z.
bool MeshGeomFacet::IntersectWithFacet | ( | const MeshGeomFacet & | rclFacet | ) | const |
This method checks if both facets intersect.
Fast Triangle-Triangle Intersection Test by Tomas Moeller http://www.acm.org/jgt/papers/Moller97/tritri.html http://www.cs.lth.se/home/Tomas_Akenine_Moller/code/.
Referenced by MeshCore::MeshEvalSelfIntersection::Evaluate(), MeshCore::MeshIntersection::getIntersection(), MeshCore::MeshEvalSelfIntersection::GetIntersections(), and MeshCore::MeshAlgorithm::Surround().
bool MeshGeomFacet::IntersectWithLine | ( | const Base::Vector3f & | rclPt, |
const Base::Vector3f & | rclDir, | ||
Base::Vector3f & | rclRes | ||
) | const |
Calculates the intersection point of the line defined by the base rclPt and the direction rclDir with the facet.
The intersection must be inside the facet. If there is no intersection false is returned.
References IntersectPlaneWithLine(), and IsPointOfFace().
Referenced by MeshCore::MeshEvalDentsOnSurface::Evaluate(), MeshPart::CurveProjectorWithToolMesh::makeToolMesh(), and MeshPart::CurveProjectorSimple::projectCurve().
bool MeshCore::MeshGeomFacet::IntersectWithPlane | ( | const Base::Vector3f & | rclBase, |
const Base::Vector3f & | rclNormal | ||
) | const |
Checks if the facet intersects with the plane defined by the base rclBase and the normal rclNormal.
bool MeshGeomFacet::IntersectWithPlane | ( | const Base::Vector3f & | rclBase, |
const Base::Vector3f & | rclNormal, | ||
Base::Vector3f & | rclP1, | ||
Base::Vector3f & | rclP2 | ||
) | const |
Checks if the facet intersects with the plane defined by the base rclBase and the normal rclNormal and returns true if two points are found, false otherwise.
References Base::Vector3< _Precision >::Set(), draftgeoutils.general::v1(), Base::Vector3< _Precision >::x, Base::Vector3< _Precision >::y, and Base::Vector3< _Precision >::z.
Referenced by MeshCore::MeshTrimByPlane::CheckFacets(), MeshCore::MeshAlgorithm::CutWithPlane(), MeshCore::MeshAlgorithm::GetFacetsFromPlane(), and MeshCore::MeshProjection::projectLineOnMesh().
bool MeshGeomFacet::IsCoplanar | ( | const MeshGeomFacet & | facet | ) | const |
Checks if the two triangles are coplanar.
References DraftVecUtils::dist(), DistancePlaneToPoint(), and GetNormal().
Referenced by IntersectWithFacet().
bool MeshGeomFacet::IsDeformed | ( | float | fCosOfMinAngle, |
float | fCosOfMaxAngle | ||
) | const |
Checks whether the triangle is deformed.
A triangle is deformed if an angle exceeds a given maximum angle or falls below a given minimum angle. For performance reasons the cosine of minimum and maximum angle is expected.
References Base::Vector3< _Precision >::Normalize().
Referenced by MeshCore::MeshEvalDeformedFacets::Evaluate(), MeshCore::MeshEvalDeformedFacets::GetIndices(), and Mesh::MeshObject::refine().
bool MeshGeomFacet::IsDegenerated | ( | float | epsilon | ) | const |
Checks whether the triangle is degenerated.
A triangle is degenerated if its area is less than an epsilon.
References draftutils.utils::epsilon().
Referenced by MeshCore::MeshEvalDegeneratedFacets::Evaluate(), MeshCore::MeshFixDegeneratedFacets::Fixup(), MeshCore::MeshFixDeformedFacets::Fixup(), MeshCore::MeshEvalDegeneratedFacets::GetIndices(), and MeshCore::MeshTopoAlgorithm::IsSwapEdgeLegal().
bool MeshCore::MeshGeomFacet::IsFlag | ( | MeshFacet::TFlagType | tF | ) | const |
Query the flag state of the facet.
Referenced by Mesh::MeshObject::offsetSpecial2(), and MeshPart::MeshAlgos::offsetSpecial2().
bool MeshGeomFacet::IsPointOf | ( | const Base::Vector3f & | rclPoint | ) | const |
Checks if the point is inside or at the border of the facet.
The point must already exactly lie on the plane defined by the facet, which is not checked. This method is very efficient.
bool MeshGeomFacet::IsPointOf | ( | const Base::Vector3f & | rclPoint, |
float | fDistance | ||
) | const |
Checks if the point is part of the facet.
A point is regarded as part of a facet if the distance is lower fDistance and the projected point in the facet normal direction is inside the triangle.
References DistancePlaneToPoint(), Base::Vector3< _Precision >::DistanceToLine(), and GetNormal().
Referenced by IntersectWithFacet().
bool MeshGeomFacet::IsPointOfFace | ( | const Base::Vector3f & | rclP, |
float | fDistance | ||
) | const |
Checks whether the given point is inside the facet with tolerance fDistance.
This method does actually the same as IsPointOf() but this implementation is done more effective through comparison of normals.
Referenced by MeshCore::MeshAlgorithm::FirstFacetToVertex(), MeshCore::MeshAlgorithm::GetFacetsFromToolMesh(), IntersectWithLine(), MeshPart::MeshProjection::projectOnMesh(), and MeshCore::MeshAlgorithm::Surround().
bool MeshGeomFacet::IsPointOfSphere | ( | const Base::Vector3f & | rP | ) | const |
The center and radius of the circum circle define a sphere in 3D.
If the point rP is part of this sphere true is returned, otherwise false.
References CenterOfCircumCircle(), DraftVecUtils::dist(), and Base::DistanceP2().
bool MeshGeomFacet::IsPointOfSphere | ( | const MeshGeomFacet & | rFacet | ) | const |
This is an overloaded member function, provided for convenience.
It behaves essentially like the above function. If one of the facet's points is inside the sphere true is returned, otherwise false.
References CenterOfCircumCircle(), DraftVecUtils::dist(), and Base::DistanceP2().
float MeshGeomFacet::MaximumAngle | ( | ) | const |
Calculates the maximum angle of a facet.
References Base::Vector3< _Precision >::GetAngle().
Referenced by MeshCore::MeshTopoAlgorithm::ShouldSwapEdge(), and MeshCore::QuasiDelaunayTriangulator::Triangulate().
float MeshGeomFacet::MinimumAngle | ( | ) | const |
Calculates the minimum angle of a facet.
References Base::Vector3< _Precision >::GetAngle(), and MeshCore::Math< Prec >::PI.
unsigned short MeshGeomFacet::NearestEdgeToPoint | ( | const Base::Vector3f & | rclPt | ) | const |
Returns the edge number of the facet that is nearest to the point rclPt.
References Base::Distance().
Referenced by MeshCore::MeshAlgorithm::FirstFacetToVertex().
void MeshGeomFacet::NearestEdgeToPoint | ( | const Base::Vector3f & | rclPt, |
float & | fDistance, | ||
unsigned short & | side | ||
) | const |
Returns the edge number side of the facet and the distance to the edge that is nearest to the point rclPt.
References Base::Distance().
void MeshCore::MeshGeomFacet::NormalInvalid | ( | ) |
float MeshCore::MeshGeomFacet::Perimeter | ( | ) | const |
Calculates the perimeter of the facet.
References Base::Distance().
Referenced by MeshCore::MeshRemoveNeedles::Fixup().
void MeshGeomFacet::ProjectFacetToPlane | ( | MeshGeomFacet & | rclFacet | ) | const |
Calculates the projection of a facet onto the plane defined by the triangle.
References GetNormal(), and IntersectPlaneWithLine().
void MeshGeomFacet::ProjectPointToPlane | ( | const Base::Vector3f & | rclPoint, |
Base::Vector3f & | rclProj | ||
) | const |
Calculates the projection of a point onto the plane defined by the triangle.
References GetNormal(), and Base::Vector3< _Precision >::ProjectToPlane().
Referenced by MeshCore::MeshAlgorithm::FirstFacetToVertex().
void MeshCore::MeshGeomFacet::ResetFlag | ( | MeshFacet::TFlagType | tF | ) |
Reset flag state.
float MeshGeomFacet::Roundness | ( | ) | const |
The roundness is in the range between 0.0 (colinear) and 1.0 (equilateral).
References Area(), and Base::Vector3< _Precision >::Sqr().
void MeshCore::MeshGeomFacet::SetFlag | ( | MeshFacet::TFlagType | tF | ) |
Set flag state.
void MeshCore::MeshGeomFacet::SetNormal | ( | const Base::Vector3f & | rclNormal | ) |
Sets the facet's normal.
References Base::Vector3< _Precision >::Normalize(), and Base::Vector3< _Precision >::Sqr().
Referenced by MeshCore::MeshInput::LoadAsciiSTL(), and MeshCore::MeshInput::LoadInventor().
void MeshGeomFacet::SubSample | ( | float | fStep, |
std::vector< Base::Vector3f > & | rclPoints | ||
) | const |
Subsamples the facet into points with resolution fStep.
References Base::Vector3< _Precision >::GetAngle(), GetGravityPoint(), Base::Vector3< _Precision >::Length(), and Base::Vector3< _Precision >::Normalize().
Referenced by MeshCore::MeshSearchNeighbours::SampleAllFacets(), and MeshCore::MeshAlgorithm::SubSampleByDist().
void MeshGeomFacet::Transform | ( | const Base::Matrix4D & | mat | ) |
Apply a transformation on the triangle.
References Base::Matrix4D::multVec(), and NormalInvalid().
Referenced by Inspection::InspectNominalMesh::getDistance(), and Inspection::InspectNominalFastMesh::getDistance().
float MeshGeomFacet::VolumeOfPrism | ( | const MeshGeomFacet & | rclF | ) | const |
Calculates the volume of the prism defined by two facets.
bool MeshGeomFacet::Weights | ( | const Base::Vector3f & | rclP, |
float & | w0, | ||
float & | w1, | ||
float & | w2 | ||
) | const |
Calculates the weights w1, ..., w3 of the corners to get the point rclP, i.e.
rclP = w0*v0 + w1*v1 + w2*v2 (v0-v2 are the corners corners). If w0+w1+w2==1.0 then the point rclP lies on the plane that is spanned by the facet, otherwise the point doesn't lie on the plane. If the sum of wi is 1 and if each wi is between [0,1] than the point lies inside the facet or on the border, respectively.
If the point doesn't lie on the plane false is returned, true otherwise.
References Area(), and MeshGeomFacet().