Struct Triangle
A triangle is a polygon with three edges and three vertices. It is one of the basic shapes in geometry. A triangle with vertices A, B, and C is denoted.
Inherited Members
Namespace: ProjectDawn.Geometry3D
Assembly: ProjectDawn.Geometry.dll
Syntax
[Serializable]
public struct Triangle
Constructors
| Improve this Doc View SourceTriangle(float3, float3, float3)
Declaration
public Triangle(float3 a, float3 b, float3 c)
Parameters
| Type | Name | Description |
|---|---|---|
| Unity.Mathematics.float3 | a | |
| Unity.Mathematics.float3 | b | |
| Unity.Mathematics.float3 | c |
Fields
| Improve this Doc View SourceVertexA
Declaration
public float3 VertexA
Field Value
| Type | Description |
|---|---|
| Unity.Mathematics.float3 |
VertexB
Declaration
public float3 VertexB
Field Value
| Type | Description |
|---|---|
| Unity.Mathematics.float3 |
VertexC
Declaration
public float3 VertexC
Field Value
| Type | Description |
|---|---|
| Unity.Mathematics.float3 |
Properties
| Improve this Doc View SourceArea
Returns the area of the triangle.
Declaration
public float Area { get; }
Property Value
| Type | Description |
|---|---|
| System.Single |
Center
Returns center of triangle.
Declaration
public float3 Center { get; }
Property Value
| Type | Description |
|---|---|
| Unity.Mathematics.float3 |
Normal
Returns normal of triangle. Normal direction depends from triangle clockwise order.
Declaration
public float3 Normal { get; }
Property Value
| Type | Description |
|---|---|
| Unity.Mathematics.float3 |
Perimeter
Returns the perimeter of the triangle.
Declaration
public float Perimeter { get; }
Property Value
| Type | Description |
|---|---|
| System.Single |
Methods
| Improve this Doc View SourceBarycentricCoordinates(float3)
Returns point barycentric coordinates.
Declaration
public float3 BarycentricCoordinates(float3 point)
Parameters
| Type | Name | Description |
|---|---|---|
| Unity.Mathematics.float3 | point | Point coverted to barycentric. |
Returns
| Type | Description |
|---|---|
| Unity.Mathematics.float3 |
BoundingBox()
Returns minimum rectangle that fully covers shape.
Declaration
public Box BoundingBox()
Returns
| Type | Description |
|---|---|
| Box |
GetLines(out Line, out Line, out Line)
Returns triangle lines.
Declaration
public void GetLines(out Line a, out Line b, out Line c)
Parameters
| Type | Name | Description |
|---|---|---|
| Line | a | |
| Line | b | |
| Line | c |
Intersection(Triangle, out Line)
Returns true if triangles intersect.
Declaration
public bool Intersection(Triangle triangle, out Line line)
Parameters
| Type | Name | Description |
|---|---|---|
| Triangle | triangle | Triangle. |
| Line | line | Intersection line. |
Returns
| Type | Description |
|---|---|
| System.Boolean | Returns true if triangles intersect. |
IsClockwise()
Returns if triangle vertices are clockwise ordered.
Declaration
public bool IsClockwise()
Returns
| Type | Description |
|---|---|
| System.Boolean |
IsCounterClockwise()
Returns if triangle vertices are counter clockwise ordered.
Declaration
public bool IsCounterClockwise()
Returns
| Type | Description |
|---|---|
| System.Boolean |
IsValid()
Returns true if triangle is valid.
Declaration
public bool IsValid()
Returns
| Type | Description |
|---|---|
| System.Boolean | Returns true if triangle is valid. |