Class: CollisionDispatcher

Grape2D. CollisionDispatcher

new CollisionDispatcher()

Dispatch the collisions, providing a simple interface.
Source:

Members

<private, static> dcache :Object

Object used to dispatch the collision.
Type:
  • Object
Source:

Methods

<private, static> aabbVsAabb(cchecker, aabb1, aabb2) → {boolean}

Collides an AABB against another AABB.
Parameters:
Name Type Description
cchecker Grape2D.CollisionChecker Checker of the collision.
aabb1 Grape2D.AABB An AABB.
aabb2 Grape2D.AABB Another AABB.
Source:
Returns:
Result of the collision.
Type
boolean

<private, static> aabbVsCircle(cchecker, aabb, circle) → {boolean}

Collides an AABB against a Circle.
Parameters:
Name Type Description
cchecker Grape2D.CollisionChecker Checker of the collision.
aabb Grape2D.AABB An AABB.
circle Grape2D.Circle A circle.
Source:
Returns:
Result of the collision.
Type
boolean

<private, static> aabbVsPoint(cchecker, aabb, point) → {boolean}

Checks if a point is inside an AABB.
Parameters:
Name Type Description
cchecker Grape2D.CollisionChecker Checker of the collision.
aabb Grape2D.AABB An AABB.
point Grape2D.Vector A point.
Source:
Returns:
True if inside.
Type
boolean

<private, static> aabbVsPolygon(cchecker, aabb, polygon) → {boolean}

Collides an AABB against a Polygon.
Parameters:
Name Type Description
cchecker Grape2D.CollisionChecker Checker of the collision.
aabb Grape2D.AABB An AABB.
polygon Grape2D.Polygon A polygon.
Source:
Returns:
Result of the collision.
Type
boolean

<private, static> aabbVsRay(cchecker, aabb, ray) → {boolean}

Checks if a ray intersects an AABB.
Parameters:
Name Type Description
cchecker Grape2D.CollisionChecker Checker of the collision.
aabb Grape2D.AABB An AABB.
ray Grape2D.Ray A ray.
Source:
Returns:
True if intersects.
Type
boolean

<private, static> circleVsAabb(cchecker, circle, aabb) → {boolean}

Collides a Circle against an AABB.
Parameters:
Name Type Description
cchecker Grape2D.CollisionChecker Checker of the collision.
circle Grape2D.Circle A circle.
aabb Grape2D.AABB An AABB.
Source:
Returns:
Result of the collision.
Type
boolean

<private, static> circleVsCircle(cchecker, circle1, circle2) → {boolean}

Collides a Circle against another Circle.
Parameters:
Name Type Description
cchecker Grape2D.CollisionChecker Checker of the collision.
circle1 Grape2D.Circle A circle.
circle2 Grape2D.Circle A circle.
Source:
Returns:
Result of the collision.
Type
boolean

<private, static> circleVsPoint(cchecker, circle, point) → {boolean}

Checks if a point is inside a circle.
Parameters:
Name Type Description
cchecker Grape2D.CollisionChecker Checker of the collision.
circle Grape2D.Circle A circle.
point Grape2D.Vector A point.
Source:
Returns:
True if inside.
Type
boolean

<private, static> circleVsPolygon(cchecker, circle, polygon) → {boolean}

Collides a circle against a polygon.
Parameters:
Name Type Description
cchecker Grape2D.CollisionChecker Checker of the collision.
circle Grape2D.Circle A circle.
polygon Grape2D.Polygon A polygon.
Source:
Returns:
Result of the collision.
Type
boolean

<private, static> circleVsRay(cchecker, circle, ray) → {boolean}

Checks if a ray intersects a circle.
Parameters:
Name Type Description
cchecker Grape2D.CollisionChecker Checker of the collision.
circle Grape2D.Circle A circle.
ray Grape2D.Ray A ray.
Source:
Returns:
True if intersects.
Type
boolean

<static> dispatch(cchecker, a, b) → {boolean}

Dispatches a collision between two primitives.
Parameters:
Name Type Description
cchecker Grape2D.CollisionChecker A collision checker.
a Grape2D.Shape | Grape2D.Vector | Grape2D.Ray Shape to test.
b Grape2D.Shape | Grape2D.Vector | Grape2D.Ray Shape to collide with the first one, or a point to check it it's inside.
Source:
Returns:
Result of the collision.
Type
boolean

<private, static> polygonVsAabb(cchecker, polygon, aabb) → {boolean}

Collides a polygon against an AABB.
Parameters:
Name Type Description
cchecker Grape2D.CollisionChecker Checker of the collision.
polygon Grape2D.Polygon A polygon.
aabb Grape2D.AABB An AABB.
Source:
Returns:
Result of the collision.
Type
boolean

<private, static> polygonVsCircle(cchecker, polygon, circle) → {boolean}

Collides a polygon against a circle.
Parameters:
Name Type Description
cchecker Grape2D.CollisionChecker Checker of the collision.
polygon Grape2D.Polygon A polygon.
circle Grape2D.Circle A circle.
Source:
Returns:
Result of the collision.
Type
boolean

<private, static> polygonVsPoint(cchecker, polygon, point) → {boolean}

Checks if a point is inside a polygon.
Parameters:
Name Type Description
cchecker Grape2D.CollisionChecker Checker of the collision.
polygon Grape2D.Polygon A polygon.
point Grape2D.Vector A point.
Source:
Returns:
True if inside.
Type
boolean

<private, static> polygonVsPolygon(cchecker, polygon1, polygon2) → {boolean}

Collides a polygon against another polygon.
Parameters:
Name Type Description
cchecker Grape2D.CollisionChecker Checker of the collision.
polygon1 Grape2D.Polygon A polygon.
polygon2 Grape2D.Polygon Another polygon.
Source:
Returns:
Result of the collision.
Type
boolean

<private, static> polygonVsRay(cchecker, polygon, ray) → {boolean}

Checks if a ray intersects a polygon.
Parameters:
Name Type Description
cchecker Grape2D.CollisionChecker Checker of the collision.
polygon Grape2D.Polygon A polygon.
ray Grape2D.Ray A ray.
Source:
Returns:
True if intersects.
Type
boolean