Flight Club


flightclub.framework3d
Class Obj3dDir

java.lang.Object
  |
  +--flightclub.framework3d.Obj3d
        |
        +--flightclub.framework3d.Obj3dDir
All Implemented Interfaces:
CameraSubject

public class Obj3dDir
extends Obj3d

This class extends Obj3d to include a local frame of reference. We may rotate the local frame by specifying a unit vector v and an angle of bank. We may move the local frame by giving the co-ords of its origin.

We keep an extra list of points which represent the object's co-ords in its *local frame* of reference. We dictate that the object's initial co-ords are its local co-ords.

See Also:
MovingBody

Field Summary
 
Fields inherited from class flightclub.framework3d.Obj3d
CONCAVE, CONVEX, modelViewer
 
Constructor Summary
Obj3dDir(ModelViewer modelViewer, int npolygons)
           
Obj3dDir(ModelViewer modelViewer, int npolygons, boolean register)
           
Obj3dDir(Obj3dDir from, boolean register)
          Creates a copy of an instance of Obj3dDir.
Obj3dDir(java.io.StreamTokenizer st, ModelViewer modelViewer, boolean register)
           
 
Method Summary
 void setFrame(float[] p, float[] v, float roll)
          Sets the i, j and k vectors so that v points along the j and i and k are banked over.
 void transform()
          Uses the camera to map all points from model space, (x, y, z) to screen space (x_, y_, z_).
 
Methods inherited from class flightclub.framework3d.Obj3d
addPolygon, addPolygon, addPolygon, addPolygon2, addPolygon2, addPolygonBent, destroyMe, draw, getDepthMax, getDepthMin, getEye, getFocus, getPointIndex, makeCube, parseFile, scaleBy, setBB, setColor, setNormals, setPoint, toString, translateBy
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Obj3dDir

public Obj3dDir(ModelViewer modelViewer,
                int npolygons,
                boolean register)

Obj3dDir

public Obj3dDir(ModelViewer modelViewer,
                int npolygons)

Obj3dDir

public Obj3dDir(java.io.StreamTokenizer st,
                ModelViewer modelViewer,
                boolean register)
         throws java.io.IOException,
                FileFormatException

Obj3dDir

public Obj3dDir(Obj3dDir from,
                boolean register)
Creates a copy of an instance of Obj3dDir. The Glider uses this constructor; it is passed an instance of GliderType which holds a 3d object and clones that object so it has its own copy.

Method Detail

setFrame

public void setFrame(float[] p,
                     float[] v,
                     float roll)
Sets the i, j and k vectors so that v points along the j and i and k are banked over. v should be a unit vector and the roll is in radians.

Looking along j (which equals v) towards origin we see the how the roll moves k away from the vertical and i away from the horizontal:

 
                       k_    k
                       |   /
                       |* /         * = roll
                       | /
                       |/
                       .-----------> i_
                         \
                           \
                             \
                               i
       

See Also:
MovingBody

transform

public void transform()
Description copied from class: Obj3d
Uses the camera to map all points from model space, (x, y, z) to screen space (x_, y_, z_). Remember that x_ represents the depth of the point and (y_, z_) maps to the screen (x, y) co-ords of the point.

Overrides:
transform in class Obj3d
See Also:
CameraMan

Dan Burton <danb@dircon.co.uk> | latest update: 20 Sep 2002;