Table of Contents

Struct Triangle3D

Namespace
MathAssertions.Geometry3D
Assembly
MathAssertions.dll

Triangle defined by three vertices in 3-space. Vertex order determines the orientation of the surface normal (right-hand rule on (B - A) x (C - A)).

public readonly record struct Triangle3D : IEquatable<Triangle3D>
Implements
Inherited Members
Extension Methods

Constructors

Triangle3D(Vector3, Vector3, Vector3)

Triangle defined by three vertices in 3-space. Vertex order determines the orientation of the surface normal (right-hand rule on (B - A) x (C - A)).

public Triangle3D(Vector3 A, Vector3 B, Vector3 C)

Parameters

A Vector3

First vertex.

B Vector3

Second vertex.

C Vector3

Third vertex.

Properties

A

First vertex.

public Vector3 A { get; init; }

Property Value

Vector3

Area

Triangle area: |AB x AC| / 2. Returns zero for degenerate (collinear or coincident-vertex) triangles.

public float Area { get; }

Property Value

float

B

Second vertex.

public Vector3 B { get; init; }

Property Value

Vector3

C

Third vertex.

public Vector3 C { get; init; }

Property Value

Vector3

Centroid

Centroid of the triangle: (A + B + C) / 3.

public Vector3 Centroid { get; }

Property Value

Vector3

Normal

Unit-length surface normal computed by the right-hand rule on edges AB and AC. For degenerate triangles (collinear or coincident vertices), the underlying cross product is the zero vector and normalization yields NaN components; check IsDegenerate(Triangle3D, double) first when the input triangle's geometry is not pre-validated.

public Vector3 Normal { get; }

Property Value

Vector3