Packageorg.generalrelativity.foam.dynamics.collision.fine.sat
Classpublic class CirclePolygonDetector
ImplementsIFineCollisionDetector



Public Properties
 PropertyDefined by
  body : IBody
IBody to detect
CirclePolygonDetector
  circle : Circle
Circle to detect
CirclePolygonDetector
  minDistance : Number
minimum distance along the pentration axis required to resolve penetration
CirclePolygonDetector
  penetrationAxis : Vector
most direct vector out of penetration
CirclePolygonDetector
Public Methods
 MethodDefined by
  
Creates a new CirclePolygonDetector
CirclePolygonDetector
  
getContacts():Array
Gets point of contact in world-coordinates

In the case of Circle vs.

CirclePolygonDetector
  
hasCollision():Boolean
Determines whether the #circle and #body are intersecting.
CirclePolygonDetector
Property detail
bodyproperty
public var body:IBody

IBody to detect

circleproperty 
public var circle:Circle

Circle to detect

minDistanceproperty 
public var minDistance:Number

minimum distance along the pentration axis required to resolve penetration

penetrationAxisproperty 
public var penetrationAxis:Vector

most direct vector out of penetration

Constructor detail
CirclePolygonDetector()constructor
public function CirclePolygonDetector(circle:Circle, body:IBody)

Creates a new CirclePolygonDetector

Parameters
circle:Circle — Circle to check for collision
 
body:IBody — body to check for collision against
Method detail
getContacts()method
public function getContacts():Array

Gets point of contact in world-coordinates

In the case of Circle vs. anything, there will be at most 1 point of contact. That point of contact will always be on the circle's edge and can be found by moving out from the circle's position in the direction of the penetration axis by the length of the radius.

Returns
Array — Array with single Contact

See also

PolygonPolygonDetector.getContacts
hasCollision()method 
public function hasCollision():Boolean

Determines whether the #circle and #body are intersecting.

We check each axis as a contender for separation between the bodies. It's usually quite more likely in an application that objects AREN'T intersecting. For that reason, this algorithm is constructed such that it terminates as soon as possible given non-intersection. It's good to think of collision as absolute worst case scenario- its detection and resolution are the most processor intensive aspects of FOAM.

With the case of a circle, we check each of the polygon's offered axes and then the axis that's created between the closest vertex on the polygon and the Circle.

Returns
Boolean — true given penetration, false otherwise

See also