mr3d.lang
Class Point3D

java.lang.Object
  extended bymr3d.lang.Point3D
All Implemented Interfaces:
Debugable, Transformable

public class Point3D
extends java.lang.Object
implements Debugable, Transformable

The class Point3D is able to represent a 3D point in a virtual world. It is a composite object containing different vectors (Vector3D).

Since:
MR3Dv1.0
Version:
10-2004
Author:
Manuel Ruelke
See Also:
Vector3D

Field Summary
private  Vector3D base
          Base Vector.
 Vector3D cameraCoords
          Camera Coordinates Vector.
 Vector3D coords
          Coordinates Vector.
private  int OAI
          Object Array Index of the object the point belongs to.
 int x2d
          2D-representation of the 3D-point.
 int y2d
          2D-representation of the 3D-point.
 
Fields inherited from interface mr3d.debug.Debugable
ERROR_INT, ERROR_STRING
 
Constructor Summary
Point3D()
          Constructs an 3D point with all initial values for all coordinates equal 0.
Point3D(int x, int y, int z)
          Constructs an 3D point from the parameters x, y and z, which represent the x, y and z coordinates of the point.
Point3D(Vector3D coordVec)
          Constructs an 3D point from a 3D Vector, which contains representations of the x, y and z coordinates of the point.
 
Method Summary
 boolean equals(Point3D comparePoint)
          Comapes two 3D points.
 Vector3D getBase()
          Returns a copy of the base vector, which contains the original data of the 3D point.
 int getOAI()
          Returns the Object Array Index of the object the point belongs to.
 void registerOAI(int value)
          Registers the Object Array Index of the object the point belongs to.
 void reset()
          Overrides the coordinate vector coords with the base vector base.
 void resetBase(int x, int y, int z)
          Resets the initial value of this 3D point.
 void toConsole()
          Prints the contents of the object to the Java console.
 void toConsole(java.lang.String msgString)
          Prints the contents of the object to the Java console together with an information string.
 void transform(Matrix transMat)
          Performs a transformaton with the point.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

base

private Vector3D base
Base Vector. It saves the coordinates the point was initiazed with so the original position can be recovered.


cameraCoords

public Vector3D cameraCoords
Camera Coordinates Vector. It is used to store the current position of the 3D point in the camera coordinate system.


coords

public Vector3D coords
Coordinates Vector. It stores the current position of the 3D point.


OAI

private int OAI
Object Array Index of the object the point belongs to. Initial value is -1. That measn the point does not belong to an object.


x2d

public int x2d
2D-representation of the 3D-point. These variables can be used to store the point coordinates in screen coordinates after the point has been projected on the display.


y2d

public int y2d
2D-representation of the 3D-point. These variables can be used to store the point coordinates in screen coordinates after the point has been projected on the display.

Constructor Detail

Point3D

public Point3D()
Constructs an 3D point with all initial values for all coordinates equal 0.


Point3D

public Point3D(int x,
               int y,
               int z)
Constructs an 3D point from the parameters x, y and z, which represent the x, y and z coordinates of the point.

Parameters:
x - x-coordinate of the 3D point
y - y-coordinate of the 3D point
z - z-coordinate of the 3D point

Point3D

public Point3D(Vector3D coordVec)
Constructs an 3D point from a 3D Vector, which contains representations of the x, y and z coordinates of the point.

Parameters:
coordVec - vector containing the coordinates of the 3D point
Method Detail

equals

public boolean equals(Point3D comparePoint)
Comapes two 3D points. This point is compared to another specified point. The comparison involves comparing the contents of the base vector.

Parameters:
comparePoint - point to which this vector will be compared
Returns:
"true" if base vectors are equal, "false" if they are different

getBase

public Vector3D getBase()
Returns a copy of the base vector, which contains the original data of the 3D point.


getOAI

public int getOAI()
Returns the Object Array Index of the object the point belongs to.

Returns:
object array index of the point's object

registerOAI

public void registerOAI(int value)
Registers the Object Array Index of the object the point belongs to.


reset

public void reset()
Overrides the coordinate vector coords with the base vector base.


resetBase

public void resetBase(int x,
                      int y,
                      int z)
Resets the initial value of this 3D point. The vectors base and coords will be overwritten with the specified values.

Parameters:
x - x-coordinate of the 3D point
y - y-coordinate of the 3D point
z - z-coordinate of the 3D point

toConsole

public void toConsole()
Description copied from interface: Debugable
Prints the contents of the object to the Java console. How the information will be displayed depends on what data the object contains. Depending on structure and contents every implementation of this function produces a different result on the console.

Specified by:
toConsole in interface Debugable

toConsole

public void toConsole(java.lang.String msgString)
Description copied from interface: Debugable
Prints the contents of the object to the Java console together with an information string. How the information will be displayed depends on what data the object contains. Depending on structure and contents every implementation of this function produces a different result on the console.

Specified by:
toConsole in interface Debugable

transform

public void transform(Matrix transMat)
Performs a transformaton with the point. The method multiplies the coordinate vector coords with the specified matrix.

Specified by:
transform in interface Transformable
Parameters:
transMat - transformation matrix