|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.jbox2d.collision.shapes.Shape
org.jbox2d.collision.shapes.ChainShape
public class ChainShape
A chain shape is a free form sequence of line segments. The chain has two-sided collision, so you can use inside and outside collision. Therefore, you may use any winding order. Since there may be many vertices, they are allocated using Alloc. Connectivity information is used to create smooth collisions. WARNING The chain will not collide properly if there are self-intersections.
Field Summary | |
---|---|
int |
m_count
|
boolean |
m_hasNextVertex
|
boolean |
m_hasPrevVertex
|
Vec2 |
m_nextVertex
|
Vec2 |
m_prevVertex
|
Vec2[] |
m_vertices
|
Fields inherited from class org.jbox2d.collision.shapes.Shape |
---|
m_radius, m_type |
Constructor Summary | |
---|---|
ChainShape()
|
Method Summary | |
---|---|
Shape |
clone()
|
void |
computeAABB(AABB aabb,
Transform xf,
int childIndex)
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. |
void |
createChain(Vec2[] vertices,
int count)
Create a chain with isolated end vertices. |
void |
createLoop(Vec2[] vertices,
int count)
Create a loop. |
int |
getChildCount()
Get the number of child primitives |
void |
getChildEdge(EdgeShape edge,
int index)
Get a child edge. |
boolean |
raycast(RayCastOutput output,
RayCastInput input,
Transform xf,
int childIndex)
Cast a ray against a child shape. |
void |
setNextVertex(Vec2 nextVertex)
Establish connectivity to a vertex that follows the last vertex. |
void |
setPrevVertex(Vec2 prevVertex)
Establish connectivity to a vertex that precedes the first vertex. |
boolean |
testPoint(Transform xf,
Vec2 p)
Test a point for containment in this shape. |
Methods inherited from class org.jbox2d.collision.shapes.Shape |
---|
getRadius, getType, setRadius |
Methods inherited from class java.lang.Object |
---|
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public Vec2[] m_vertices
public int m_count
public final Vec2 m_prevVertex
public final Vec2 m_nextVertex
public boolean m_hasPrevVertex
public boolean m_hasNextVertex
Constructor Detail |
---|
public ChainShape()
Method Detail |
---|
public int getChildCount()
Shape
getChildCount
in class Shape
public void getChildEdge(EdgeShape edge, int index)
public boolean testPoint(Transform xf, Vec2 p)
Shape
testPoint
in class Shape
xf
- the shape world transform.p
- a point in world coordinates.public boolean raycast(RayCastOutput output, RayCastInput input, Transform xf, int childIndex)
Shape
raycast
in class Shape
public void computeAABB(AABB aabb, Transform xf, int childIndex)
Shape
computeAABB
in class Shape
public void computeMass(MassData massData, float density)
Shape
computeMass
in class Shape
massData
- returns the mass data for this shape.density
- the density in kilograms per meter squared.public Shape clone()
clone
in class Shape
public void createLoop(Vec2[] vertices, int count)
vertices
- an array of vertices, these are copiedcount
- the vertex countpublic void createChain(Vec2[] vertices, int count)
vertices
- an array of vertices, these are copiedcount
- the vertex countpublic void setPrevVertex(Vec2 prevVertex)
prevVertex
- public void setNextVertex(Vec2 nextVertex)
nextVertex
-
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |