gzz.vob
Class VobCoorder

gzz.vob.VobScene gzz.vob.VobMap gzz.vob.VobCoorder gzz.vob.VobMatcher gzz.vob.Vob ../../../Gzz_Frontend_Vobs.gen.html#vobscene_overall vobscene_overall_small
java.lang.Object
  |
  +--gzz.vob.VobCoorder
Direct Known Subclasses:
AffineVobCoorder

public abstract class VobCoorder
extends java.lang.Object

A set of coordinate systems for vobs. In the new Vob APIs, the keys that were formerly inside the Vob objects are associated with coordinate systems, each of which may contain any number of vobs. This allows us to easily animate connections between two coordinate systems etc.

Coordinate systems are recursive; the coordinate system 0 represents the root coordinate system (i.e., the whole vob scene).

Warn about setXParams!

The transform functions (transformPoints3, inverseTransformPoints3, transformPoint, transformPoints2) can be used to transform points into coordinate systems. The functions take an array of original points, an (optional) destination array, and return either the destination array, or, if the coordinate system is not rendered in the current configuration (e.g. culled out), null.


Constructor Summary
VobCoorder()
           
 
Method Summary
abstract  void activate(int CS)
          Cause the given coordinate system to be considered when getCSAt() is called.
 int box(int into, float w, float h)
           
 int cull(int parent, int clip)
          Creates a CullingCoordSys using the parent also as the test coordinate system.
 int cull(int parent, int test, int clip)
          Creates a CullingCoordSys with distinct parent and test coordinate systems.
abstract  void dump()
           
abstract  int getCSAt(int parent, float x, float y, float[] targetcoords)
          Get the topmost activated coordinate system which has parent as a primary ancestor.
abstract  Vob.RenderInfo getRenderInfo(int csind)
           
abstract  void getSqSize(int cs, float[] into)
          Get the size of the "unit square" of the given coordinate system.
 float[] inverseTransformPoints3(int withCS, float[] pt, float[] into)
           
abstract  boolean needInterp(VobCoorder interpTo, int[] interpList)
           
abstract  int ortho(int into, float depth, float x, float y, float sx, float sy)
          Create a new coordinate system.
abstract  int orthoBox(int into, float z, float x, float y, float sx, float sy, float w, float h)
           
 int scale(int into, float sx, float sy)
           
 void setBoxParams(int cs, float w, float h)
           
abstract  void setOrthoBoxParams(int cs, float z, float x, float y, float sx, float sy, float w, float h)
           
abstract  void setOrthoParams(int into, float depth, float x, float y, float sx, float sy)
           
 void setScaleParams(int into, float sx, float sy)
           
 void setTranslateParams(int into, float x, float y)
           
 void setTranslateParams(int into, float x, float y, float z)
           
 java.awt.Point transformPoint(int cs, float x, float y, java.awt.Point into)
           
 java.awt.Point[] transformPoints2(int cs, float[] coords, java.awt.Point[] into)
           
 float[] transformPoints3(int withCS, float[] pt, float[] into)
          Transform a point to screen coordinates from the given cs.
 int translate(int into, float x, float y)
           
 int translate(int into, float x, float y, float z)
           
 int unitSq(int into)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

VobCoorder

public VobCoorder()
Method Detail

ortho

public abstract int ortho(int into,
                          float depth,
                          float x,
                          float y,
                          float sx,
                          float sy)
Create a new coordinate system.

Parameters:
into - The coord system to place the new coordinate system into, 0 for the root coordinate system.

translate

public int translate(int into,
                     float x,
                     float y)

translate

public int translate(int into,
                     float x,
                     float y,
                     float z)

scale

public int scale(int into,
                 float sx,
                 float sy)

setOrthoParams

public abstract void setOrthoParams(int into,
                                    float depth,
                                    float x,
                                    float y,
                                    float sx,
                                    float sy)

setTranslateParams

public void setTranslateParams(int into,
                               float x,
                               float y)

setTranslateParams

public void setTranslateParams(int into,
                               float x,
                               float y,
                               float z)

setScaleParams

public void setScaleParams(int into,
                           float sx,
                           float sy)

box

public int box(int into,
               float w,
               float h)

setBoxParams

public void setBoxParams(int cs,
                         float w,
                         float h)

unitSq

public int unitSq(int into)

orthoBox

public abstract int orthoBox(int into,
                             float z,
                             float x,
                             float y,
                             float sx,
                             float sy,
                             float w,
                             float h)

setOrthoBoxParams

public abstract void setOrthoBoxParams(int cs,
                                       float z,
                                       float x,
                                       float y,
                                       float sx,
                                       float sy,
                                       float w,
                                       float h)

cull

public int cull(int parent,
                int test,
                int clip)
Creates a CullingCoordSys with distinct parent and test coordinate systems. Exluding the test for drawing, the CullingCoordSys works like its parent coordinate system. E.g. CullingCoordSys returns its parents box.

This coordsys will not necessarily be drawn if the boxes of the test and clip coordinate systems do not intersect. However, this is not guaranteed; the only thing guaranteed is that if the boxes of the test and clip coordinate systems *do* intersect, the CullingCoordsys will be drawn.

The default implementation (although this may change in the future) in VobCoorder is to simply return parent.

Parameters:
parent - ID of the coordinate system which points will be transformed, if CullingCoordSys is shown
test - ID of the coordinate system whose box is tested against the clip coordinate system.
clip - ID of the coordinate system whose box is tested against the test coordinate system.

cull

public int cull(int parent,
                int clip)
Creates a CullingCoordSys using the parent also as the test coordinate system.


getSqSize

public abstract void getSqSize(int cs,
                               float[] into)
Get the size of the "unit square" of the given coordinate system. This is the size that the unit square of unitSqCS() would be in the given coordinate system.


needInterp

public abstract boolean needInterp(VobCoorder interpTo,
                                   int[] interpList)

getRenderInfo

public abstract Vob.RenderInfo getRenderInfo(int csind)

dump

public abstract void dump()

activate

public abstract void activate(int CS)
Cause the given coordinate system to be considered when getCSAt() is called.


getCSAt

public abstract int getCSAt(int parent,
                            float x,
                            float y,
                            float[] targetcoords)
Get the topmost activated coordinate system which has parent as a primary ancestor. This is defined as follows:
          1) Inverse transform into the coordinate system; in there, clip
             against the unit square and project to the plane z=0

          2) Transform the projected point back into screen coordinates, making
             note of the z coordinate.
            

Returns:
Coordinate system number, or -1 if none.

transformPoints3

public float[] transformPoints3(int withCS,
                                float[] pt,
                                float[] into)
Transform a point to screen coordinates from the given cs.


inverseTransformPoints3

public float[] inverseTransformPoints3(int withCS,
                                       float[] pt,
                                       float[] into)
Returns:
True, if a reasonable inverse was found.

transformPoint

public java.awt.Point transformPoint(int cs,
                                     float x,
                                     float y,
                                     java.awt.Point into)

transformPoints2

public java.awt.Point[] transformPoints2(int cs,
                                         float[] coords,
                                         java.awt.Point[] into)