use of org.jbox2d.common.Vec2 in project libgdx by libgdx.
the class ChainShape method getVertex.
/** Returns the vertex at the given position.
* @param index the index of the vertex 0 <= index < getVertexCount( )
* @param vertex vertex */
public void getVertex(int index, Vector2 vertex) {
Vec2 v = shape.m_vertices[index];
vertex.set(v.x, v.y);
}
use of org.jbox2d.common.Vec2 in project libgdx by libgdx.
the class EdgeShape method getVertex2.
public void getVertex2(Vector2 vec) {
Vec2 v2 = shape.m_vertex2;
vec.set(v2.x, v2.y);
}
use of org.jbox2d.common.Vec2 in project libgdx by libgdx.
the class PolygonShape method set.
/** Copy vertices from the given float array, taking into account the offset and length. It is assumed the vertices are in x,y
* order and define a convex polygon. It is assumed that the exterior is the the right of each edge. */
public void set(float[] vertices, int offset, int len) {
Vec2[] v = new org.jbox2d.common.Vec2[len / 2];
for (int i = 0; i < v.length; i++) {
v[i] = new Vec2(vertices[i * 2], vertices[i * 2 + 1]);
}
shape.set(v, v.length);
}
use of org.jbox2d.common.Vec2 in project libgdx by libgdx.
the class PolygonShape method getVertex.
/** Returns the vertex at the given position.
* @param index the index of the vertex 0 <= index < getVertexCount( )
* @param vertex vertex */
public void getVertex(int index, Vector2 vertex) {
Vec2 v = shape.m_vertices[index];
vertex.set(v.x, v.y);
}
use of org.jbox2d.common.Vec2 in project libgdx by libgdx.
the class Body method getWorldPoint.
/** Get the world coordinates of a point given the local coordinates.
* @param localPoint a point on the body measured relative to the the body's origin.
* @return the same point expressed in world coordinates. */
public Vector2 getWorldPoint(Vector2 localPoint) {
tmp.set(localPoint.x, localPoint.y);
Vec2 wp = body.getWorldPoint(tmp);
return worldPoint.set(wp.x, wp.y);
}
Aggregations