MeshFaceList

References
Provides access to the faces and Face related functionality of a Mesh.

Properties

Capacity

#Since v6.0
Gets or sets the total number of mesh triangles and quads the internal data structure can hold without resizing.
public int Capacity { get; set; }

Count

#Since v5.0
Gets or sets the number of mesh faces. When getting this can includes invalid faces.
public int Count { get; set; }
Count

QuadCount

#Since v5.0
Gets the number of faces that are valid quads (4 corners).
public int QuadCount { get; }
Explicit

ICollection<MeshFace>.IsReadOnly

#
Explicit

ICollection.IsSynchronized

#
bool ICollection.IsSynchronized
Explicit

ICollection.SyncRoot

#
Explicit

IList.IsFixedSize

#
bool IList.IsFixedSize
Explicit

IList.IsReadOnly

#
bool IList.IsReadOnly

TriangleCount

#Since v5.0
Gets the number of faces that are valid triangles (3 corners).
public int TriangleCount { get; }

Indexers

Explicit

IList.this[]

#
object IList.this[
index
]

this[]

#
Returns the mesh face at the given index.
public MeshFace this[
index
Index of face to get. Must be larger than or equal to zero and smaller than the Face Count of the mesh.
] { get; set; }

Methods

AddFace

#ExampleSince v5.0
Appends a new quadrangular face to the end of the mesh face list.
public int AddFace(
vertex1,
Index of first face corner.
vertex2,
Index of second face corner.
vertex3,
Index of third face corner.
vertex4
Index of fourth face corner.
)
The index of the newly added quad.

AddFace

#Since v5.0
Appends a new triangular face to the end of the mesh face list.
public int AddFace(
vertex1,
Index of first face corner.
vertex2,
Index of second face corner.
vertex3
Index of third face corner.
)
The index of the newly added triangle.

AddFace

#Since v5.0
Appends a new mesh face to the end of the mesh face list.
public int AddFace(
face
Face to add.
)
The index of the newly added face.

AddFaces

#Since v5.0
Appends a list of faces to the end of the mesh face list.
public int[] AddFaces(
faces
Faces to add.
)
Indices of the newly created faces

AdjacentFaces

#Since v5.0
Gets all faces that share a topological edge with a given face.
public int[] AdjacentFaces(
faceIndex
A face index.
)
All indices that share an edge.

Clear

#Since v5.0
Clears the Face list on the mesh.
public void Clear()

ConvertNonPlanarQuadsToTriangles

#Since v6.0
Splits non-planar quads into two triangles based on given parameters.
public int ConvertNonPlanarQuadsToTriangles(
planarTolerance,
If planarTolerance >= 0, then a quad is split if its vertices are not coplanar. If both planarTolerance = Rhino.RhinoMath.UnsetValue and angleToleranceRadians >= 0.0, then the planarity test is skipped.
angleToleranceRadians,
If angleToleranceRadians >= 0.0, then a quad is split if the angle between opposite corner normals is > angleToleranceRadians. The corner normal is the normal to the triangle formed by two adjacent edges and the diagonal connecting their endpoints. A quad has four corner normals. If both angleToleranceRadians = Rhino.RhinoMath.UnsetValue and planarTolerance >= 0.0, then the corner normal angle test is skipped.
splitMethod
0 default Currently divides along the short diagonal. This may be changed as better methods are found or preferences change. By passing zero, you let the developers of this code decide what's best for you over time. 1 divide along the short diagonal 2 divide along the long diagonal 3 minimize resulting area 4 maximize resulting area 5 minimize angle between triangle normals 6 maximize angle between triangle normals
)
Remarks: If both planarTolerance = Rhino.RhinoMath.UnsetValue and angleToleranceRadians = Rhino.RhinoMath.UnsetValue, then all quads are split.
Number of quads that were converted to triangles.

ConvertQuadsToTriangles

#Since v5.0
Splits all quads along the short diagonal.
public bool ConvertQuadsToTriangles()
true on success, false on failure.

ConvertTrianglesToQuads

#Since v5.0
Joins adjacent triangles into quads if the resulting quad is 'nice'.
public bool ConvertTrianglesToQuads(
angleToleranceRadians,
Used to compare adjacent triangles' face normals. For two triangles to be considered, the angle between their face normals has to be <= angleToleranceRadians. When in doubt use RhinoMath.PI/90.0 (2 degrees).
minimumDiagonalLengthRatio
( <= 1.0) For two triangles to be considered the ratio of the resulting quad's diagonals (length of the shortest diagonal)/(length of longest diagonal). has to be >= minimumDiagonalLengthRatio. When in doubt us .875.
)
true on success, false on failure.

CullDegenerateFaces

#Since v5.0
Attempts to removes degenerate faces from the mesh.

Degenerate faces are faces that contains such a combination of indices, that their final shape collapsed in a line or point.

Before returning, this method also attempts to repair faces by juggling vertex indices.

public int CullDegenerateFaces()
The number of degenerate faces that were removed.

DeleteFaces

#Since v6.6
Removes a collection of faces from the mesh without affecting the remaining geometry.
public int DeleteFaces(
faceIndexes,
An array containing all the face indices to be removed.
compact
If true, removes vertices that are no longer referenced.
)
The number of faces deleted on success.

DeleteFaces

#Since v5.0
Removes a collection of faces from the mesh without affecting the remaining geometry.
public int DeleteFaces(
faceIndexes
An array containing all the face indices to be removed.
)
The number of faces deleted on success.

Destroy

#Since v6.0
Releases all memory allocated to store faces. The list capacity will be 0 after this call.

Subsequent calls can add new items.

public void Destroy()

ExtractDuplicateFaces

#Since v6.0
Extracts, or removes, duplicate faces.
public Mesh ExtractDuplicateFaces()
A mesh containing the extracted duplicate faces if successful, null otherwise.

ExtractFaces

#Since v6.0
Extracts, or removes, faces.
public Mesh ExtractFaces(
faceIndices
The face indices to be extracted.
)
A mesh containing the extracted faces if successful, null otherwise.

GetClashingFacePairs

#Since v6.0
Gets an array of pairs of mesh faces that clash.
public IndexPair[] GetClashingFacePairs(
maxPairCount
If >0, then at most this many pairs will be added to the output array. If <=0, then all clashing pairs will be added to the output array.
)
Array of pairs of mesh face indices.

GetConnectedFaces

#Since v5.6
Find all connected face indices where adjacent face normals meet the criteria of angleRadians and greaterThanAngle
public int[] GetConnectedFaces(
faceIndex,
face index to start from
angleRadians,
angle to use for comparison of what is connected
greaterThanAngle
If true angles greater than or equal to are considered connected. If false, angles less than or equal to are considered connected.
)
list of connected face indices

GetConnectedFaces

#Since v7.1
Find all connected face indices
public int[] GetConnectedFaces(
faceIndex
face index to start from
)
list of connected face indices

GetConnectedFacesToEdges

#Since v5.6
Uses startFaceIndex and finds all connected face indexes up to unwelded or naked edges. If treatNonmanifoldLikeUnwelded is true then non-manifold edges will be considered as unwelded or naked
public int[] GetConnectedFacesToEdges(
startFaceIndex,
Initial face index
treatNonmanifoldLikeUnwelded
True means non-manifold edges will be handled like unwelded edges, False means they aren't considered
)
Array of connected face indexes

GetDuplicateFaces

#Since v6.0
Finds all of the duplicate faces.
public int[] GetDuplicateFaces()
The indexes that are duplicates of other indexes if successful. If there are no duplicate, then an empty array is returned.

GetEnumerator

#Since v5.0
Gets an enumerator that yields all faces in this collection.
public IEnumerator<MeshFace> GetEnumerator()
The enumerator.

GetFace

#Since v5.0
Returns the mesh face at the given index.
public MeshFace GetFace(
index
Index of face to get. Must be larger than or equal to zero and smaller than the Face Count of the mesh.
)
The mesh face at the given index on success or MeshFace.Unset if the index is out of range.

GetFaceAspectRatio

#Since v6.0
Returns the mesh face at the given index.
public double GetFaceAspectRatio(
index
Index of face to get. Must be larger than or equal to zero and smaller than the Face Count of the mesh.
)
The mesh face at the given index on success or MeshFace.Unset if the index is out of range.

GetFaceBoundingBox

#Since v5.0
Gets the bounding box of a face.
public BoundingBox GetFaceBoundingBox(
faceIndex
A face index.
)
A new bounding box, or BoundingBox.Empty on error.

GetFaceCenter

#Since v5.0
Gets the center point of a face.

For a triangular face, this is the centroid or barycenter.

For a quad, this is the average of four comer points.

public Point3d GetFaceCenter(
faceIndex
A face index.
)
The center point.

GetFaceVertices

#Since v5.0
Gets the 3D location of the vertices forming a face.
public bool GetFaceVertices(
faceIndex,
A face index.
out Point3f
a,
A first point. This out argument is assigned during the call.
out Point3f
b,
A second point. This out argument is assigned during the call.
out Point3f
c,
A third point. This out argument is assigned during the call.
out Point3f
d
A fourth point. This out argument is assigned during the call.
)
true if the operation succeeded, otherwise false.

GetTopologicalVertices

#Since v5.0
Gets the topology vertex indices of a face.
public int[] GetTopologicalVertices(
faceIndex
A face index.
)
An array of integers.

GetZeroAreaFaces

#Since v6.0
Examines and adds face indexes to whollyDegenerateFaces if the face is a triangle with zero area or a quad both triangles have zero area. Face indexes are added to partiallyDegenerateFaces when a quad has one triangle with zero area.
public bool GetZeroAreaFaces(
out int[]
whollyDegenerateFaces,
Array of indexes for faces, both triangles and quads, that have zero area.
out int[]
partiallyDegenerateFaces
Array of indexes for quad faces, that have one triangle with zero area.
)
Returns true if the mesh has wholly or partially degenerate faces, false otherwise.

HasNakedEdges

#Since v5.0
Returns true if at least one of the face edges are not topologically connected to any other faces.
public bool HasNakedEdges(
faceIndex
A face index.
)
true if that face makes the mesh open, otherwise false.

Insert

#Since v5.0
Inserts a mesh face at a defined index in this list.
public void Insert(
index,
An index.
face
A face.
)
ArgumentOutOfRangeExceptionIf index is negative or >= Count.

IsHidden

#Since v5.0
Gets a value indicating whether a face is hidden.

A face is hidden if, and only if, at least one of its vertices is hidden.

public bool IsHidden(
faceIndex
A face index.
)
true if hidden, false if fully visible.

MergeAdjacentFaces

#Since v7.6
Merges two triangular mesh faces that share an edge into one quadrangular face.
public bool MergeAdjacentFaces(
edgeIndex
The common topological edge index.
)
true if successful, false otherwise.

RemoveAt

#Since v6.6
Removes a face from the mesh.
public void RemoveAt(
index,
The index of the face that will be removed.
compact
If true, removes vertices that are no longer referenced.
)
ArgumentOutOfRangeExceptionIf index is < 0 or >= Count.

RemoveAt

#Since v5.0
Removes a face from the mesh.
public void RemoveAt(
index
The index of the face that will be removed.
)
ArgumentOutOfRangeExceptionIf index is < 0 or >= Count.

RemoveZeroAreaFaces

#Since v6.0
Deletes or fixes mesh faces that have zero area.
public int RemoveZeroAreaFaces(
ref int
fixedFaceCount
Number of fixed partially degenerate faces.
)
Number of removed wholly degenerate faces.

SetFace

#Since v5.0
Sets a quadrangular face at a specific index of the mesh.
public bool SetFace(
index,
A position in the list.
vertex1,
The first vertex index.
vertex2,
The second vertex index.
vertex3,
The third vertex index.
vertex4
The fourth vertex index.
)
true if the operation succeeded, otherwise false.

SetFace

#Since v5.0
Sets a triangular face at a specific index of the mesh.
public bool SetFace(
index,
A position in the list.
vertex1,
The first vertex index.
vertex2,
The second vertex index.
vertex3
The third vertex index.
)
true if the operation succeeded, otherwise false.

SetFace

#Since v5.0
Sets a face at a specific index of the mesh.
public bool SetFace(
index,
A position in the list.
face
A face.
)
true if the operation succeeded, otherwise false.
Explicit

ICollection<MeshFace>.Add

#
void ICollection<MeshFace>.Add()
Explicit

ICollection<MeshFace>.Contains

#
Explicit

ICollection<MeshFace>.CopyTo

#
void ICollection<MeshFace>.CopyTo(
array,
arrayIndex
)
Explicit

ICollection<MeshFace>.Remove

#
Explicit

IList<MeshFace>.IndexOf

#
int IList<MeshFace>.IndexOf()
Explicit

IList<MeshFace>.Insert

#Since v5.0
void IList<MeshFace>.Insert(
index,
item
)
Explicit

IList<MeshFace>.RemoveAt

#Since v5.0
void IList<MeshFace>.RemoveAt(
index
)
Explicit

ICollection.CopyTo

#
void ICollection.CopyTo(
array,
index
)
Explicit

IEnumerable.GetEnumerator

#Since v5.0
IEnumerator IEnumerable.GetEnumerator()
Explicit

IList.Add

#
int IList.Add(
value
)
Explicit

IList.Contains

#
bool IList.Contains(
value
)
Explicit

IList.IndexOf

#
int IList.IndexOf(
value
)
Explicit

IList.Insert

#
void IList.Insert(
index,
value
)
Explicit

IList.Remove

#
void IList.Remove(
value
)
Explicit

IList.RemoveAt

#Since v5.0
void IList.RemoveAt(
index
)

ToIntArray

#
Copies all of the faces to a linear array of indices. Clean-up of vertex indices if replacedIndices is a valid List<int> ///
public int[] ToIntArray(
asTriangles,
If set to true as triangles.
ref List<int>
replacedIndices
List is populated with vertex indices that were replaced with 0. If replacedIndices is null there will be no cleanup
)
The int array. This method never returns null.

ToIntArray

#Since v5.9
Copies all of the face indices to a linear array of indices per face. Note that this includes indices from invalid faces too.
public int[] ToIntArray(
asTriangles
If set to true as triangles.
)
The int array. This method never returns null.