|
||||||||||
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 constructor here.
Field Summary | |
---|---|
Vec2 |
m_centroid
Local position of the shape centroid in parent body frame. |
Vec2[] |
m_coreVertices
The normals of the shape. |
Vec2[] |
m_normals
The normals of the shape. |
OBB |
m_obb
The oriented bounding box 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_body, m_density, m_filter, m_friction, m_isSensor, m_next, m_proxyId, m_restitution, m_sweepRadius, m_type, m_userData, uid |
Constructor Summary | |
---|---|
PolygonShape(ShapeDef def)
|
Method Summary | |
---|---|
Vec2 |
centroid(XForm xf)
Get the centroid and apply the supplied transform. |
void |
computeAABB(AABB aabb,
XForm xf)
Given a transform, compute the associated axis aligned bounding box for this shape. |
static Vec2 |
computeCentroid(List<Vec2> vs)
|
void |
computeMass(MassData massData)
Compute the mass properties of this shape using its dimensions and density. |
static void |
computeOBB(OBB obb,
Vec2[] vs)
|
void |
computeSweptAABB(AABB aabb,
XForm transform1,
XForm transform2)
Given two transforms, compute the associated swept axis aligned bounding box for this shape. |
Vec2 |
getCentroid()
Get the local centroid relative to the parent body. |
Vec2[] |
getCoreVertices()
Get the core vertices in local coordinates. |
void |
getFirstVertexToOut(XForm xf,
Vec2 out)
Get the first vertex and apply the supplied transform. |
Vec2[] |
getNormals()
Get the edge normal vectors. |
OBB |
getOBB()
Get the oriented bounding box relative to the parent body. |
int |
getVertexCount()
Get the number of vertices. |
Vec2[] |
getVertices()
Get the vertices in local coordinates. |
void |
support(Vec2 dest,
XForm xf,
Vec2 d)
Get the support point in the given world direction. |
boolean |
testPoint(XForm xf,
Vec2 p)
Test a point for containment in this shape. |
void |
updateSweepRadius(Vec2 center)
Internal |
Methods inherited from class org.jbox2d.collision.shapes.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 |
---|
public final Vec2 m_centroid
public final OBB m_obb
public final Vec2[] m_vertices
public final Vec2[] m_normals
public final Vec2[] m_coreVertices
public int m_vertexCount
Constructor Detail |
---|
public PolygonShape(ShapeDef def)
Method Detail |
---|
public void updateSweepRadius(Vec2 center)
Shape
updateSweepRadius
in class Shape
Shape.updateSweepRadius(Vec2)
public boolean testPoint(XForm xf, Vec2 p)
Shape
testPoint
in class Shape
xf
- the shape world transform.p
- a point in world coordinates.
Shape.testPoint(XForm, Vec2)
public void support(Vec2 dest, XForm xf, Vec2 d)
support
in interface SupportsGenericDistance
SupportsGenericDistance.support(Vec2, XForm, Vec2)
public static final Vec2 computeCentroid(List<Vec2> vs)
public static void computeOBB(OBB obb, Vec2[] vs)
public void computeAABB(AABB aabb, XForm xf)
Shape
computeAABB
in class Shape
aabb
- returns the axis aligned box.xf
- the world transform of the shape.Shape.computeAABB(AABB, XForm)
public void computeSweptAABB(AABB aabb, XForm transform1, XForm transform2)
Shape
computeSweptAABB
in class Shape
aabb
- returns the axis aligned box. (return parameter)transform1
- the starting shape world transform.transform2
- the ending shape world transform.Shape.computeSweptAABB(AABB, XForm, XForm)
public void computeMass(MassData massData)
Shape
computeMass
in class Shape
massData
- returns the mass data for this shape. (return parameter)Shape.computeMass(MassData)
public void getFirstVertexToOut(XForm xf, Vec2 out)
getFirstVertexToOut
in interface SupportsGenericDistance
public OBB getOBB()
public Vec2 getCentroid()
public int getVertexCount()
public Vec2[] getVertices()
public Vec2[] getCoreVertices()
public Vec2[] getNormals()
public Vec2 centroid(XForm xf)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |