MeshFaceList
ReferencesProvides access to the faces and Face related functionality of a Mesh.
Properties
Gets or sets the total number of mesh triangles and quads the internal data structure can hold without resizing.
Gets or sets the number of mesh faces. When getting this can includes invalid faces.
Implements: Count
Gets the number of faces that are valid quads (4 corners).
Indexers
Methods
Appends a new quadrangular face to the end of the mesh face list.
Appends a new triangular face to the end of the mesh face list.
Appends a new mesh face to the end of the mesh face list.
Parameters:
| face (MeshFace) | Face to add. |
Returns: The index of the newly added face.
Appends a list of faces to the end of the mesh face list.
Parameters:
| faces (IEnumerable<MeshFace>) | Faces to add. |
Returns: Indices of the newly created faces
Gets all faces that share a topological edge with a given face.
Parameters:
| faceIndex (int) | A face index. |
Returns: All indices that share an edge.
public int ConvertNonPlanarQuadsToTriangles(double planarTolerance, double angleToleranceRadians, int splitMethod)
Splits non-planar quads into two triangles based on given parameters.
Remarks: If both planarTolerance = Rhino.RhinoMath.UnsetValue and angleToleranceRadians = Rhino.RhinoMath.UnsetValue, then all quads are split.
Parameters:
| planarTolerance (double) | 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 (double) | 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 (int) | 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 |
Returns: Number of quads that were converted to triangles.
Splits all quads along the short diagonal.
Returns: true on success, false on failure.
public bool ConvertTrianglesToQuads(double angleToleranceRadians, double minimumDiagonalLengthRatio)
Joins adjacent triangles into quads if the resulting quad is 'nice'.
Parameters:
| angleToleranceRadians (double) | 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 (double) | ( <= 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. |
Returns: true on success, false on failure.
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.
Returns: The number of degenerate faces that were removed.
Removes a collection of faces from the mesh without affecting the remaining geometry.
Parameters:
| faceIndexes (IEnumerable<int>) | An array containing all the face indices to be removed. |
| compact (bool) | If true, removes vertices that are no longer referenced. |
Returns: The number of faces deleted on success.
Removes a collection of faces from the mesh without affecting the remaining geometry.
Parameters:
| faceIndexes (IEnumerable<int>) | An array containing all the face indices to be removed. |
Returns: The number of faces deleted on success.
public void Destroy()
Releases all memory allocated to store faces. The list capacity will be 0 after this call.
Subsequent calls can add new items.
public Mesh ExtractDuplicateFaces()
Extracts, or removes, duplicate faces.
Returns: A mesh containing the extracted duplicate faces if successful, null otherwise.
Extracts, or removes, faces.
Parameters:
| faceIndices (IEnumerable<int>) | The face indices to be extracted. |
Returns: A mesh containing the extracted faces if successful, null otherwise.
Gets an array of pairs of mesh faces that clash.
Parameters:
| maxPairCount (int) | 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. |
Returns: Array of pairs of mesh face indices.
Find all connected face indices where adjacent face normals meet the criteria of angleRadians and greaterThanAngle
Parameters:
| faceIndex (int) | face index to start from |
| angleRadians (double) | angle to use for comparison of what is connected |
| greaterThanAngle (bool) | If true angles greater than or equal to are considered connected. If false, angles less than or equal to are considered connected. |
Returns: list of connected face indices
Find all connected face indices
Parameters:
| faceIndex (int) | face index to start from |
Returns: list of connected face indices
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
Finds all of the duplicate faces.
Returns: The indexes that are duplicates of other indexes if successful. If there are no duplicate, then an empty array is returned.
Gets an enumerator that yields all faces in this collection.
Returns: The enumerator.
Returns the mesh face at the given index.
Parameters:
| index (int) | Index of face to get. Must be larger than or equal to zero and smaller than the Face Count of the mesh. |
Returns: The mesh face at the given index on success or MeshFace.Unset if the index is out of range.
Returns the mesh face at the given index.
Parameters:
| index (int) | Index of face to get. Must be larger than or equal to zero and smaller than the Face Count of the mesh. |
Returns: The mesh face at the given index on success or MeshFace.Unset if the index is out of range.
Gets the bounding box of a face.
Parameters:
| faceIndex (int) | A face index. |
Returns: A new bounding box, or BoundingBox.Empty on error.
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.
Parameters:
| faceIndex (int) | A face index. |
Returns: The center point.
public bool GetFaceVertices(int faceIndex, out Point3f a, out Point3f b, out Point3f c, out Point3f d)
Gets the 3D location of the vertices forming a face.
Parameters:
| faceIndex (int) | A face index. |
| a (out Point3f) | A first point. This out argument is assigned during the call. |
| b (out Point3f) | A second point. This out argument is assigned during the call. |
| c (out Point3f) | A third point. This out argument is assigned during the call. |
| d (out Point3f) | A fourth point. This out argument is assigned during the call. |
Returns: true if the operation succeeded, otherwise false.
Gets the topology vertex indices of a face.
Parameters:
| faceIndex (int) | A face index. |
Returns: An array of integers.
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.
Parameters:
| whollyDegenerateFaces (out int[]) | Array of indexes for faces, both triangles and quads, that have zero area. |
| partiallyDegenerateFaces (out int[]) | Array of indexes for quad faces, that have one triangle with zero area. |
Returns: Returns true if the mesh has wholly or partially degenerate faces, false otherwise.
Returns true if at least one of the face edges are not topologically connected to any other faces.
Parameters:
| faceIndex (int) | A face index. |
Returns: true if that face makes the mesh open, otherwise false.
Inserts a mesh face at a defined index in this list.
Exceptions:
| ArgumentOutOfRangeException | If index is negative or >= Count. |
Merges two triangular mesh faces that share an edge into one quadrangular face.
Parameters:
| edgeIndex (int) | The common topological edge index. |
Returns: true if successful, false otherwise.
Removes a face from the mesh.
Parameters:
| index (int) | The index of the face that will be removed. |
| compact (bool) | If true, removes vertices that are no longer referenced. |
Exceptions:
| ArgumentOutOfRangeException | If index is < 0 or >= Count. |
Removes a face from the mesh.
Parameters:
| index (int) | The index of the face that will be removed. |
Exceptions:
| ArgumentOutOfRangeException | If index is < 0 or >= Count. |
Deletes or fixes mesh faces that have zero area.
Parameters:
| fixedFaceCount (ref int) | Number of fixed partially degenerate faces. |
Returns: Number of removed wholly degenerate faces.
Sets a quadrangular face at a specific index of the mesh.
Sets a triangular face at a specific index of the mesh.
Sets a face at a specific index of the mesh.
Parameters:
| item (MeshFace) |
Parameters:
| item (MeshFace) |
Parameters:
| array (MeshFace[]) | |
| arrayIndex (int) |
Parameters:
| item (MeshFace) |
Parameters:
| item (MeshFace) |
Parameters:
| index (int) |
ToIntArray
#Copies all of the faces to a linear array of indices. Clean-up of vertex indices if replacedIndices is a valid List<int> ///