Method TriangulateSurface
- Namespace
- GeometryHelper.Geometry
- Assembly
- GeometryHelper.dll
TriangulateSurface()
Breaks the face into triangles that each lie within its material, holes included, using the default tolerance.
public GeoTriangle3[] TriangulateSurface()
Returns
TriangulateSurface(Tolerance)
Breaks the face into triangles that each lie within its material, holes included, within a tolerance.
public GeoTriangle3[] TriangulateSurface(Tolerance tolerance)
Parameters
toleranceToleranceThe tolerance within which rings count as meeting; a triangle is left out only when it has no width, within a millionth of its point tolerance.
Returns
- GeoTriangle3[]
The triangles covering the face, wound to share its normal; a small one may have no normal at the global tolerance, see the remarks.
Remarks
This is the triangulation to use wherever the mesh stands for the surface itself — ray casting, clash detection, distance to a body. Unlike Triangulate() every triangle lies inside the face, a hole is left empty rather than covered over, and a concave boundary is followed rather than spanned.
The triangles are clipped from the face's own corners while its rings stand apart. A face whose rings come within the point tolerance of each other (holes sharing an edge, a hole against the boundary) or cross, or whose loop the clipping cannot reduce, is cut into strips at its corners instead, its material read as the booleans read it: holes that touch or overlap are taken together, and one reaching past the boundary takes away only what it covers. Those triangles still lie within the material and leave every hole open, but they meet the face's edges at points of their own as well as at its corners. A face with nothing left of it gives none.
The triangles cover what the face covers, to rounding, however near its corners stand to edges they are not on. The corners of its rings were once read within the tolerance before they were cut: a wall 50 by 1.50015 with corners at 1.5 up both its sides, 0.00015 under its top ones, was meshed 0.00375 short at a thousandth, and a notch 0.0002 wide was closed. They are read within rounding now; a loop thinner than the tolerance is still a seam at it, with no triangle. A face the clipping leaves a needle of, every ear of it blocked by corners within rounding of its sides, is cut into strips too, rather than the needle dropped.
Such a face used to be handed back as the fan of its boundary, laid across every hole: a slab whose pits the clipping could not get round was meshed as 5 391 m2 for its 1 836.
A clipped triangle is left out only when it has no width: its corners lie on a line within a millionth of the point tolerance. A small one is kept, so a face 0.002 by 0.002 is its two triangles at the default tolerance, where they were once dropped as too small and left a gap in the mesh of the body they closed.
Each half of a face 0.002 by 0.002 is a triangle with its Normal and its GetPlane(), and reads as a face, where they threw. A triangle of the mesh thinner than the point tolerance, one 100 by 0.0008, has IsDegenerate(Tolerance) true, its height over its longest side being within it, and keeps its normal all the same.