com.badlogic.gdx.physics.box2d
Class PolygonShape
java.lang.Object
com.badlogic.gdx.physics.box2d.Shape
com.badlogic.gdx.physics.box2d.PolygonShape
public class PolygonShape
- extends Shape
Nested classes/interfaces inherited from class com.badlogic.gdx.physics.box2d.Shape |
Shape.Type |
Fields inherited from class com.badlogic.gdx.physics.box2d.Shape |
addr |
Method Summary |
Shape.Type |
getType()
Get the type of this shape. |
void |
getVertex(int index,
Vector2 vertex)
Returns the vertex at the given position. |
int |
getVertexCount()
|
void |
set(Vector2[] vertices)
Copy vertices. |
void |
setAsBox(float hx,
float hy)
Build vertices to represent an axis-aligned box. |
void |
setAsBox(float hx,
float hy,
Vector2 center,
float angle)
Build vertices to represent an oriented box. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
PolygonShape
public PolygonShape()
- Constructs a new polygon
PolygonShape
protected PolygonShape(long addr)
getType
public Shape.Type getType()
- Get the type of this shape. You can use this to down cast to the concrete shape.
- Specified by:
getType
in class Shape
- Returns:
- the shape type.
set
public void set(Vector2[] vertices)
- Copy vertices. This assumes the vertices define a convex polygon. It is assumed that the exterior is the the right of each
edge.
setAsBox
public void setAsBox(float hx,
float hy)
- Build vertices to represent an axis-aligned box.
- Parameters:
hx
- the half-width.hy
- the half-height.
setAsBox
public void setAsBox(float hx,
float hy,
Vector2 center,
float angle)
- Build vertices to represent an oriented box.
- Parameters:
hx
- the half-width.hy
- the half-height.center
- the center of the box in local coordinates.angle
- the rotation in radians of the box in local coordinates.
getVertexCount
public int getVertexCount()
- Returns:
- the number of vertices
getVertex
public void getVertex(int index,
Vector2 vertex)
- Returns the vertex at the given position.
- Parameters:
index
- the index of the vertex 0 <= index < getVertexCount( )vertex
- vertex
Copyright 2010 Mario Zechner (contact@badlogicgames.com), Nathan Sweet (admin@esotericsoftware.com)