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
Constructs a new quadrangular Mesh face.
public MeshFace(
a,
Index of first corner.
b,
Index of second corner.
c,
Index of third corner.
d
Index of fourth corner.
)

MeshFace

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

Properties

A

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

B

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

C

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

D

#Since v5.0
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.
public int D { get; set; }

IsQuad

#Since v5.0
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.
public bool IsQuad { get; }

IsTriangle

#Since v5.0
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.
public bool IsTriangle { get; }

Unset

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

Indexers

this[]

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

Methods

CompareTo

#Since v6.0
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.

public int CompareTo(
other
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
Returns a value indicating whether the other mesh face has precisely the same value as the current one.
public bool Equals(
other
The other mesh face for comparison.
)
true if the other face is, also orderly, equal to the present one; otherwise false.

Equals

#
Returns a value indicating whether the other object obj has precisely the same value as the current one.
public override bool Equals(
obj
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
Reverses the orientation of the face by swapping corners. The first corner is always maintained.
public MeshFace Flip()

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.
public override int GetHashCode()
A non-unique integer that represents this mesh face.

IsValid

#Since v5.0
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.
public bool IsValid()

IsValid

#Since v5.0
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.
public bool IsValid(
vertexCount
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
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.
public bool IsValid(
points
Array of vertices with which to validate the face.
)
true if the face is considered valid, false if not.

IsValidEx

#Since v6.5
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.
public bool IsValidEx(
ref Point3d[]
points
Array of vertices with which to validate the face.
)
true if the face is considered valid, false if not.

Repair

#Since v6.0
Attempts to repair this mesh face by taking both face indexes and actual vertex locations into account.
public bool Repair(
points
Array of vertices with which to consider when repairing the face.
)
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.
true if the face was repaired, false if not.

RepairEx

#Since v6.5
Attempts to repair this mesh face by taking both face indexes and actual vertex locations into account.
public bool RepairEx(
ref Point3d[]
points
Array of vertices with which to consider when repairing the face.
)
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.
true if the face was repaired, false if not.

Set

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

Set

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

IComparable.CompareTo

#
int IComparable.CompareTo(
obj
)

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.
public override string ToString()
The string representation.

Operators

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