com.mascotcapsule.micro3d.v3
Class AffineTrans

java.lang.Object
  extended bycom.mascotcapsule.micro3d.v3.AffineTrans

public class AffineTrans
extends java.lang.Object

This class handles 3D affine transformation matrices. It allows the setting of various transformation matrices that signify activities such as rotating an object. The elements of the matrices are expressed so that the value 1.0 amounts to 4096 units. Each element is a 32-bit signed integer value. Operations take place within the int (32 bit) range. If an overflow that exceeds the int width occurs during a mathematical operation, the operational results will be considered undefined.


Field Summary
 int m00
          Row 1 column 1 element.
 int m01
          Row 1 column 2 element.
 int m02
          Row 1 column 3 element.
 int m03
          Row 1 column 4 element.
 int m10
          Row 2 column 1 element.
 int m11
          Row 2 column 2 element.
 int m12
          Row 2 column 3 element.
 int m13
          Row 2 column 4 element.
 int m20
          Row 3 column 1 element.
 int m21
          Row 3 column 2 element.
 int m22
          Row 3 column 3 element.
 int m23
          Row 3 column 4 element.
 
Constructor Summary
AffineTrans()
          Creates a matrix in which all elements are 0.
AffineTrans(AffineTrans a)
          Creates a copy of the other matrices.
AffineTrans(int[] a)
          Creates a matrix by specifying the values of all elements.
AffineTrans(int[][] a)
          Creates a matrix by specifying the values of all elements.
AffineTrans(int[] a, int offset)
          Creates a matrix by specifying the values of all elements.
AffineTrans(int m00, int m01, int m02, int m03, int m10, int m11, int m12, int m13, int m20, int m21, int m22, int m23)
          Creates a matrix by specifying the values of all elements.
 
Method Summary
 void get(int[] a)
          Gets the values of all elements.
 void get(int[] a, int offset)
          Gets the values of all elements.
 void lookAt(Vector3D pos, Vector3D look, Vector3D up)
          Sets the matrix elements so that they become the transformations for the viewing position coordinates.
 void mul(AffineTrans a)
          Calculates the product (this ?~ a) of the transformation matrix.
 void mul(AffineTrans a1, AffineTrans a2)
          Calculates the product (a1 ?~ a2) of the transformation matrix.
 void multiply(AffineTrans a)
          Deprecated. Method to be eliminated in the near future.
 void multiply(AffineTrans a1, AffineTrans a2)
          Deprecated. Method to be eliminated in the near future.
 void rotationV(Vector3D v, int r)
          Deprecated. Method to be eliminated in the near future.
 void rotationX(int r)
          In a right-hand coordinate system, enter the matrix elements so that the rotation transformation is centered on the x axis.
 void rotationY(int r)
          In a right-hand coordinate system, enter the matrix elements so that the rotation transformation is centered on the y axis.
 void rotationZ(int r)
          In a right-hand coordinate system, enter the matrix elements so that the rotation transformation is centered on the z axis.
 void set(AffineTrans a)
          Copies the content of the other matrices.
 void set(int[] a)
          Sets the value of all elements.
 void set(int[][] a)
          Sets the values of all elements.
 void set(int[] a, int offset)
          Enters the values of all elements.
 void set(int m00, int m01, int m02, int m03, int m10, int m11, int m12, int m13, int m20, int m21, int m22, int m23)
          Sets the values of all elements.
 void setIdentity()
          Enters the matrix element so that it becomes an identity transformation.
 void setRotation(Vector3D v, int r)
          In a right-hand coordinate system, enter the matrix element settings so that there is rotational transformation that is centered on the specified vector.
 void setRotationX(int r)
          Deprecated. Method to be eliminated in the near future.
 void setRotationY(int r)
          Deprecated. Method to be eliminated in the near future.
 void setRotationZ(int r)
          Deprecated. Method to be eliminated in the near future.
 void setViewTrans(Vector3D pos, Vector3D look, Vector3D up)
          Deprecated. Method to be eliminated in the near future.
 Vector3D transform(Vector3D v)
          Transforms vectors indicating the point coordinates using this transformation matrix and uses the vectors showing the results as the return values.
 Vector3D transPoint(Vector3D v)
          Deprecated. Method to be eliminated in the near future.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

m00

public int m00
Row 1 column 1 element.


m01

public int m01
Row 1 column 2 element.


m02

public int m02
Row 1 column 3 element.


m03

public int m03
Row 1 column 4 element.


m10

public int m10
Row 2 column 1 element.


m11

public int m11
Row 2 column 2 element.


m12

public int m12
Row 2 column 3 element.


m13

public int m13
Row 2 column 4 element.


m20

public int m20
Row 3 column 1 element.


m21

public int m21
Row 3 column 2 element.


m22

public int m22
Row 3 column 3 element.


m23

public int m23
Row 3 column 4 element.

Constructor Detail

AffineTrans

public AffineTrans()
Creates a matrix in which all elements are 0.


AffineTrans

public AffineTrans(int m00,
                   int m01,
                   int m02,
                   int m03,
                   int m10,
                   int m11,
                   int m12,
                   int m13,
                   int m20,
                   int m21,
                   int m22,
                   int m23)
Creates a matrix by specifying the values of all elements.


AffineTrans

public AffineTrans(AffineTrans a)
Creates a copy of the other matrices.

Parameters:
a - The matrix that was copied
Throws:
java.lang.NullPointerException - When the argument a is null.

AffineTrans

public AffineTrans(int[][] a)
Creates a matrix by specifying the values of all elements. The number of array elements must be at least 4 x 3.

Parameters:
a - 2-dimensional array
Throws:
java.lang.NullPointerException - When argument a is null. When one of the elements of a[] is null.
java.lang.IllegalArgumentException - When the number of elements is insufficient.

AffineTrans

public AffineTrans(int[] a)
Creates a matrix by specifying the values of all elements. The number of array elements must be at least 12.

Parameters:
a - 1-dimensional array
Throws:
java.lang.NullPointerException - When argument a is null.
java.lang.IllegalArgumentException - When the number of elements is insufficient.

AffineTrans

public AffineTrans(int[] a,
                   int offset)
Creates a matrix by specifying the values of all elements.

Parameters:
a - 1-dimensional array
offset - Start position
Throws:
java.lang.NullPointerException - When argument a is null.
java.lang.IllegalArgumentException - When the number of elements is insufficient.
Method Detail

setRotationX

public final void setRotationX(int r)
Deprecated. Method to be eliminated in the near future.

See Also:
setRotationX(int)

setRotationY

public final void setRotationY(int r)
Deprecated. Method to be eliminated in the near future.

See Also:
setRotationY(int)

setRotationZ

public final void setRotationZ(int r)
Deprecated. Method to be eliminated in the near future.

See Also:
setRotationZ(int)

setIdentity

public final void setIdentity()
Enters the matrix element so that it becomes an identity transformation. The result will be the same as that for calling the set(4096, 0, 0, 0, 0, 4096, 0, 0, 0, 0, 4096, 0).


get

public final void get(int[] a)
Gets the values of all elements.

Parameters:
a - 1-dimensional array
Throws:
java.lang.NullPointerException - When argument a is null.
java.lang.IllegalArgumentException - When the number of elements is insufficient.

get

public final void get(int[] a,
                      int offset)
Gets the values of all elements.

Parameters:
a - 1-dimensional array
offset - Start position
Throws:
java.lang.NullPointerException - When argument a is null.
java.lang.IllegalArgumentException - When the number of elements is insufficient.

set

public final void set(int[] a,
                      int offset)
Enters the values of all elements.

Parameters:
a - 1-dimensional array
offset - Start position
Throws:
java.lang.NullPointerException - When argument a is null.
java.lang.IllegalArgumentException - When the number of elements is insufficient.

set

public final void set(int m00,
                      int m01,
                      int m02,
                      int m03,
                      int m10,
                      int m11,
                      int m12,
                      int m13,
                      int m20,
                      int m21,
                      int m22,
                      int m23)
Sets the values of all elements.


set

public final void set(AffineTrans a)
Copies the content of the other matrices.

Parameters:
a - Matrix that was copied
Throws:
java.lang.NullPointerException - When a is null.

set

public final void set(int[][] a)
Sets the values of all elements. There must be at least 3 x 4 array elements.

Parameters:
a - 2idimensional array
Throws:
java.lang.NullPointerException - When argument a is null. When any element of a[] is null.
java.lang.IllegalArgumentException - When the number of elements is insufficient.

set

public final void set(int[] a)
Sets the value of all elements. There must be at least 12 array elements.

Parameters:
a - 1-dimensional array
Throws:
java.lang.NullPointerException - When argument a is null.
java.lang.IllegalArgumentException - When the number of elements is insufficient.

transPoint

public final Vector3D transPoint(Vector3D v)
Deprecated. Method to be eliminated in the near future.

See Also:
transform(com.mascotcapsule.micro3d.v3.Vector3D)

transform

public final Vector3D transform(Vector3D v)
Transforms vectors indicating the point coordinates using this transformation matrix and uses the vectors showing the results as the return values.

Parameters:
v - Point vector
Throws:
java.lang.NullPointerException - When the number of elements is null.

rotationX

public final void rotationX(int r)
In a right-hand coordinate system, enter the matrix elements so that the rotation transformation is centered on the x axis. Seen from forward direction of the x axis, the direction of rotation is counterclockwise (the direction from the y axis to the z axis, through the smaller of the angles formed by the y and z axes). The fourth column is not transformed.

Parameters:
r - Angle of rotatio. Specifies 4096 divisions of a circle (2*PI is equivalent to 4096).

rotationY

public final void rotationY(int r)
In a right-hand coordinate system, enter the matrix elements so that the rotation transformation is centered on the y axis. Seen from forward direction of the y axis, the direction of rotation is counterclockwise (the direction from the z axis to the x axis, through the smaller of the angles formed by the z and x axes). The fourth column is not transformed.

Parameters:
r - Angle of rotation. Specifies 4096 divisions of a circle (2*PI is equivalent to 4096).

rotationZ

public final void rotationZ(int r)
In a right-hand coordinate system, enter the matrix elements so that the rotation transformation is centered on the z axis. Seen from forward direction of the z axis, the direction of rotation is counterclockwise (the direction from the x axis to the y axis, through the smaller of the angles formed by the x and y axes). The fourth column is not transformed.

Parameters:
r - Angle of rotation. Specifies 4096 divisions of a circle (2*PI equivalent to 4096).

multiply

public final void multiply(AffineTrans a)
Deprecated. Method to be eliminated in the near future.

See Also:
mul(AffineTrans)

mul

public final void mul(AffineTrans a)
Calculates the product (this ?~ a) of the transformation matrix. The result will be entered into this object.

Parameters:
a - Matrix
Throws:
java.lang.NullPointerException - When argument a is null.

multiply

public final void multiply(AffineTrans a1,
                           AffineTrans a2)
Deprecated. Method to be eliminated in the near future.

See Also:
mul(AffineTrans,AffineTrans)

mul

public final void mul(AffineTrans a1,
                      AffineTrans a2)
Calculates the product (a1 ?~ a2) of the transformation matrix. The result will be entered into this object.

Parameters:
a1 - Matrix 1
a2 - Matrix 2
Throws:
java.lang.NullPointerException - When argument a1 or a2 is null.

rotationV

public final void rotationV(Vector3D v,
                            int r)
Deprecated. Method to be eliminated in the near future.

See Also:
setRotation(com.mascotcapsule.micro3d.v3.Vector3D, int)

setRotation

public final void setRotation(Vector3D v,
                              int r)
In a right-hand coordinate system, enter the matrix element settings so that there is rotational transformation that is centered on the specified vector.

Parameters:
v - Vector
Throws:
java.lang.NullPointerException - When the argument is null.

setViewTrans

public final void setViewTrans(Vector3D pos,
                               Vector3D look,
                               Vector3D up)
Deprecated. Method to be eliminated in the near future.

See Also:
lookAt(com.mascotcapsule.micro3d.v3.Vector3D, com.mascotcapsule.micro3d.v3.Vector3D, com.mascotcapsule.micro3d.v3.Vector3D)

lookAt

public final void lookAt(Vector3D pos,
                         Vector3D look,
                         Vector3D up)
Sets the matrix elements so that they become the transformations for the viewing position coordinates. The transformation matrix that expresses the transformation to the position coordinates is set using the view position, reference point and up vector. If the line-of-sight direction and up vector are not perpendicular, the up vector will be automatically corrected so that it is perpendicular to the line-of-sight direction and the transformation matrix will be set based on that correction. The view position coordinate system is a right-handed system with the view position as the origin point and the line-of-sight direction as the +z direction.

Parameters:
pos - View position vector
look - Reference point vector
up - Up vector
Throws:
java.lang.NullPointerException - When one of the arguments is null.