Method CoplanarFaces
- Namespace
- GeometryHelper.Core
- Assembly
- GeometryHelper.dll
CoplanarFaces(IEnumerable<GeoFace3>)
Merges the faces of a set that share a plane and touch, using the default tolerance.
public static GeoFace3[] CoplanarFaces(IEnumerable<GeoFace3> faces)
Parameters
facesIEnumerable<GeoFace3>
Returns
- GeoFace3[]
CoplanarFaces(IEnumerable<GeoFace3>, Tolerance)
Merges the faces of a set that share a plane and touch, within a tolerance.
public static GeoFace3[] CoplanarFaces(IEnumerable<GeoFace3> faces, Tolerance tolerance)
Parameters
facesIEnumerable<GeoFace3>The faces to consider.
toleranceToleranceThe tolerance deciding which faces share a plane and which edges meet.
Returns
- GeoFace3[]
The faces with each touching coplanar group replaced by the single face covering it.
Remarks
Cutting a body leaves its surface more finely divided than it needs to be: a face split in two by a plane comes back as two faces even on the half where the cut did not really separate anything. Repeated cutting compounds that, and the face count grows without the shape changing. This puts the surface back into as few faces as describe it.
Faces are grouped by the oriented plane they lie on, so a face and one facing the other way are never merged: they are different surfaces that happen to be flat in the same place. Within a group, the edges shared by two faces cancel out and what is left is the outline of the union, which may be several separate outlines and may have one inside another — merging a ring of faces leaves a hole in the middle, and that hole is kept as a hole.
Faces in the same plane that do not touch are left as separate faces, since nothing joins them.
Two faces count as touching only where they share a whole edge. A face whose edge runs the length of two edges of its neighbours meets them at a T-junction, and nothing cancels there, so that particular join does not happen and the faces come back separate. The rest of the group still merges normally, and the total area is unchanged either way: merging under-joins rather than guessing at an outline. Surfaces that come out of cutting are free of T-junctions, since a cut divides both sides of every edge it crosses.
Vertices left in the middle of a straight run are kept rather than tidied away. They carry no shape, but removing them would leave the merged face meeting its neighbours at a T-junction wherever one of them still has the vertex, and a surface with a T-junction no longer reports itself closed.
CoplanarFaces(GeoSolid3)
Merges the coplanar faces of a solid, using the default tolerance.
public static GeoSolid3 CoplanarFaces(GeoSolid3 solid)
Parameters
solidGeoSolid3
Returns
CoplanarFaces(GeoSolid3, Tolerance)
Merges the coplanar faces of a solid, within a tolerance.
public static GeoSolid3 CoplanarFaces(GeoSolid3 solid, Tolerance tolerance)
Parameters
Returns
- GeoSolid3
The same body described by fewer faces, or the body unchanged when nothing could be merged.
Remarks
The openings are simplified along with the outer surface. A body whose faces cannot be reduced below four is handed back as it was, since fewer than four flat faces cannot enclose a volume.