Class: SATCollisionChecker

Grape2D. SATCollisionChecker

new SATCollisionChecker()

Concrete collision checker, that implements the SAT algorithm.
Source:

Extends

Members

<private, static> SHARED_AABB_TO_VERTEX_LIST :!Array.<!Grape2D.Vector>

A cached list of vertexes. This avoids the creation of a list and four Grape2D.Vector. This is shared with all instances of collision checker, parallel usage can produce unexpected results.
Type:
Source:

Methods

<private, static> aabbToVertexList(aabb) → {!Array.<!Grape2D.Vector>}

Returns a vertex list, with length four, with vertexes of an AABB.
Parameters:
Name Type Description
aabb Grape2D.AABB An AABB.
Source:
Returns:
Vertex list of an AABB. The result is Grape2D.SATCollisionChecker#SHARED_AABB_TO_VERTEX_LIST
Type
!Array.<!Grape2D.Vector>

aabbVsAabb()

Inherited From:
Source:

aabbVsCircle()

Inherited From:
Source:

aabbVsPoint()

Inherited From:
Source:

aabbVsPolygon()

Source:

aabbVsRay()

Source:

circleVsAabb()

Inherited From:
Source:

circleVsCircle()

Inherited From:
Source:

circleVsPoint()

Inherited From:
Source:

circleVsPolygon()

Naive implementation.
Inherited From:
Source:

circleVsRay()

Source:

computeAxis(polygon) → {!Array.<!Grape2D.Vector>}

Computes the axis of a polygon.
Parameters:
Name Type Description
polygon Grape2D.Polygon Polygon to compute the axis.
Source:
Returns:
Array of vectors with the direction of the axis, perpendicular to the side, and normalized.
Type
!Array.<!Grape2D.Vector>

computeIntervals(vertexList, axis) → {Object}

Compute the interval that a set of vertexes represent, in an axis.
Parameters:
Name Type Description
vertexList !Array.<!Grape2D.Vector> List of vertexes.
axis !Array.<!Grape2D.Vector> Axis to receive the projection of the vertexes.
Source:
Returns:
An object with the properties min and max
Type
Object

polygonVsAabb()

Inherited From:
Source:

polygonVsCircle()

Inherited From:
Source:

polygonVsPoint()

Algorithm based upon Walfram's Demonstration project. http://demonstrations.wolfram.com/AnEfficientTestForAPointToBeInAConvexPolygon/
Inherited From:
Source:

polygonVsPolygon()

Source:

polygonVsRay()

Source:

selectAxis(listA, listB) → {!Array.<!Grape2D.Vector>}

Select the unique axis in a list.
Parameters:
Name Type Description
listA !Array.<!Grape2D.Vector> A list of axis.
listB !Array.<!Grape2D.Vector> A list of axis.
Source:
Returns:
All different axis that are in both params.
Type
!Array.<!Grape2D.Vector>