libgdx API

com.badlogic.gdx.physics.box2d
Class Transform

java.lang.Object
  extended by com.badlogic.gdx.physics.box2d.Transform

public class Transform
extends java.lang.Object

Encodes a Box2D transform. We are lazy so we only store a 6 float wide array. First two floats are the position of the b2Transform struct. Next two floats are the b2Transform.R.col1 x and y coordinates. Final 2 floats are the b2Transform.R.col2 x and y coordinates;

Author:
mzechner

Field Summary
static int COS
           
static int POS_X
           
static int POS_Y
           
static int SIN
           
 float[] vals
           
 
Constructor Summary
Transform()
           
Transform(Vector2 position, float angle)
          Constructs a new Transform instance with the given position and angle
 
Method Summary
 Vector2 getPosition()
           
 float getRotation()
           
 Vector2 mul(Vector2 v)
          Transforms the given vector by this transform
 void setPosition(Vector2 pos)
          Sets the position of this transform
 void setRotation(float angle)
          Sets the rotation of this transform
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

POS_X

public static final int POS_X
See Also:
Constant Field Values

POS_Y

public static final int POS_Y
See Also:
Constant Field Values

COS

public static final int COS
See Also:
Constant Field Values

SIN

public static final int SIN
See Also:
Constant Field Values

vals

public float[] vals
Constructor Detail

Transform

public Transform()

Transform

public Transform(Vector2 position,
                 float angle)
Constructs a new Transform instance with the given position and angle

Parameters:
position - the position
angle - the angle in radians
Method Detail

mul

public Vector2 mul(Vector2 v)
Transforms the given vector by this transform

Parameters:
v - the vector

getPosition

public Vector2 getPosition()
Returns:
the position, modification of the vector has no effect on the Transform

setRotation

public void setRotation(float angle)
Sets the rotation of this transform

Parameters:
angle - angle in radians

getRotation

public float getRotation()

setPosition

public void setPosition(Vector2 pos)
Sets the position of this transform

Parameters:
pos - the position

libgdx API

Copyright 2010 Mario Zechner (contact@badlogicgames.com), Nathan Sweet (admin@esotericsoftware.com)