Class LXTransform

java.lang.Object
heronarts.lx.transform.LXTransform

public class LXTransform extends Object
A transform is a matrix stack, quite similar to the OpenGL implementation. This class can be used to push a point around in 3-d space. The matrix itself is not directly exposed, but the x,y,z values are.
  • Constructor Details

    • LXTransform

      public LXTransform()
      Constructs a new transform with the identity matrix
    • LXTransform

      public LXTransform(LXMatrix matrix)
      Constructs a new transform with the given base matrix
      Parameters:
      matrix - Base matrix
  • Method Details

    • getMatrix

      public LXMatrix getMatrix()
      Returns the current state of the transformation matrix
      Returns:
      Top of the transformation matrix stack
    • size

      public int size()
      Returns the size of the Matrix stack
      Returns:
      Number of items in matrix stack
    • push

      public LXTransform push()
      Pushes the matrix stack, future operations can be undone by pop()
      Returns:
      this, for method chaining
    • pop

      public LXTransform pop()
      Pops the matrix stack, to its previous state
      Returns:
      this, for method chaining
    • reset

      public LXTransform reset(LXMatrix matrix)
      Reset this transform to the given matrix
      Parameters:
      matrix - Transform matrix
      Returns:
      this
    • reset

      public LXTransform reset()
      Resets this transform to a single identity matrix
      Returns:
      this
    • vector

      public LXVector vector()
      Gets the current x, y, z of the transform as a vector
      Returns:
      Vector of current position
    • x

      public float x()
      Gets the x value of the transform
      Returns:
      x value of transform
    • y

      public float y()
      Gets the y value of the transform
      Returns:
      y value of transform
    • z

      public float z()
      Gets the z value of the transform
      Returns:
      z value of transform
    • translateX

      public LXTransform translateX(float tx)
      Translates the point on the x-axis
      Parameters:
      tx - x translation
      Returns:
      this
    • translateY

      public LXTransform translateY(float ty)
      Translates the point on the y-axis
      Parameters:
      ty - y translation
      Returns:
      this
    • translateZ

      public LXTransform translateZ(float tz)
      Translates the point on the z-axis
      Parameters:
      tz - z translation
      Returns:
      this
    • translate

      public LXTransform translate(float tx, float ty)
      Translates the point, default of 0 in the z-axis
      Parameters:
      tx - x translation
      ty - y translation
      Returns:
      this
    • translate

      public LXTransform translate(float tx, float ty, float tz)
      Translates the point
      Parameters:
      tx - x translation
      ty - y translation
      tz - z translation
      Returns:
      this
    • multiply

      public LXTransform multiply(LXMatrix m)
      Multiplies the transform by a transformation matrix
      Parameters:
      m - Matrix
      Returns:
      this
    • scale

      public LXTransform scale(float sv)
      Scales the transform by the same factor on all axes
      Parameters:
      sv - Scale factor
      Returns:
      this
    • scaleX

      public LXTransform scaleX(float sx)
      Scales the transform on the X-axis
      Parameters:
      sx - Scale factor
      Returns:
      this
    • scaleY

      public LXTransform scaleY(float sy)
      Scales the transform on the Y-axis
      Parameters:
      sy - Scale factor
      Returns:
      this
    • scaleZ

      public LXTransform scaleZ(float sz)
      Scales the transform on the Z-axis
      Parameters:
      sz - Scale factor
      Returns:
      this
    • scale

      public LXTransform scale(float sx, float sy, float sz)
      Scales the transform
      Parameters:
      sx - Scale factor on X-axis
      sy - Scale factor on Y-axis
      sz - Scale factor on Z-axis
      Returns:
      this
    • rotateX

      public LXTransform rotateX(float rx)
      Rotates about the x axis
      Parameters:
      rx - Degrees, in radians
      Returns:
      this, for method chaining
    • rotateX

      public LXTransform rotateX(double rx)
      Rotates about the x axis
      Parameters:
      rx - Degrees, in radians
      Returns:
      this, for method chaining
    • rotateY

      public LXTransform rotateY(float ry)
      Rotates about the y axis
      Parameters:
      ry - Degrees, in radians
      Returns:
      this, for method chaining
    • rotateY

      public LXTransform rotateY(double ry)
      Rotates about the y axis
      Parameters:
      ry - Degrees, in radians
      Returns:
      this, for method chaining
    • rotateZ

      public LXTransform rotateZ(float rz)
      Rotates about the z axis
      Parameters:
      rz - Degrees, in radians
      Returns:
      this, for method chaining
    • rotateZ

      public LXTransform rotateZ(double rz)
      Rotates about the z axis
      Parameters:
      rz - Degrees, in radians
      Returns:
      this, for method chaining