DOTS Geometry
 
Loading...
Searching...
No Matches
NativeTriangle2D Struct Reference

Public Member Functions

float Area ()
 
float3 CalculateBarycentricCoordinates (float2 point)
 
float Determinant ()
 
Rect GetBounds ()
 Calculates the bounding rectangle of this triangle.
 
float2 GetCenter ()
 
int GetNearestEdge (float2 point)
 Returns the index of the closest edge to the given point i.e. AB = 0, BC = 1, CA = 2.
 
float2 GetPointFromBarycentricCoordinates (float u, float v, float w)
 Transforms barycentric coordinates of this triangle to cartesian coordinates.
 
bool HasRightAngle (float threshold)
 Returns true if the triangle contains a right angle (within a threshold)
 
bool IsPointInside (float2 point)
 
 NativeTriangle2D (float2 a, float2 b, float2 c)
 

Static Public Member Functions

static void CalculateCircumcircle (NativeTriangle2D triangle, out float2 center, out float radiusSq)
 Calculates the circle that circumscribes all three points of the triangle.
 
static bool IsInsideTriangleCircumcircle (NativeTriangle2D triangle, float2 point)
 Returns true, if the point is inside the circumcircle of the triangle. Only works if the triangle is sorted counter clockwise.
 

Public Attributes

float2 a
 
float2 b
 
float2 c
 

Member Function Documentation

◆ CalculateBarycentricCoordinates()

float3 CalculateBarycentricCoordinates ( float2 point)
Parameters
point
Returns
The barycentric coordinate representation within the triangle of the given cartesian point

◆ CalculateCircumcircle()

static void CalculateCircumcircle ( NativeTriangle2D triangle,
out float2 center,
out float radiusSq )
static

Calculates the circle that circumscribes all three points of the triangle.

Parameters
triangle
center
radiusSq

◆ GetBounds()

Rect GetBounds ( )

Calculates the bounding rectangle of this triangle.

Returns

◆ GetCenter()

float2 GetCenter ( )
Returns
The barycenter of the triangle

◆ GetNearestEdge()

int GetNearestEdge ( float2 point)

Returns the index of the closest edge to the given point i.e. AB = 0, BC = 1, CA = 2.

Parameters
point
Returns

◆ GetPointFromBarycentricCoordinates()

float2 GetPointFromBarycentricCoordinates ( float u,
float v,
float w )

Transforms barycentric coordinates of this triangle to cartesian coordinates.

Parameters
u
v
w
Returns

◆ HasRightAngle()

bool HasRightAngle ( float threshold)

Returns true if the triangle contains a right angle (within a threshold)

Parameters
threshold
Returns

◆ IsInsideTriangleCircumcircle()

static bool IsInsideTriangleCircumcircle ( NativeTriangle2D triangle,
float2 point )
static

Returns true, if the point is inside the circumcircle of the triangle. Only works if the triangle is sorted counter clockwise.

Parameters
triangle
point
Returns

◆ IsPointInside()

bool IsPointInside ( float2 point)
Parameters
point
Returns
True, if the point is to the left of all edges of this triangle, and false otherwise