nl.kun.Engine3D
Class TEntityList3D

java.lang.Object
  |
  +--nl.kun.Engine3D.TVector3D
        |
        +--nl.kun.Engine3D.TCoordSys3D
              |
              +--nl.kun.Engine3D.TEntity3D
                    |
                    +--nl.kun.Engine3D.TEntityList3D
Direct Known Subclasses:
DataStream, TOscilloscopeGrid, TPhysObject, TPolyObject3D, TSpiral3D

public class TEntityList3D
extends TEntity3D

This class defines a list of 3D entity's, with it's own coordinate systems. All composite 3D objects are derived from this class.


Field Summary
 double depth
          The depth of this object.
protected  int[] index
          List with all the ID numbers for the TEntity3D's used in Z sorting
protected  int MaxBuf
          Number of (for the camera) vissible Entity3D's
(package private) static int MAXOBJECTS
          Maximum number of objects in a ObjectList (default 1000)
 java.util.Vector ObjectList
          Vector object in which TEntity3D's can be stored.
 int size
          The length of the ObjectList
 
Fields inherited from class nl.kun.Engine3D.TEntity3D
color, GlobalCords, ParentGlobalCords, Vissible
 
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
TEntityList3D()
          Empty constructor of this 3D Entity.
TEntityList3D(double _x, double _y, double _z, double _xax, double _xay, double _xaz, double _yax, double _yay, double _yaz, double _zax, double _zay, double _zaz)
          Constructor
TEntityList3D(TEntityList3D _EntList)
          Copy constructor.
TEntityList3D(TVector3D _posVec, TVector3D _Xaxis, TVector3D _Yaxis, TVector3D _Zaxis)
          Constructor.
 
Method Summary
 void Append(TEntity3D _ent)
          Routine used to append a TEntity3D object to the ObjectList.
 void Clear()
          Routine to remove all objects from the ObjectList
 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 Insert(TEntity3D _ent, int _pos)
          Routine used to insert a TEntity3D object in the ObjectList.
 void Remove(int _pos)
          Routine used to remove a TEntity3D object from the ObjectList.
 void Remove(TEntity3D _ent)
          Routine used to remove a TEntity3D object from the ObjectList.
 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
 void Sort(double[] _Zbuffer, int[] _index, int l, int r)
          Sort routine that uses FastQuickSort for lists longer than 4, else it uses InsertionSort
 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.
 
Methods inherited from class nl.kun.Engine3D.TEntity3D
Vector3D, Vector3D
 
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

ObjectList

public java.util.Vector ObjectList
Vector object in which TEntity3D's can be stored. Can grow and shrink dynamically

depth

public double depth
The depth of this object.
See Also:
TEntity3D.Depth(TCamera3D)

size

public int size
The length of the ObjectList

MaxBuf

protected int MaxBuf
Number of (for the camera) vissible Entity3D's

index

protected int[] index
List with all the ID numbers for the TEntity3D's used in Z sorting

MAXOBJECTS

static int MAXOBJECTS
Maximum number of objects in a ObjectList (default 1000)
Constructor Detail

TEntityList3D

public TEntityList3D(double _x,
                     double _y,
                     double _z,
                     double _xax,
                     double _xay,
                     double _xaz,
                     double _yax,
                     double _yay,
                     double _yaz,
                     double _zax,
                     double _zay,
                     double _zaz)
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
_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

TEntityList3D

public TEntityList3D(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

TEntityList3D

public TEntityList3D()
Empty constructor of this 3D Entity. Creates an TEntityList3D with coordinate system ( (0,0,0); (1,0,0); (0,1,0); (0,0,1) )

TEntityList3D

public TEntityList3D(TEntityList3D _EntList)
Copy constructor.
Parameters:
_EntList - Object that needs to be copied into this object.
Method Detail

Append

public void Append(TEntity3D _ent)
Routine used to append a TEntity3D object to the ObjectList.
Parameters:
_ent - Entity to be appended.

Remove

public void Remove(TEntity3D _ent)
Routine used to remove a TEntity3D object from the ObjectList. Use this routine when you do not know the position in the list.
Parameters:
_ent - Entity to be removed

Remove

public void Remove(int _pos)
Routine used to remove a TEntity3D object from the ObjectList. Use this routine if you do know the position in the list
Parameters:
_pos - Position of the Entity in the list.

Insert

public void Insert(TEntity3D _ent,
                   int _pos)
Routine used to insert a TEntity3D object in the ObjectList.
Parameters:
_ent - Entity to be inserted
_pos - Insertion position.

Clear

public void Clear()
Routine to remove all objects from the ObjectList

Draw

public void Draw(TCamera3D _cam,
                 Viewport _Viewport)
Description copied from class: TEntity3D
Draws the vissible parts of this object onto the viewport, as if it where projecting itself on a camera.
Overrides:
Draw in class TEntity3D
Tags copied from class: TEntity3D
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)
Description copied from class: TEntity3D
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.
Overrides:
Depth in class TEntity3D
Tags copied from class: TEntity3D
Parameters:
_cam - The camera.

Sort

public void Sort(double[] _Zbuffer,
                 int[] _index,
                 int l,
                 int r)
Sort routine that uses FastQuickSort for lists longer than 4, else it uses InsertionSort
Parameters:
_Zbuffer - The list of values to be sorted
_index - The index numbers belonging to the values in _Zbuffer. Will be sorted by _Zbuffer
l - left index in array to start sorting.
r - right index in array to start sorting.

Translate

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

Translate

public TVector3D Translate(TVector3D _dr)
Description copied from class: TEntity3D
Translates the coordinate system of this object.
Overrides:
Translate in class TEntity3D
Tags copied from class: TEntity3D
Parameters:
_dr - Displacement vector.

Rotate

public void Rotate(TVector3D _PosVec,
                   TVector3D _DirVec,
                   double _angle)
Description copied from class: TEntity3D
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 TEntity3D
Tags copied from class: TEntity3D
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)
Description copied from class: TEntity3D
Inherits the global coordinates of it's parent, and adjusts it's own global coordinates if the local coordinate system is changed.
Overrides:
InheritGlobalCords in class TEntity3D
Tags copied from class: TEntity3D
Parameters:
_Parent - The parent coordinate system.