Triangle

Triangle used for collision checks.

Constructor

new Triangle(a, b, c)

Create a new triangle.
Parameters:
NameTypeDescription
aVec2First point
bVec2Second point
cVec2Third point

Methods

check(other) → {Object}

Check if this triangle is overlapping with another.
Parameters:
NameTypeDescription
otherTriangleTriangle to check overlap with
Returns:
Data containing result
Type: 
Object

drawDebug(ctx)

Draw the triangles for debugging.
Parameters:
NameTypeDescription
ctxCanvasRenderingContext2DThe canvas context to draw on

project(axis, a, b, c) → {Object}

Projects points onto a specified axis and finds the minimum and maximum projection values.
Parameters:
NameTypeDescription
axisVec2Axis to project onto
aVec2First point
bVec2Second point
cVec2Third point
Returns:
Object containing minimum and maximum values.
Type: 
Object

transform(matrix) → {Triangle}

Transform a triangle with a transformation matrix.
Parameters:
NameTypeDescription
matrixTransformation matrix
Returns:
Transformed version of triangle
Type: 
Triangle