Package heronarts.lx.transform
Class LXTransform
java.lang.Object
heronarts.lx.transform.LXTransform
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 Summary
ConstructorsConstructorDescriptionConstructs a new transform with the identity matrixLXTransform(LXMatrix matrix) Constructs a new transform with the given base matrix -
Method Summary
Modifier and TypeMethodDescriptionReturns the current state of the transformation matrixMultiplies the transform by a transformation matrixpop()Pops the matrix stack, to its previous statepush()Pushes the matrix stack, future operations can be undone by pop()reset()Resets this transform to a single identity matrixReset this transform to the given matrixrotateX(double rx) Rotates about the x axisrotateX(float rx) Rotates about the x axisrotateY(double ry) Rotates about the y axisrotateY(float ry) Rotates about the y axisrotateZ(double rz) Rotates about the z axisrotateZ(float rz) Rotates about the z axisscale(float sv) Scales the transform by the same factor on all axesscale(float sx, float sy, float sz) Scales the transformscaleX(float sx) Scales the transform on the X-axisscaleY(float sy) Scales the transform on the Y-axisscaleZ(float sz) Scales the transform on the Z-axisintsize()Returns the size of the Matrix stacktranslate(float tx, float ty) Translates the point, default of 0 in the z-axistranslate(float tx, float ty, float tz) Translates the pointtranslateX(float tx) Translates the point on the x-axistranslateY(float ty) Translates the point on the y-axistranslateZ(float tz) Translates the point on the z-axisvector()Gets the current x, y, z of the transform as a vectorfloatx()Gets the x value of the transformfloaty()Gets the y value of the transformfloatz()Gets the z value of the transform
-
Constructor Details
-
LXTransform
public LXTransform()Constructs a new transform with the identity matrix -
LXTransform
Constructs a new transform with the given base matrix- Parameters:
matrix- Base matrix
-
-
Method Details
-
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
Pushes the matrix stack, future operations can be undone by pop()- Returns:
- this, for method chaining
-
pop
Pops the matrix stack, to its previous state- Returns:
- this, for method chaining
-
reset
Reset this transform to the given matrix- Parameters:
matrix- Transform matrix- Returns:
- this
-
reset
Resets this transform to a single identity matrix- Returns:
- this
-
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
Translates the point on the x-axis- Parameters:
tx- x translation- Returns:
- this
-
translateY
Translates the point on the y-axis- Parameters:
ty- y translation- Returns:
- this
-
translateZ
Translates the point on the z-axis- Parameters:
tz- z translation- Returns:
- this
-
translate
Translates the point, default of 0 in the z-axis- Parameters:
tx- x translationty- y translation- Returns:
- this
-
translate
Translates the point- Parameters:
tx- x translationty- y translationtz- z translation- Returns:
- this
-
multiply
Multiplies the transform by a transformation matrix- Parameters:
m- Matrix- Returns:
- this
-
scale
Scales the transform by the same factor on all axes- Parameters:
sv- Scale factor- Returns:
- this
-
scaleX
Scales the transform on the X-axis- Parameters:
sx- Scale factor- Returns:
- this
-
scaleY
Scales the transform on the Y-axis- Parameters:
sy- Scale factor- Returns:
- this
-
scaleZ
Scales the transform on the Z-axis- Parameters:
sz- Scale factor- Returns:
- this
-
scale
Scales the transform- Parameters:
sx- Scale factor on X-axissy- Scale factor on Y-axissz- Scale factor on Z-axis- Returns:
- this
-
rotateX
Rotates about the x axis- Parameters:
rx- Degrees, in radians- Returns:
- this, for method chaining
-
rotateX
Rotates about the x axis- Parameters:
rx- Degrees, in radians- Returns:
- this, for method chaining
-
rotateY
Rotates about the y axis- Parameters:
ry- Degrees, in radians- Returns:
- this, for method chaining
-
rotateY
Rotates about the y axis- Parameters:
ry- Degrees, in radians- Returns:
- this, for method chaining
-
rotateZ
Rotates about the z axis- Parameters:
rz- Degrees, in radians- Returns:
- this, for method chaining
-
rotateZ
Rotates about the z axis- Parameters:
rz- Degrees, in radians- Returns:
- this, for method chaining
-