org.jbox2d.collision
Class CircleShape

java.lang.Object
  extended by org.jbox2d.collision.Shape
      extended by org.jbox2d.collision.CircleShape

public class CircleShape
extends Shape

A circle shape. Create using Body.createShape(ShapeDef), not the constructor here.


Field Summary
 Vec2 m_localPosition
           
 float m_radius
           
 
Fields inherited from class org.jbox2d.collision.Shape
m_body, m_density, m_filter, m_friction, m_isSensor, m_next, m_proxyId, m_restitution, m_sweepRadius, m_type, m_userData, uid
 
Constructor Summary
CircleShape(ShapeDef def)
           
 
Method Summary
 void computeAABB(AABB aabb, XForm transform)
          Given a transform, compute the associated axis aligned bounding box for this shape.
 void computeMass(MassData massData)
          Compute the mass properties of this shape using its dimensions and density.
 void computeSweptAABB(AABB aabb, XForm transform1, XForm transform2)
          Given two transforms, compute the associated swept axis aligned bounding box for this shape.
 Vec2 getLocalPosition()
           
 float getRadius()
           
 boolean testPoint(XForm transform, Vec2 p)
          Test a point for containment in this shape.
 void updateSweepRadius(Vec2 center)
          Internal
 
Methods inherited from class org.jbox2d.collision.Shape
create, createProxy, destroy, destroyProxy, destructor, getBody, getFilterData, getFriction, getNext, getRestitution, getSweepRadius, getType, getUserData, isSensor, refilterProxy, setFilterData, setFriction, setRestitution, setUserData, synchronize
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

m_radius

public float m_radius

m_localPosition

public Vec2 m_localPosition
Constructor Detail

CircleShape

public CircleShape(ShapeDef def)
Method Detail

updateSweepRadius

public void updateSweepRadius(Vec2 center)
Description copied from class: Shape
Internal

Specified by:
updateSweepRadius in class Shape

testPoint

public boolean testPoint(XForm transform,
                         Vec2 p)
Description copied from class: Shape
Test a point for containment in this shape. This only works for convex shapes.

Specified by:
testPoint in class Shape
Parameters:
transform - the shape world transform.
p - a point in world coordinates.
Returns:
true if the point is within the shape

computeAABB

public void computeAABB(AABB aabb,
                        XForm transform)
Description copied from class: Shape
Given a transform, compute the associated axis aligned bounding box for this shape.

Specified by:
computeAABB in class Shape
Parameters:
aabb - returns the axis aligned box.
transform - the world transform of the shape.

computeSweptAABB

public void computeSweptAABB(AABB aabb,
                             XForm transform1,
                             XForm transform2)
Description copied from class: Shape
Given two transforms, compute the associated swept axis aligned bounding box for this shape.

Specified by:
computeSweptAABB in class Shape
Parameters:
aabb - returns the axis aligned box. (return parameter)
transform1 - the starting shape world transform.
transform2 - the ending shape world transform.

computeMass

public void computeMass(MassData massData)
Description copied from class: Shape
Compute the mass properties of this shape using its dimensions and density. The inertia tensor is computed about the local origin, not the centroid.

Specified by:
computeMass in class Shape
Parameters:
massData - returns the mass data for this shape. (return parameter)

getRadius

public float getRadius()

getLocalPosition

public Vec2 getLocalPosition()