org.xith3d.scenegraph
Class StaticTransform

java.lang.Object
  extended by org.xith3d.scenegraph.StaticTransform

public final class StaticTransform
extends java.lang.Object

This class staticly transforms Shapes/GeometryArrays/Points.
If you want to move, rotate or scale a Shape once or only very rare, you should use this class instead of Transform3D, since the transformation is not done each frame.


Method Summary
static void mirrorXY(Geometry src)
          In-place mirrors the vertices by the xy-plane.
static
<S extends Shape3D>
S
mirrorXY(S shape)
          In-place mirrors the vertices by the xy-plane.
static void mirrorXY(org.openmali.vecmath2.Tuple3f[] coords)
          In-place mirrors the vertices by the xy-plane.
static void mirrorYZ(Geometry src)
          In-place mirrors the vertices by the xy-plane.
static
<S extends Shape3D>
S
mirrorYZ(S shape)
          In-place mirrors the vertices by the xy-plane.
static void mirrorYZ(org.openmali.vecmath2.Tuple3f[] coords)
          In-place mirrors the vertices by the xy-plane.
static void mirrorZX(Geometry src)
          In-place mirrors the vertices by the xy-plane.
static
<S extends Shape3D>
S
mirrorZX(S shape)
          In-place mirrors the vertices by the xy-plane.
static void mirrorZX(org.openmali.vecmath2.Tuple3f[] coords)
          In-place mirrors the vertices by the xy-plane.
static void quadratic(Geometry src, org.openmali.vecmath2.Tuple3f A, org.openmali.vecmath2.Matrix3f B, org.openmali.vecmath2.Matrix3f C)
          Applies a general quadratic transform.
static
<S extends Shape3D>
S
quadratic(S shape, org.openmali.vecmath2.Tuple3f A, org.openmali.vecmath2.Matrix3f B, org.openmali.vecmath2.Matrix3f C)
          Applies a general quadratic transform.
static void rotate(Geometry src, float axisX, float axisY, float axisZ, float theta)
          Rotates the geometry by angle theta about the given axis.
static void rotate(Geometry src, org.openmali.vecmath2.Tuple3f axis, float theta)
          Rotates the geometry by angle theta about the given axis.
static
<S extends Shape3D>
S
rotate(S shape, float axisX, float axisY, float axisZ, float theta)
          Rotates the geometry by angle theta about the given axis.
static
<S extends Shape3D>
S
rotate(S shape, org.openmali.vecmath2.Tuple3f axis, float theta)
          Rotates the geometry by angle theta about the given axis.
static void rotate(org.openmali.vecmath2.Tuple3f[] coords, float axisX, float axisY, float axisZ, float theta)
          Rotates the geometry by angle theta about the given axis.
static void rotateX(Geometry src, float theta)
          Rotates the geometry by angle theta about the x-axis.
static
<S extends Shape3D>
S
rotateX(S shape, float theta)
          Rotates the geometry by angle theta about the x-axis.
static void rotateX(org.openmali.vecmath2.Tuple3f[] coords, float theta)
          Rotates the geometry by angle theta about the x-axis.
static void rotateY(Geometry src, float theta)
          Rotates the geometry by angle theta about the y-axis.
static
<S extends Shape3D>
S
rotateY(S shape, float theta)
          Rotates the geometry by angle theta about the y-axis.
static void rotateY(org.openmali.vecmath2.Tuple3f[] coords, float theta)
          Rotates the geometry by angle theta about the y-axis.
static void rotateZ(Geometry src, float theta)
          Rotates the geometry by angle theta about the z-axis.
static
<S extends Shape3D>
S
rotateZ(S shape, float theta)
          Rotates the geometry by angle theta about the z-axis.
static void rotateZ(org.openmali.vecmath2.Tuple3f[] coords, float theta)
          Rotates the geometry by angle theta about the z-axis.
static void scale(Geometry src, float scale)
          In-place multiplies the vertices in src by scale.
static void scale(Geometry src, float scaleX, float scaleY, float scaleZ)
          In-place multiplies the vertices in src by scale.
static void scale(Geometry src, org.openmali.vecmath2.Tuple3f scale)
          In-place multiplies the vertices in src by scale.
static
<S extends Shape3D>
S
scale(S shape, float scale)
          In-place multiplies the vertices in src by scale.
static
<S extends Shape3D>
S
scale(S shape, float scaleX, float scaleY, float scaleZ)
          In-place multiplies the vertices in src by scale.
static
<S extends Shape3D>
S
scale(S shape, org.openmali.vecmath2.Tuple3f scale)
          In-place multiplies the vertices in src by scale.
static void scale(org.openmali.vecmath2.Tuple3f[] coords, float scaleX, float scaleY, float scaleZ)
          In-place multiplies the vertices by scale.
static void transform(Geometry src, org.openmali.vecmath2.Matrix3f m)
          In-place multiplies each point in src by A.
static void transform(Geometry src, org.openmali.vecmath2.Matrix4f m)
          In-place multiplies each point in src by A.
static void transform(org.openmali.vecmath2.Point3f[] coords, org.openmali.vecmath2.Matrix4f m)
          In-place multiplies each point by A.
static
<S extends Shape3D>
S
transform(S shape, org.openmali.vecmath2.Matrix3f m)
          In-place multiplies each point in src by A.
static
<S extends Shape3D>
S
transform(S shape, org.openmali.vecmath2.Matrix4f m)
          In-place multiplies each point in src by A.
static void transform(org.openmali.vecmath2.Tuple3f[] coords, org.openmali.vecmath2.Matrix3f m)
          In-place multiplies each point by A.
static void translate(Geometry src, float offsetX, float offsetY, float offsetZ)
          In-place addition of an offset to each point in src.
static void translate(Geometry src, org.openmali.vecmath2.Matrix3f offset)
          Prismatically offsets each point in src.
static void translate(Geometry src, org.openmali.vecmath2.Tuple3f offset)
          In-place addition of an offset to each point in src.
static void translate(GroupNode src, float offsetX, float offsetY, float offsetZ)
          In-place addition of an offset to each point in src.
static void translate(GroupNode src, org.openmali.vecmath2.Tuple3f offset)
          In-place addition of an offset to each point in src.
static
<S extends Shape3D>
S
translate(S shape, float offsetX, float offsetY, float offsetZ)
          In-place addition of an offset to each point in src.
static
<S extends Shape3D>
S
translate(S shape, org.openmali.vecmath2.Matrix3f offset)
          Prismatically offsets each point in the shape.
static
<S extends Shape3D>
S
translate(S shape, org.openmali.vecmath2.Tuple3f offset)
          In-place addition of an offset to each point in src.
static void translate(org.openmali.vecmath2.Tuple3f[] coords, float offsetX, float offsetY, float offsetZ)
          Inplace offsets each of the given vertices by a specified offset.
static void translate(org.openmali.vecmath2.Tuple3f[] coords, org.openmali.vecmath2.Matrix3f offset)
          Prismatically offsets each point.
static void translate(org.openmali.vecmath2.Tuple3f[] coords, org.openmali.vecmath2.Tuple3f offset)
          Inplace offsets each of the given vertices by a specified offset.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

translate

public static void translate(org.openmali.vecmath2.Tuple3f[] coords,
                             float offsetX,
                             float offsetY,
                             float offsetZ)
Inplace offsets each of the given vertices by a specified offset.

Parameters:
coords - vertices array to be modified
offsetX - Shift in x dimension
offsetY - Shift in y dimension
offsetZ - Shift in z dimension

translate

public static void translate(org.openmali.vecmath2.Tuple3f[] coords,
                             org.openmali.vecmath2.Tuple3f offset)
Inplace offsets each of the given vertices by a specified offset.

Parameters:
coords - vertices array to be modified
offset - Shift in x,y,z dimension

translate

public static void translate(Geometry src,
                             float offsetX,
                             float offsetY,
                             float offsetZ)
In-place addition of an offset to each point in src.

Parameters:
src - Object to be changed
offsetX - Shift in x dimension
offsetY - Shift in y dimension
offsetZ - Shift in z dimension

translate

public static void translate(Geometry src,
                             org.openmali.vecmath2.Tuple3f offset)
In-place addition of an offset to each point in src.

Parameters:
src - Object to be changed
offset - Shift in each dimension

translate

public static <S extends Shape3D> S translate(S shape,
                                              float offsetX,
                                              float offsetY,
                                              float offsetZ)
In-place addition of an offset to each point in src.

Parameters:
shape - Object to be changed
offsetX - Shift in x dimension
offsetY - Shift in y dimension
offsetZ - Shift in z dimension
Returns:
modified shape if successful; null if not

translate

public static <S extends Shape3D> S translate(S shape,
                                              org.openmali.vecmath2.Tuple3f offset)
In-place addition of an offset to each point in src.

Parameters:
shape - Object to be changed
offset - Shift in each dimension
Returns:
modified shape if successful; null if not

translate

public static void translate(GroupNode src,
                             float offsetX,
                             float offsetY,
                             float offsetZ)
In-place addition of an offset to each point in src.

Parameters:
src - Object to be changed
offsetX - Shift in x dimension
offsetY - Shift in y dimension
offsetZ - Shift in z dimension

translate

public static void translate(GroupNode src,
                             org.openmali.vecmath2.Tuple3f offset)
In-place addition of an offset to each point in src.

Parameters:
src - Object to be changed
offset - Shift in each dimension

translate

public static void translate(org.openmali.vecmath2.Tuple3f[] coords,
                             org.openmali.vecmath2.Matrix3f offset)
Prismatically offsets each point. i.e. x <- x+a11 + a12*y + a13*z y <- a21*x + y+a22 + a23*z z <- a31*x + a32*y + z+a33

Parameters:
coords - the Vertices-coordinates to be changed
offset - Shift in each dimension

translate

public static void translate(Geometry src,
                             org.openmali.vecmath2.Matrix3f offset)
Prismatically offsets each point in src. i.e. x <- x+a11 + a12*y + a13*z y <- a21*x + y+a22 + a23*z z <- a31*x + a32*y + z+a33

Parameters:
src - Object to be changed
offset - Shift in each dimension

translate

public static <S extends Shape3D> S translate(S shape,
                                              org.openmali.vecmath2.Matrix3f offset)
Prismatically offsets each point in the shape. i.e. x <- x+a11 + a12*y + a13*z y <- a21*x + y+a22 + a23*z z <- a31*x + a32*y + z+a33

Parameters:
shape - Object to be changed
offset - Shift in each dimension
Returns:
modified shape if successful; null if not

scale

public static void scale(org.openmali.vecmath2.Tuple3f[] coords,
                         float scaleX,
                         float scaleY,
                         float scaleZ)
In-place multiplies the vertices by scale. i.e. point.x <- scale.x*point.x for all vertices and dimensions

Parameters:
coords - the Vertices-coordinates to be changed
scaleX - Scaling in x dimension
scaleY - Scaling in y dimension
scaleZ - Scaling in z dimension

scale

public static void scale(Geometry src,
                         float scaleX,
                         float scaleY,
                         float scaleZ)
In-place multiplies the vertices in src by scale. i.e. point.x <- scale.x*point.x for all vertices and dimensions

Parameters:
src - Object to be changed
scaleX - Scaling in x dimension
scaleY - Scaling in y dimension
scaleZ - Scaling in z dimension

scale

public static void scale(Geometry src,
                         org.openmali.vecmath2.Tuple3f scale)
In-place multiplies the vertices in src by scale. i.e. point.x <- scale.x*point.x for all vertices and dimensions

Parameters:
src - Object to be changed
scale - Scaling in each dimension

scale

public static <S extends Shape3D> S scale(S shape,
                                          float scaleX,
                                          float scaleY,
                                          float scaleZ)
In-place multiplies the vertices in src by scale. i.e. point.x <- scale.x*point.x for all vertices and dimensions

Parameters:
shape - Shape to be changed
scaleX - Scaling in x dimension
scaleY - Scaling in y dimension
scaleZ - Scaling in z dimension
Returns:
modified shape if successful; null if not

scale

public static void scale(Geometry src,
                         float scale)
In-place multiplies the vertices in src by scale. i.e. point.x <- scale*point.x for all vertices and dimensions

Parameters:
src - Object to be changed
scale - Scaling factor

scale

public static <S extends Shape3D> S scale(S shape,
                                          org.openmali.vecmath2.Tuple3f scale)
In-place multiplies the vertices in src by scale. i.e. point.x <- scale.x*point.x for all vertices and dimensions

Parameters:
shape - Shape to be changed
scale - Scaling in each dimension
Returns:
modified shape if successful; null if not

scale

public static <S extends Shape3D> S scale(S shape,
                                          float scale)
In-place multiplies the vertices in src by scale. i.e. point.x <- scale*point.x for all vertices and dimensions

Parameters:
shape - Object to be changed
scale - Scaling factor
Returns:
modified shape if successful; null if not

transform

public static void transform(org.openmali.vecmath2.Tuple3f[] coords,
                             org.openmali.vecmath2.Matrix3f m)
In-place multiplies each point by A. i.e. point <- A*point for all vertices This allows for arbitrary scaling, rotation, and reflection.

Parameters:
coords - the Vertices-coordinates to be changed
m - Scaling matrix

transform

public static void transform(Geometry src,
                             org.openmali.vecmath2.Matrix3f m)
In-place multiplies each point in src by A. i.e. point <- A*point for all vertices This allows for arbitrary scaling, rotation, and reflection.

Parameters:
src - Shape to be changed
m - Scaling matrix

transform

public static <S extends Shape3D> S transform(S shape,
                                              org.openmali.vecmath2.Matrix3f m)
In-place multiplies each point in src by A. i.e. point <- A*point for all vertices This allows for arbitrary scaling, rotation, and reflection.

Parameters:
shape - Shape to be changed
m - Scaling matrix
Returns:
modified shape if successful; null if not

transform

public static void transform(org.openmali.vecmath2.Point3f[] coords,
                             org.openmali.vecmath2.Matrix4f m)
In-place multiplies each point by A. i.e. point <- A*point for all vertices This allows for arbitrary scaling, rotation, and reflection.

Parameters:
coords - the Vertices-coordinates to be changed
m - transformation matrix

transform

public static void transform(Geometry src,
                             org.openmali.vecmath2.Matrix4f m)
In-place multiplies each point in src by A. i.e. point <- A*point for all vertices This allows for arbitrary scaling, rotation, and reflection.

Parameters:
src - Shape to be changed
m - transformation matrix

transform

public static <S extends Shape3D> S transform(S shape,
                                              org.openmali.vecmath2.Matrix4f m)
In-place multiplies each point in src by A. i.e. point <- A*point for all vertices This allows for arbitrary scaling, rotation, and reflection.

Parameters:
shape - Shape to be changed
m - transformation matrix
Returns:
modified shape if successful; null if not

rotate

public static void rotate(org.openmali.vecmath2.Tuple3f[] coords,
                          float axisX,
                          float axisY,
                          float axisZ,
                          float theta)
Rotates the geometry by angle theta about the given axis.

Parameters:
coords - the vertices-coordinates to change
axisX - Rotation axis x-component
axisY - Rotation axis x-component
axisZ - Rotation axis x-component
theta - Rotation angle

rotateX

public static void rotateX(org.openmali.vecmath2.Tuple3f[] coords,
                           float theta)
Rotates the geometry by angle theta about the x-axis.

Parameters:
coords - the vertices-coordinates to change
theta - Rotation angle

rotateY

public static void rotateY(org.openmali.vecmath2.Tuple3f[] coords,
                           float theta)
Rotates the geometry by angle theta about the y-axis.

Parameters:
coords - the vertices-coordinates to change
theta - Rotation angle

rotateZ

public static void rotateZ(org.openmali.vecmath2.Tuple3f[] coords,
                           float theta)
Rotates the geometry by angle theta about the z-axis.

Parameters:
coords - the vertices-coordinates to change
theta - Rotation angle

rotate

public static void rotate(Geometry src,
                          float axisX,
                          float axisY,
                          float axisZ,
                          float theta)
Rotates the geometry by angle theta about the given axis.

Parameters:
src - Shape to be changed
axisX - Rotation axis x-component
axisY - Rotation axis x-component
axisZ - Rotation axis x-component
theta - Rotation angle

rotateX

public static void rotateX(Geometry src,
                           float theta)
Rotates the geometry by angle theta about the x-axis.

Parameters:
src - Shape to be changed
theta - Rotation angle

rotateY

public static void rotateY(Geometry src,
                           float theta)
Rotates the geometry by angle theta about the y-axis.

Parameters:
src - Shape to be changed
theta - Rotation angle

rotateZ

public static void rotateZ(Geometry src,
                           float theta)
Rotates the geometry by angle theta about the z-axis.

Parameters:
src - Shape to be changed
theta - Rotation angle

rotate

public static void rotate(Geometry src,
                          org.openmali.vecmath2.Tuple3f axis,
                          float theta)
Rotates the geometry by angle theta about the given axis.

Parameters:
src - Shape to be changed
axis - Rotation axis
theta - Rotation angle

rotate

public static <S extends Shape3D> S rotate(S shape,
                                           float axisX,
                                           float axisY,
                                           float axisZ,
                                           float theta)
Rotates the geometry by angle theta about the given axis.

Parameters:
shape - Shape to be changed
axisX - Rotation axis x-component
axisY - Rotation axis x-component
axisZ - Rotation axis x-component
theta - Rotation angle
Returns:
modified shape if successful; null if not

rotateX

public static <S extends Shape3D> S rotateX(S shape,
                                            float theta)
Rotates the geometry by angle theta about the x-axis.

Parameters:
shape - Shape to be changed
theta - Rotation angle
Returns:
modified shape if successful; null if not

rotateY

public static <S extends Shape3D> S rotateY(S shape,
                                            float theta)
Rotates the geometry by angle theta about the y-axis.

Parameters:
shape - Shape to be changed
theta - Rotation angle
Returns:
modified shape if successful; null if not

rotateZ

public static <S extends Shape3D> S rotateZ(S shape,
                                            float theta)
Rotates the geometry by angle theta about the z-axis.

Parameters:
shape - Shape to be changed
theta - Rotation angle
Returns:
modified shape if successful; null if not

rotate

public static <S extends Shape3D> S rotate(S shape,
                                           org.openmali.vecmath2.Tuple3f axis,
                                           float theta)
Rotates the geometry by angle theta about the given axis.

Parameters:
shape - Shape to be changed
axis - Rotation axis
theta - Rotation angle
Returns:
modified shape if successful; null if not

mirrorXY

public static void mirrorXY(org.openmali.vecmath2.Tuple3f[] coords)
In-place mirrors the vertices by the xy-plane. Therefore the z-coordinate is inverted.

Parameters:
coords - the vertices-coordinates to change

mirrorYZ

public static void mirrorYZ(org.openmali.vecmath2.Tuple3f[] coords)
In-place mirrors the vertices by the xy-plane. Therefore the z-coordinate is inverted.

Parameters:
coords - the vertices-coordinates to change

mirrorZX

public static void mirrorZX(org.openmali.vecmath2.Tuple3f[] coords)
In-place mirrors the vertices by the xy-plane. Therefore the z-coordinate is inverted.

Parameters:
coords - the vertices-coordinates to change

mirrorXY

public static void mirrorXY(Geometry src)
In-place mirrors the vertices by the xy-plane. Therefore the z-coordinate is inverted.

Parameters:
src - Object to be changed

mirrorYZ

public static void mirrorYZ(Geometry src)
In-place mirrors the vertices by the xy-plane. Therefore the z-coordinate is inverted.

Parameters:
src - Object to be changed

mirrorZX

public static void mirrorZX(Geometry src)
In-place mirrors the vertices by the xy-plane. Therefore the z-coordinate is inverted.

Parameters:
src - Object to be changed

mirrorXY

public static <S extends Shape3D> S mirrorXY(S shape)
In-place mirrors the vertices by the xy-plane. Therefore the z-coordinate is inverted.

Parameters:
shape - Shape to be changed
Returns:
modified shape if successful; null if not

mirrorYZ

public static <S extends Shape3D> S mirrorYZ(S shape)
In-place mirrors the vertices by the xy-plane. Therefore the z-coordinate is inverted.

Parameters:
shape - Shape to be changed
Returns:
modified shape if successful; null if not

mirrorZX

public static <S extends Shape3D> S mirrorZX(S shape)
In-place mirrors the vertices by the xy-plane. Therefore the z-coordinate is inverted.

Parameters:
shape - Shape to be changed
Returns:
modified shape if successful; null if not

quadratic

public static void quadratic(Geometry src,
                             org.openmali.vecmath2.Tuple3f A,
                             org.openmali.vecmath2.Matrix3f B,
                             org.openmali.vecmath2.Matrix3f C)
Applies a general quadratic transform. p <- p + A + B*p + p*C*p i.e. x <- x + a0 + (b00*x + b01*y + b02*z) + x*(c00*x + c01*y + c02*z) y <- y + a1 + (b10*x + b11*y + b12*z) + y*(c10*x + c11*y + c12*z) z <- z + a2 + (b20*x + b21*y + b22*z) + z*(c20*x + c21*y + c22*z)

Parameters:
src - Shape to be changed
A - Constant offset
B - Linear terms
C - Quadratic terms

quadratic

public static <S extends Shape3D> S quadratic(S shape,
                                              org.openmali.vecmath2.Tuple3f A,
                                              org.openmali.vecmath2.Matrix3f B,
                                              org.openmali.vecmath2.Matrix3f C)
Applies a general quadratic transform. p <- p + A + B*p + p*C*p i.e. x <- x + a0 + (b00*x + b01*y + b02*z) + x*(c00*x + c01*y + c02*z) y <- y + a1 + (b10*x + b11*y + b12*z) + y*(c10*x + c11*y + c12*z) z <- z + a2 + (b20*x + b21*y + b22*z) + z*(c20*x + c21*y + c22*z)

Parameters:
shape - Shape to be changed
A - Constant offset
B - Linear terms
C - Quadratic terms
Returns:
modified shape if successful; null if not