MeshFace

References
[StructLayout(LayoutKind.Sequential, Pack = 4, Size = 16)] [DebuggerDisplay("{DebuggerDisplayUtil}")] [Serializable] public struct MeshFace : IEquatable<MeshFace>, IComparable<MeshFace>, IComparable
Represents the values of the four indices of a mesh face quad.

If the third and fourth values are the same, this face represents a triangle.

Constructors

MeshFace

#Since v5.0
public MeshFace(int a, int b, int c, int d)
Constructs a new quadrangular Mesh face.
a (int)Index of first corner.
b (int)Index of second corner.
c (int)Index of third corner.
d (int)Index of fourth corner.

MeshFace

#Since v5.0
public MeshFace(int a, int b, int c)
Constructs a new triangular Mesh face.
a (int)Index of first corner.
b (int)Index of second corner.
c (int)Index of third corner.

Properties

A

#Since v5.0
public int A { get; set; }
Gets or sets the first corner index of the mesh face.

B

#Since v5.0
public int B { get; set; }
Gets or sets the second corner index of the mesh face.

C

#Since v5.0
public int C { get; set; }
Gets or sets the third corner index of the mesh face.

D

#Since v5.0
public int D { get; set; }
Gets or sets the fourth corner index of the mesh face. If D equals C, the mesh face is considered to be a triangle rather than a quad.

IsQuad

#Since v5.0
public bool IsQuad { get; }
Gets a value indicating whether or not this mesh face is a quad. A mesh face is considered to be a triangle when C does not equal D, thus it is possible for an Invalid mesh face to also be a quad.

IsTriangle

#Since v5.0
public bool IsTriangle { get; }
Gets a value indicating whether or not this mesh face is a triangle. A mesh face is considered to be a triangle when C equals D, thus it is possible for an Invalid mesh face to also be a triangle.

Unset

#Since v5.0
public static MeshFace Unset { get; }
Gets an Unset MeshFace. Unset faces have Int32.MinValue for all corner indices.

Indexers

this[]

#
public int this[int index] { get; set; }
Gets or sets the vertex index associated with an entry in this face.
index (int)A number in interval [0-3] that refers to an index of a vertex in this face.
The vertex index associated with this mesh face.

Methods

CompareTo

#Since v6.0
public int CompareTo(MeshFace other)
Compares this MeshFace with another MeshFace and returns a value of 1, 0, or -1, referring to dictionary order.

Index evaluation priority is first A, then B, then C, then D.

other (MeshFace)The other MeshFace to use in comparison.

0: if this is identical to other

-1: if this < other. Priority is for index of corner A first, then B, then C, then D.

+1: otherwise.

Equals

#Since v6.0
public bool Equals(MeshFace other)
Returns a value indicating whether the other mesh face has precisely the same value as the current one.
other (MeshFace)The other mesh face for comparison.
true if the other face is, also orderly, equal to the present one; otherwise false.

Equals

#
public override bool Equals(object obj)
Returns a value indicating whether the other object obj has precisely the same value as the current one.
obj (object)Any object the represents the other mesh face for comparison.
true if obj is a mesh face that, also orderly, equals to the present one; otherwise false.
ValueType.Equals

Flip

#Since v5.0
public MeshFace Flip()
Reverses the orientation of the face by swapping corners. The first corner is always maintained.

GetHashCode

#
public override int GetHashCode()
Returns a runtime-stable hash code for the current mesh face. You are not allowed to rely on persistence of this hash code in serialization, but for each version of RhinoCommon, this hash code will be the same for each mesh face.
A non-unique integer that represents this mesh face.

IsValid

#Since v5.0
public bool IsValid()
Gets a value indicating whether or not this mesh face is considered to be valid. Note that even valid mesh faces could potentially be invalid in the context of a specific Mesh, if one or more of the corner indices exceeds the number of vertices on the mesh. If you want to perform a complete validity check, use IsValid(int) instead.

IsValid

#Since v5.0
public bool IsValid(int vertexCount)
Gets a value indicating whether or not this mesh face is considered to be valid. Unlike the simple IsValid function, this function takes upper bound indices into account.
vertexCount (int)Number of vertices in the mesh that this face is a part of.
true if the face is considered valid, false if not.

IsValid

#Since v6.0
public bool IsValid(Point3d[] points)
Gets a value indicating whether or not this mesh face is considered to be valid. Unlike the simple IsValid function, this function takes actual point locations into account.
points (Point3d[])Array of vertices with which to validate the face.
true if the face is considered valid, false if not.

IsValidEx

#Since v6.5
public bool IsValidEx(ref Point3d[] points)
Gets a value indicating whether or not this mesh face is considered to be valid. Unlike the simple IsValid function, this function takes actual point locations into account.
points (ref Point3d[])Array of vertices with which to validate the face.
true if the face is considered valid, false if not.

Repair

#Since v6.0
public bool Repair(Point3d[] points)
Attempts to repair this mesh face by taking both face indexes and actual vertex locations into account.
Remarks: This function assumes the face is invalid and attempts to repair unconditionally. It is only worthwhile to call Repair on faces where IsValid returns false.
points (Point3d[])Array of vertices with which to consider when repairing the face.
true if the face was repaired, false if not.

RepairEx

#Since v6.5
public bool RepairEx(ref Point3d[] points)
Attempts to repair this mesh face by taking both face indexes and actual vertex locations into account.
Remarks: This function assumes the face is invalid and attempts to repair unconditionally. It is only worthwhile to call Repair on faces where IsValid returns false. This function is the analog of UnsafeNativeMethods.ON_MeshFace_Repair done completely here to avoid copying the point array.
points (ref Point3d[])Array of vertices with which to consider when repairing the face.
true if the face was repaired, false if not.

Set

#Since v5.0
public void Set(int a, int b, int c, int d)
Sets all the corners for this face as a quad.
a (int)Index of first corner.
b (int)Index of second corner.
c (int)Index of third corner.
d (int)Index of fourth corner.

Set

#Since v5.0
public void Set(int a, int b, int c)
Sets all the corners for this face as a triangle.
a (int)Index of first corner.
b (int)Index of second corner.
c (int)Index of third corner.
Explicit

IComparable.CompareTo

#
int IComparable.CompareTo(object obj)
obj (object)

ToString

#
public override string ToString()
Returns a string representation for this MeshFace. This is to provide a meaningful visualization of this structure and is subject to change in newer releases.
The string representation.

Operators

OperationResultDescription
MeshFace==MeshFaceboolDetermines whether two MeshFace structures have equal values.
MeshFace!=MeshFaceboolDetermines whether two MeshFace structures have different values.