|
||||||||||
| 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.PolygonShape
public class PolygonShape
A convex polygon shape. Create using Body.createShape(ShapeDef), not the ructor here.
| Field Summary | |
|---|---|
Vec2 |
m_centroid
Local position of the shape centroid in parent body frame. |
Vec2[] |
m_normals
The normals of the shape. |
int |
m_vertexCount
Number of active vertices in the shape. |
Vec2[] |
m_vertices
The vertices of the shape. |
| Fields inherited from class org.jbox2d.collision.shapes.Shape |
|---|
m_radius, m_type |
| Constructor Summary | |
|---|---|
PolygonShape()
|
|
| Method Summary | |
|---|---|
Vec2 |
centroid(Transform xf)
Get the centroid and apply the supplied transform. |
Vec2 |
centroidToOut(Transform xf,
Vec2 out)
Get the centroid and apply the supplied transform. |
Shape |
clone()
|
void |
computeAABB(AABB argAabb,
Transform argXf)
Given a transform, compute the associated axis aligned bounding box for a child shape. |
void |
computeCentroidToOut(Vec2[] vs,
int count,
Vec2 out)
|
void |
computeMass(MassData massData,
float density)
Compute the mass properties of this shape using its dimensions and density. |
Vec2[] |
getNormals()
Get the edge normal vectors. |
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. |
Vec2[] |
getVertices()
Get the vertices in local coordinates. |
boolean |
raycast(RayCastOutput argOutput,
RayCastInput argInput,
Transform argXf)
Cast a ray against a child shape. |
void |
set(Vec2[] vertices,
int count)
Copy vertices. |
void |
setAsBox(float hx,
float hy)
Build vertices to represent an axis-aligned box. |
void |
setAsBox(float hx,
float hy,
Vec2 center,
float angle)
Build vertices to represent an oriented box. |
void |
setAsEdge(Vec2 v1,
Vec2 v2)
Set this as a single edge. |
boolean |
testPoint(Transform xf,
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 |
|---|
public final Vec2 m_centroid
public final Vec2[] m_vertices
public final Vec2[] m_normals
public int m_vertexCount
| Constructor Detail |
|---|
public PolygonShape()
| Method Detail |
|---|
public final Shape clone()
clone in class Shapepublic final int getSupport(Vec2 d)
d -
public final Vec2 getSupportVertex(Vec2 d)
d -
public final void set(Vec2[] vertices,
int count)
public final void setAsBox(float hx,
float hy)
hx - the half-width.hy - the half-height.
public final void setAsBox(float hx,
float hy,
Vec2 center,
float angle)
hx - the half-width.hy - the half-height.center - the center of the box in local coordinates.angle - the rotation of the box in local coordinates.
public final void setAsEdge(Vec2 v1,
Vec2 v2)
v1 - v2 -
public final boolean testPoint(Transform xf,
Vec2 p)
Shape
testPoint in class Shapexf - the shape world transform.p - a point in world coordinates.Shape.testPoint(Transform, Vec2)
public final void computeAABB(AABB argAabb,
Transform argXf)
Shape
computeAABB in class ShapeargAabb - returns the axis aligned box.argXf - the world transform of the shape.Shape#computeAABB(AABB, Transform, int)public final int getVertexCount()
public final Vec2 getVertex(int index)
index -
public final boolean raycast(RayCastOutput argOutput,
RayCastInput argInput,
Transform argXf)
Shape
raycast in class ShapeargOutput - the ray-cast results.argInput - the ray-cast input parameters.argXf - the transform to be applied to the shape.
org.jbox2d.collision.shapes.Shape#raycast(org.jbox2d.collision.RayCastOutput,
org.jbox2d.collision.RayCastInput, org.jbox2d.common.Transform, int)
public final void computeCentroidToOut(Vec2[] vs,
int count,
Vec2 out)
public void computeMass(MassData massData,
float density)
Shape
computeMass in class ShapemassData - returns the mass data for this shape.density - the density in kilograms per meter squared.Shape#computeMass(MassData)public Vec2[] getVertices()
public Vec2[] getNormals()
public Vec2 centroid(Transform xf)
public Vec2 centroidToOut(Transform xf,
Vec2 out)
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||