org.jbox2d.collision.shapes
Class CircleShape

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

public class CircleShape
extends Shape

A circle shape.


Field Summary
 Vec2 m_p
           
 
Fields inherited from class org.jbox2d.collision.shapes.Shape
m_radius, m_type
 
Constructor Summary
CircleShape()
          this is used internally, instead use Body#createShape(ShapeDef) with a CircleDef
 
Method Summary
 Shape clone()
           
 void computeAABB(AABB argAabb, Transform argTransform)
          Given a transform, compute the associated axis aligned bounding box for a child shape.
 void computeMass(MassData massData, float density)
          Compute the mass properties of this shape using its dimensions and density.
 int getSupport(Vec2 d)
          Get the supporting vertex index in the given direction.
 Vec2 getSupportVertex(Vec2 d)
          Get the supporting vertex in the given direction.
 Vec2 getVertex(int index)
          Get a vertex by index.
 int getVertexCount()
          Get the vertex count.
 boolean raycast(RayCastOutput argOutput, RayCastInput argInput, Transform argTransform)
          Cast a ray against a child shape.
 boolean testPoint(Transform transform, Vec2 p)
          Test a point for containment in this shape.
 
Methods inherited from class org.jbox2d.collision.shapes.Shape
getType
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

m_p

public final Vec2 m_p
Constructor Detail

CircleShape

public CircleShape()
this is used internally, instead use Body#createShape(ShapeDef) with a CircleDef

Parameters:
def -
See Also:
Body#createShape(ShapeDef), CircleDef
Method Detail

clone

public final Shape clone()
Specified by:
clone in class Shape

getSupport

public final int getSupport(Vec2 d)
Get the supporting vertex index in the given direction.

Parameters:
d -
Returns:

getSupportVertex

public final Vec2 getSupportVertex(Vec2 d)
Get the supporting vertex in the given direction.

Parameters:
d -
Returns:

getVertexCount

public final int getVertexCount()
Get the vertex count.

Returns:

getVertex

public final Vec2 getVertex(int index)
Get a vertex by index.

Parameters:
index -
Returns:

testPoint

public final boolean testPoint(Transform 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.
See Also:
Shape.testPoint(Transform, Vec2)

raycast

public final boolean raycast(RayCastOutput argOutput,
                             RayCastInput argInput,
                             Transform argTransform)
Description copied from class: Shape
Cast a ray against a child shape.

Specified by:
raycast in class Shape
Parameters:
argOutput - the ray-cast results.
argInput - the ray-cast input parameters.
argTransform - the transform to be applied to the shape.
Returns:
if hit
See Also:
Shape#raycast(org.jbox2d.collision.RayCastOutput, org.jbox2d.collision.RayCastInput, org.jbox2d.common.Transform, int)

computeAABB

public final void computeAABB(AABB argAabb,
                              Transform argTransform)
Description copied from class: Shape
Given a transform, compute the associated axis aligned bounding box for a child shape.

Specified by:
computeAABB in class Shape
Parameters:
argAabb - returns the axis aligned box.
argTransform - the world transform of the shape.
See Also:
org.jbox2d.collision.shapes.Shape#computeAABB(org.jbox2d.collision.AABB, org.jbox2d.common.Transform, int)

computeMass

public final void computeMass(MassData massData,
                              float density)
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.

Specified by:
computeMass in class Shape
Parameters:
massData - returns the mass data for this shape.
density - the density in kilograms per meter squared.
See Also:
Shape.computeMass(MassData, float)


Copyright © 2012. All Rights Reserved.