public class PolygonShape extends Shape
Modifier and Type | Field and Description |
---|---|
Vec2 |
m_centroid
Local position of the shape centroid in parent body frame.
|
int |
m_count
Number of active vertices in the shape.
|
Vec2[] |
m_normals
The normals of the shape.
|
Vec2[] |
m_vertices
The vertices of the shape.
|
Constructor and Description |
---|
PolygonShape() |
Modifier and Type | Method and Description |
---|---|
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 aabb,
Transform xf,
int childIndex)
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.
|
int |
getChildCount()
Get the number of child primitives
|
Vec2[] |
getNormals()
Get the edge normal vectors.
|
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 output,
RayCastInput input,
Transform xf,
int childIndex)
Cast a ray against a child shape.
|
void |
set(Vec2[] vertices,
int count)
Create a convex hull from the given array of points.
|
void |
set(Vec2[] verts,
int num,
Vec2Array vecPool,
IntArray intPool)
Create a convex hull from the given array of points.
|
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.
|
boolean |
testPoint(Transform xf,
Vec2 p)
Test a point for containment in this shape.
|
boolean |
validate()
Validate convexity.
|
public final Vec2 m_centroid
public final Vec2[] m_vertices
public final Vec2[] m_normals
public int m_count
public final void set(Vec2[] vertices, int count)
public final void set(Vec2[] verts, int num, Vec2Array vecPool, IntArray intPool)
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 int getChildCount()
Shape
getChildCount
in class Shape
public final boolean testPoint(Transform xf, Vec2 p)
Shape
public final void computeAABB(AABB aabb, Transform xf, int childIndex)
Shape
computeAABB
in class Shape
public final int getVertexCount()
public final Vec2 getVertex(int index)
index
- public final boolean raycast(RayCastOutput output, RayCastInput input, Transform xf, int childIndex)
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 boolean validate()
public Vec2[] getVertices()
public Vec2[] getNormals()
Copyright © 2017. All Rights Reserved.