A simple triangle collider.

Constructor

inlinenew(a:Point, b:Point, c:Point)

Create a new Triangle collider.

Parameters:

a

The first triangle corner.

b

The second triangle corner.

c

The third triangle corner.

Variables

a:Point

The triangle first corner.

b:Point

The triangle second corner.

c:Point

The triangle third corner.

Methods

inlinebarycentric(p:Point):Vector

Calculate barycentric coordinates for the point p

contains(p:Point):Bool

Tests if Point p is inside this Triangle.

inlinegetArea():Float

Calculates and returns the triangle area.

Result is cached between getArea and getInvArea on first call and altering a, b, or c afterwards will lead to incorrect value.

inlinegetCenter():Point

Returns a centroid of the Triangle.

inlinegetInvArea():Float

Calculates and returns the triangle area inverse.

Result is cached between getArea and getInvArea on first call and altering a, b, or c afterwards will lead to incorrect value.

Inherited Variables

Inherited Methods