nl.kun.Engine3D
Class TEntity3D

java.lang.Object
  |
  +--nl.kun.Engine3D.TVector3D
        |
        +--nl.kun.Engine3D.TCoordSys3D
              |
              +--nl.kun.Engine3D.TEntity3D
Direct Known Subclasses:
TArc3D, TCamera3D, TEntityList3D, TLabel3D, TLine2D, TLine3D, TSphere3D

public class TEntity3D
extends TCoordSys3D

This class defines a 3D entity with 3 coordinate system's, a color and a vissibility flag. All vissible 3D objects are enherited from this class.


Field Summary
 java.awt.Color color
          Main color of this object
 TCoordSys3D GlobalCords
          This coordinate system in global coordinates (same as it's own coordinate system if it does not have a parent)
 TCoordSys3D ParentGlobalCords
          The coordinate system of the parent (same as it's own coordinate system if it does not have a parent)
 boolean Vissible
          Flag which determines if this object should be drawn by the engine or not
 
Fields inherited from class nl.kun.Engine3D.TCoordSys3D
Xaxis, Yaxis, Zaxis
 
Fields inherited from class nl.kun.Engine3D.TVector3D
DBSCIENTIFIC, DBSTANDARD, x, y, z
 
Constructor Summary
TEntity3D()
          Empty constructor.
TEntity3D(double _x, double _y, double _z, double _xax, double _xay, double _xaz, double _yax, double _yay, double _yaz, double _zax, double _zay, double _zaz)
          Contructor.
TEntity3D(double _x, double _y, double _z, TVector3D _Xaxis, TVector3D _Yaxis, TVector3D _Zaxis)
          Constructor
TEntity3D(TEntity3D _Entity3D)
          Copy constructor.
TEntity3D(TVector3D _posVec, TVector3D _Xaxis, TVector3D _Yaxis, TVector3D _Zaxis)
          Constructor.
 
Method Summary
 double Depth(TCamera3D _cam)
          This routine prerenders the objects and calculates the distances from the object to the camera (depth).
 void Draw(TCamera3D _cam, Viewport _Viewport)
          Draws the vissible parts of this object onto the viewport, as if it where projecting itself on a camera.
 void InheritGlobalCords(TCoordSys3D _Parent)
          Inherits the global coordinates of it's parent, and adjusts it's own global coordinates if the local coordinate system is changed.
 void Rotate(TVector3D _PosVec, TVector3D _DirVec, double _angle)
          Rotates the object around the line determined by the position vector _PosVec and the direction vector _DirVec by an amount _angle
 TVector3D Translate(double _dx, double _dy, double _dz)
          Translates the coordinate system of this object.
 TVector3D Translate(TVector3D _dr)
          Translates the coordinate system of this object.
 TVector3D Vector3D(double _x, double _y, double _z)
          Routine is used to set the position of the object in it's parent coordinate system.
 TVector3D Vector3D(TVector3D _pos)
          Routine is used to set the position of the object in it's parent coordinate system.
 
Methods inherited from class nl.kun.Engine3D.TCoordSys3D
CoordSys3D, CoordSys3D, CoordSys3D, Global2Local, Global2Local, Global2Local, Local2Global, Local2Global, Local2Global, toString
 
Methods inherited from class nl.kun.Engine3D.TVector3D
Angle, Double2String, Double2String, Modulus, Modulus, Negate, Negate, Normalize, Normalize, NulVec, StdXaxis, StdYaxis, StdZaxis, String2Double, VAdd, VCrossProduct, VCrossProduct, VDotProduct, Vector3D, VPerpendicular, VPerpendicular, VScalarProduct, VScalarProduct, VScalarProduct, VSubstract, VSubstract
 
Methods inherited from class java.lang.Object
, clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

Vissible

public boolean Vissible
Flag which determines if this object should be drawn by the engine or not

color

public java.awt.Color color
Main color of this object

GlobalCords

public TCoordSys3D GlobalCords
This coordinate system in global coordinates (same as it's own coordinate system if it does not have a parent)

ParentGlobalCords

public TCoordSys3D ParentGlobalCords
The coordinate system of the parent (same as it's own coordinate system if it does not have a parent)
Constructor Detail

TEntity3D

public TEntity3D(double _x,
                 double _y,
                 double _z,
                 double _xax,
                 double _xay,
                 double _xaz,
                 double _yax,
                 double _yay,
                 double _yaz,
                 double _zax,
                 double _zay,
                 double _zaz)
Contructor.
Parameters:
_x - the x-value of the origin vector
_y - the y-value of the origin vector
_z - the z-value of the origin vector
_xax - the x-value of the x-axis vector
_xay - the y-value of the x-axis vector
_xaz - the z-value of the x-axis vector
_yax - the x-value of the y-axis vector
_yay - the y-value of the y-axis vector
_yaz - the z-value of the y-axis vector
_zax - the x-value of the z-axis vector
_zay - the y-value of the z-axis vector
_zaz - the z-value of the z-axis vector

TEntity3D

public TEntity3D(TVector3D _posVec,
                 TVector3D _Xaxis,
                 TVector3D _Yaxis,
                 TVector3D _Zaxis)
Constructor.
Parameters:
_posVec - The origin vector
_Xaxis - The x-axis vector
_Yaxis - The y-axis vector
_Zaxis - The z-axis vector

TEntity3D

public TEntity3D()
Empty constructor. Creates an entity with coordinate system ( (0,0,0); (1,0,0); (0,1,0); (0,0,1) )

TEntity3D

public TEntity3D(TEntity3D _Entity3D)
Copy constructor.
Parameters:
_Entity3D - Object that needs to be copied into this object.

TEntity3D

public TEntity3D(double _x,
                 double _y,
                 double _z,
                 TVector3D _Xaxis,
                 TVector3D _Yaxis,
                 TVector3D _Zaxis)
Constructor
Parameters:
_x - the x-value of the origin vector
_y - the y-value of the origin vector
_z - the z-value of the origin vector
_Xaxis - The x-axis vector
_Yaxis - The y-axis vector
_Zaxis - The z-axis vector
Method Detail

Draw

public void Draw(TCamera3D _cam,
                 Viewport _Viewport)
Draws the vissible parts of this object onto the viewport, as if it where projecting itself on a camera.
Parameters:
_cam - The camera.
_Viewport - Viewport object. This viewport object handles clipping and transformation of real world coordinates to screen coordinates. It does the real drawing on the screen.
See Also:
TCamera3D, Viewport

Depth

public double Depth(TCamera3D _cam)
This routine prerenders the objects and calculates the distances from the object to the camera (depth). If more than one 3D object is inside this object, it returns the average depth. This depth can be used by a a parent TEntityList3D object to sort all TEntity3D's according to depth.
Parameters:
_cam - The camera.

Translate

public TVector3D Translate(double _dx,
                           double _dy,
                           double _dz)
Translates the coordinate system of this object.
Overrides:
Translate in class TCoordSys3D
Parameters:
_dx - displacement in x direction
_dy - displacement in y direction
_dz - displacement in z direction

Translate

public TVector3D Translate(TVector3D _dr)
Translates the coordinate system of this object.
Overrides:
Translate in class TCoordSys3D
Parameters:
_dr - Displacement vector.

Rotate

public void Rotate(TVector3D _PosVec,
                   TVector3D _DirVec,
                   double _angle)
Rotates the object around the line determined by the position vector _PosVec and the direction vector _DirVec by an amount _angle
Overrides:
Rotate in class TCoordSys3D
Parameters:
_PosVec - Position vector of the line around which should be rotated
_DirVec - Direction vector of the line around which should be rotated
_angle - Amount of rotation in radians.

InheritGlobalCords

public void InheritGlobalCords(TCoordSys3D _Parent)
Inherits the global coordinates of it's parent, and adjusts it's own global coordinates if the local coordinate system is changed.
Parameters:
_Parent - The parent coordinate system.

Vector3D

public TVector3D Vector3D(TVector3D _pos)
Routine is used to set the position of the object in it's parent coordinate system. It automatically adjusts it's Global coordinates.
Overrides:
Vector3D in class TVector3D
Parameters:
_pos - the desired position of the object.

Vector3D

public TVector3D Vector3D(double _x,
                          double _y,
                          double _z)
Routine is used to set the position of the object in it's parent coordinate system. It automatically adjusts it's Global coordinates.
Overrides:
Vector3D in class TVector3D
Parameters:
_x - the desired x position of the object.
_y - the desired y position of the object.
_z - the desired z position of the object.