javax.media.j3d
Class CanvasViewCache

java.lang.Object
  extended by javax.media.j3d.CanvasViewCache

 class CanvasViewCache
extends java.lang.Object

The CanvasViewCache class is used to cache all data, both API data and derived data, that is dependent on the Canvas3D or Screen3D. The final view and projection matrices are stored here.


Field Summary
private  int awtCanvasHeight
           
private  int awtCanvasWidth
           
private  int awtCanvasX
           
private  int awtCanvasY
           
private  Canvas3D canvas
           
private  int canvasHeight
           
private  int canvasWidth
           
private  int canvasX
           
private  int canvasY
           
private  Point3d centerEyeInImagePlate
           
private  Vector3d coexistenceCenter
           
private  Transform3D coexistenceToLeftPlate
           
private  Transform3D coexistenceToRightPlate
           
(package private)  int cvcDirtyMask
           
private static java.lang.Object debugLock
           
private  int effectiveMonoscopicViewPolicy
           
private  Transform3D headToLeftImagePlate
           
private  Transform3D headToRightImagePlate
           
private  Transform3D headToVworld
           
private  Transform3D headTrackerToLeftImagePlate
           
private  Transform3D headTrackerToRightImagePlate
           
private  Transform3D infLeftEcToVpc
           
private  Transform3D infLeftProjection
           
private  Transform3D infLeftVpcToEc
           
private  Transform3D infRightEcToVpc
           
private  Transform3D infRightProjection
           
private  Transform3D infRightVpcToEc
           
private  double infVworldToCoexistenceScale
           
private  Transform3D infVworldToVpc
           
private  boolean lastDoInfinite
           
private  Transform3D lastVworldToLeftPlate
           
private  Transform3D leftCcToVworld
           
private  Transform3D leftEcToVpc
           
private  Point3d leftEyeInImagePlate
           
private  Vector4d[] leftFrustumPlanes
           
private  Point4d[] leftFrustumPoints
           
private  Point3d leftManualEyeInImagePlate
           
private  Transform3D leftPlateToVpc
           
private  Transform3D leftPlateToVworld
           
private  Transform3D leftProjection
           
private  Point3d leftTrackedEyeInImagePlate
           
private  Transform3D leftVpcToEc
           
(package private)  double metersPerPixelX
           
(package private)  double metersPerPixelY
           
private  int monoscopicViewPolicy
           
private  double nominalEyeOffset
           
(package private)  double physicalScreenHeight
           
(package private)  double physicalScreenWidth
           
private  Point3d physicalWindowCenter
           
private  double physicalWindowHeight
           
private  double physicalWindowWidth
           
private  double physicalWindowXLeft
           
private  double physicalWindowXRight
           
private  double physicalWindowYBottom
           
private  double physicalWindowYTop
           
private  RenderBin renderBin
           
private  Transform3D rightCcToVworld
           
private  Transform3D rightEcToVpc
           
private  Point3d rightEyeInImagePlate
           
private  Vector4d[] rightFrustumPlanes
           
private  Point4d[] rightFrustumPoints
           
private  Point3d rightManualEyeInImagePlate
           
private  Transform3D rightPlateToVpc
           
private  Transform3D rightPlateToVworld
           
private  Transform3D rightProjection
           
private  Point3d rightTrackedEyeInImagePlate
           
private  Transform3D rightVpcToEc
           
(package private)  int screenHeight
           
private  double screenScale
           
private  ScreenViewCache screenViewCache
           
(package private)  int screenWidth
           
private  Transform3D tempTrans
           
private  Transform3D tMat1
           
private  Transform3D tMat2
           
private  Matrix4d tMatrix
           
private  Point3d tPnt1
           
private  Point3d tPnt2
           
private  Vector3d tVec1
           
private  Vector3d tVec2
           
private  Vector3d tVec3
           
private  boolean updateLastTime
           
private  boolean useStereo
           
private  ViewCache viewCache
           
private  double viewPlatformScale
           
private  Transform3D vpcToCoexistence
           
private  Transform3D vpcToLeftPlate
           
private  Transform3D vpcToRightPlate
           
private  Transform3D vpcToVworld
           
private  double vworldToCoexistenceScale
           
private  Transform3D vworldToLeftPlate
           
private  Transform3D vworldToRightPlate
           
private  Transform3D vworldToTrackerBase
           
private  Transform3D vworldToVpc
          The view platform transforms.
private  double windowScale
           
 
Constructor Summary
CanvasViewCache(Canvas3D canvas, ScreenViewCache screenViewCache, ViewCache viewCache)
          Constructs and initializes a CanvasViewCache object.
 
Method Summary
private  void analyzeProjection(Transform3D p, double xMax)
          Debugging routine to analyze the projection matrix.
private  void buildProjView(Point3d ep, Transform3D coe2Plate, Transform3D vpc2Plate, double F, double B, Transform3D ecToCc, Transform3D vpcToEc, boolean doInfinite)
          buildProjView creates a projection and viewing matrix.
private  void cacheEyePosCoexistenceRelative(Point3d leftManualEyeInCoexistence, Point3d rightManualEyeInCoexistence)
           
private  void cacheEyePosFixedField()
           
private  void cacheEyePosition()
          Routine to cache the current eye position in image plate coordinates.
private  void cacheEyePosScreenRelative(Point3d leftEye, Point3d rightEye)
          Common routine used when head tracking and when using manual relative_to_screen eyepoint policy.
private  void cacheEyePosWindowRelative()
          Case of view eye position contrainted to center of window, but with z distance from plate eye pos.
private  void computeCanvasInfo()
           
private  void computeCoexistenceCenter()
           
private  void computeCoexistenceToPlate()
           
(package private)  void computeDerivedData(boolean currentFlag, CanvasViewCache cvc, BoundingBox frustumBBox, boolean doInfinite)
          Compute derived data using the snapshot of the per-canvas, per-screen and per-view data.
(package private)  void computefrustumBBox(BoundingBox frustumBBox)
           
private  void computeFrustumPlanes(Transform3D ecToCc, Transform3D vpcToEc, Vector4d[] frustumPlanes, Point4d[] frustumPoints, Transform3D ccToVworld)
          Compute the plane equations for the frustum in ViewPlatform coordinates, plus its viewing frustum points.
private  void computeHeadToVworld()
           
private  void computePlaneEq(Point4d p1, Point4d p2, Point4d p3, Point4d p4, Vector4d planeEq)
           
private  void computePlateToVworld()
           
private  void computeTrackedEyePosition()
          Compute the head-tracked eye position for the right and left eyes.
private  void computeView(boolean doInfinite)
          Computes the viewing matrices.
private  void computeViewPlatformScale()
           
private  void computeVpcToCoexistence()
           
(package private)  void copyComputedCanvasViewCache(CanvasViewCache cvc, boolean doInfinite)
           
private  void doComputeDerivedData(boolean currentFlag, CanvasViewCache cvc, BoundingBox frustumBBox, boolean doInfinite)
          Compute derived data using the snapshot of the per-canvas, per-screen and per-view data.
(package private)  int getCanvasHeight()
           
(package private)  void getCanvasPositionAndSize()
           
(package private)  int getCanvasWidth()
           
(package private)  int getCanvasX()
           
(package private)  int getCanvasY()
           
(package private)  Point3d getCenterEyeInImagePlate()
           
(package private)  Transform3D getHeadToVworld()
           
(package private)  Transform3D getImagePlateToVworld()
           
(package private)  Transform3D getInfgRightEcToVpc()
           
(package private)  Transform3D getInfLeftEcToVpc()
           
(package private)  Transform3D getInfLeftProjection()
           
(package private)  Transform3D getInfLeftVpcToEc()
           
(package private)  Transform3D getInfRightProjection()
           
(package private)  Transform3D getInfRightVpcToEc()
           
(package private)  double getInfVworldToCoexistenceScale()
           
(package private)  Transform3D getInfVworldToVpc()
           
(package private)  Transform3D getLastVworldToImagePlate()
           
(package private)  Transform3D getLeftCcToVworld()
           
(package private)  Transform3D getLeftEcToVpc()
           
(package private)  Point3d getLeftEyeInImagePlate()
           
(package private)  Vector4d[] getLeftFrustumPlanesInVworld()
           
(package private)  Transform3D getLeftProjection()
           
(package private)  Transform3D getLeftVpcToEc()
           
(package private)  double getPhysicalWindowHeight()
           
(package private)  double getPhysicalWindowWidth()
           
(package private)  void getPixelLocationFromImagePlate(Point3d imagePlatePoint, Point2d pixelLocation)
          Projects the specified point from image plate coordinates into AWT pixel coordinates.
(package private)  void getPixelLocationInImagePlate(double x, double y, double z, Point3d imagePlatePoint)
           
(package private)  Transform3D getRightCcToVworld()
           
(package private)  Transform3D getRightEcToVpc()
           
(package private)  Point3d getRightEyeInImagePlate()
           
(package private)  Vector4d[] getRightFrustumPlanesInVworld()
           
(package private)  Transform3D getRightProjection()
           
(package private)  Transform3D getRightVpcToEc()
           
(package private)  boolean getUseStereo()
           
(package private)  Transform3D getVpcToVworld()
           
(package private)  double getVworldToCoexistenceScale()
           
(package private)  Transform3D getVworldToImagePlate()
           
(package private)  Transform3D getVworldToTrackerBase()
           
(package private)  Transform3D getVworldToVpc()
           
(package private)  double getWindowXInImagePlate(double x)
           
(package private)  double getWindowYInImagePlate(double y)
           
(package private)  void setCanvas(Canvas3D c)
           
(package private)  void setScreenViewCache(ScreenViewCache svc)
           
(package private)  void setViewCache(ViewCache vc)
           
(package private)  void snapshot(boolean computeFrustum)
          Take snapshot of all per-canvas API parameters and input values.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

debugLock

private static java.lang.Object debugLock

canvas

private Canvas3D canvas

cvcDirtyMask

int cvcDirtyMask

screenViewCache

private ScreenViewCache screenViewCache

viewCache

private ViewCache viewCache

awtCanvasX

private int awtCanvasX

awtCanvasY

private int awtCanvasY

awtCanvasWidth

private int awtCanvasWidth

awtCanvasHeight

private int awtCanvasHeight

renderBin

private RenderBin renderBin

useStereo

private boolean useStereo

monoscopicViewPolicy

private int monoscopicViewPolicy

leftManualEyeInImagePlate

private Point3d leftManualEyeInImagePlate

rightManualEyeInImagePlate

private Point3d rightManualEyeInImagePlate

physicalScreenWidth

double physicalScreenWidth

physicalScreenHeight

double physicalScreenHeight

screenWidth

int screenWidth

screenHeight

int screenHeight

metersPerPixelX

double metersPerPixelX

metersPerPixelY

double metersPerPixelY

canvasX

private int canvasX

canvasY

private int canvasY

canvasWidth

private int canvasWidth

canvasHeight

private int canvasHeight

effectiveMonoscopicViewPolicy

private int effectiveMonoscopicViewPolicy

leftProjection

private Transform3D leftProjection

rightProjection

private Transform3D rightProjection

infLeftProjection

private Transform3D infLeftProjection

infRightProjection

private Transform3D infRightProjection

leftVpcToEc

private Transform3D leftVpcToEc

rightVpcToEc

private Transform3D rightVpcToEc

infLeftVpcToEc

private Transform3D infLeftVpcToEc

infRightVpcToEc

private Transform3D infRightVpcToEc

leftEcToVpc

private Transform3D leftEcToVpc

rightEcToVpc

private Transform3D rightEcToVpc

infLeftEcToVpc

private Transform3D infLeftEcToVpc

infRightEcToVpc

private Transform3D infRightEcToVpc

leftFrustumPlanes

private Vector4d[] leftFrustumPlanes

rightFrustumPlanes

private Vector4d[] rightFrustumPlanes

leftFrustumPoints

private Point4d[] leftFrustumPoints

rightFrustumPoints

private Point4d[] rightFrustumPoints

headTrackerToLeftImagePlate

private Transform3D headTrackerToLeftImagePlate

headTrackerToRightImagePlate

private Transform3D headTrackerToRightImagePlate

leftTrackedEyeInImagePlate

private Point3d leftTrackedEyeInImagePlate

rightTrackedEyeInImagePlate

private Point3d rightTrackedEyeInImagePlate

leftEyeInImagePlate

private Point3d leftEyeInImagePlate

rightEyeInImagePlate

private Point3d rightEyeInImagePlate

centerEyeInImagePlate

private Point3d centerEyeInImagePlate

nominalEyeOffset

private double nominalEyeOffset

physicalWindowXLeft

private double physicalWindowXLeft

physicalWindowYBottom

private double physicalWindowYBottom

physicalWindowXRight

private double physicalWindowXRight

physicalWindowYTop

private double physicalWindowYTop

physicalWindowWidth

private double physicalWindowWidth

physicalWindowHeight

private double physicalWindowHeight

physicalWindowCenter

private Point3d physicalWindowCenter

screenScale

private double screenScale

windowScale

private double windowScale

viewPlatformScale

private double viewPlatformScale

leftCcToVworld

private Transform3D leftCcToVworld

rightCcToVworld

private Transform3D rightCcToVworld

coexistenceToLeftPlate

private Transform3D coexistenceToLeftPlate

coexistenceToRightPlate

private Transform3D coexistenceToRightPlate

vpcToCoexistence

private Transform3D vpcToCoexistence

vpcToLeftPlate

private Transform3D vpcToLeftPlate

vpcToRightPlate

private Transform3D vpcToRightPlate

leftPlateToVpc

private Transform3D leftPlateToVpc

rightPlateToVpc

private Transform3D rightPlateToVpc

vworldToLeftPlate

private Transform3D vworldToLeftPlate

lastVworldToLeftPlate

private Transform3D lastVworldToLeftPlate

vworldToRightPlate

private Transform3D vworldToRightPlate

leftPlateToVworld

private Transform3D leftPlateToVworld

rightPlateToVworld

private Transform3D rightPlateToVworld

headToLeftImagePlate

private Transform3D headToLeftImagePlate

headToRightImagePlate

private Transform3D headToRightImagePlate

vworldToTrackerBase

private Transform3D vworldToTrackerBase

tempTrans

private Transform3D tempTrans

headToVworld

private Transform3D headToVworld

coexistenceCenter

private Vector3d coexistenceCenter

vworldToCoexistenceScale

private double vworldToCoexistenceScale

infVworldToCoexistenceScale

private double infVworldToCoexistenceScale

tMat1

private Transform3D tMat1

tMat2

private Transform3D tMat2

tVec1

private Vector3d tVec1

tVec2

private Vector3d tVec2

tVec3

private Vector3d tVec3

tPnt1

private Point3d tPnt1

tPnt2

private Point3d tPnt2

tMatrix

private Matrix4d tMatrix

vworldToVpc

private Transform3D vworldToVpc
The view platform transforms.


vpcToVworld

private Transform3D vpcToVworld

infVworldToVpc

private Transform3D infVworldToVpc

lastDoInfinite

private boolean lastDoInfinite

updateLastTime

private boolean updateLastTime
Constructor Detail

CanvasViewCache

CanvasViewCache(Canvas3D canvas,
                ScreenViewCache screenViewCache,
                ViewCache viewCache)
Constructs and initializes a CanvasViewCache object. Note that the canvas, screen, screenCache, view, and viewCache parameters are all fixed at construction time and must be non-null.

Method Detail

getCanvasPositionAndSize

void getCanvasPositionAndSize()

computefrustumBBox

void computefrustumBBox(BoundingBox frustumBBox)

copyComputedCanvasViewCache

void copyComputedCanvasViewCache(CanvasViewCache cvc,
                                 boolean doInfinite)

snapshot

void snapshot(boolean computeFrustum)
Take snapshot of all per-canvas API parameters and input values. NOTE: This is probably not needed, but we'll do it for symmetry with the ScreenViewCache and ViewCache objects.


computeDerivedData

void computeDerivedData(boolean currentFlag,
                        CanvasViewCache cvc,
                        BoundingBox frustumBBox,
                        boolean doInfinite)
Compute derived data using the snapshot of the per-canvas, per-screen and per-view data.


doComputeDerivedData

private void doComputeDerivedData(boolean currentFlag,
                                  CanvasViewCache cvc,
                                  BoundingBox frustumBBox,
                                  boolean doInfinite)
Compute derived data using the snapshot of the per-canvas, per-screen and per-view data. Caller must synchronize before calling this method.


computeCanvasInfo

private void computeCanvasInfo()

computeViewPlatformScale

private void computeViewPlatformScale()

cacheEyePosFixedField

private void cacheEyePosFixedField()

cacheEyePosWindowRelative

private void cacheEyePosWindowRelative()
Case of view eye position contrainted to center of window, but with z distance from plate eye pos.


cacheEyePosScreenRelative

private void cacheEyePosScreenRelative(Point3d leftEye,
                                       Point3d rightEye)
Common routine used when head tracking and when using manual relative_to_screen eyepoint policy.


cacheEyePosCoexistenceRelative

private void cacheEyePosCoexistenceRelative(Point3d leftManualEyeInCoexistence,
                                            Point3d rightManualEyeInCoexistence)

computeTrackedEyePosition

private void computeTrackedEyePosition()
Compute the head-tracked eye position for the right and left eyes.


cacheEyePosition

private void cacheEyePosition()
Routine to cache the current eye position in image plate coordinates.


computePlateToVworld

private void computePlateToVworld()

computeHeadToVworld

private void computeHeadToVworld()

computeVpcToCoexistence

private void computeVpcToCoexistence()

computeCoexistenceCenter

private void computeCoexistenceCenter()

computeCoexistenceToPlate

private void computeCoexistenceToPlate()

computeView

private void computeView(boolean doInfinite)
Computes the viewing matrices. computeView computes the following: This call works for both fixed screen and HMD displays.


analyzeProjection

private void analyzeProjection(Transform3D p,
                               double xMax)
Debugging routine to analyze the projection matrix.


buildProjView

private void buildProjView(Point3d ep,
                           Transform3D coe2Plate,
                           Transform3D vpc2Plate,
                           double F,
                           double B,
                           Transform3D ecToCc,
                           Transform3D vpcToEc,
                           boolean doInfinite)
buildProjView creates a projection and viewing matrix. Inputs: ep : eye point, in plate coordinates coe2Plate : matrix from coexistence to image plate. F, B : front, back clipping planes, in plate coordinates doInfinite : flag to indicate ``at infinity'' view desired Output: vpc2Plate : matric from vpc to image plate. ecToCc : projection matrix from Eye Coordinates (EC) to Clipping Coordinates (CC) vpcToEc : view matrix from ViewPlatform Coordinates (VPC) to Eye Coordinates (EC)


computeFrustumPlanes

private void computeFrustumPlanes(Transform3D ecToCc,
                                  Transform3D vpcToEc,
                                  Vector4d[] frustumPlanes,
                                  Point4d[] frustumPoints,
                                  Transform3D ccToVworld)
Compute the plane equations for the frustum in ViewPlatform coordinates, plus its viewing frustum points. ccToVworld will be cached - used by Canavs3D.getInverseVworldProjection().


computePlaneEq

private void computePlaneEq(Point4d p1,
                            Point4d p2,
                            Point4d p3,
                            Point4d p4,
                            Vector4d planeEq)

getCanvasX

int getCanvasX()

getCanvasY

int getCanvasY()

getCanvasWidth

int getCanvasWidth()

getCanvasHeight

int getCanvasHeight()

getPhysicalWindowWidth

double getPhysicalWindowWidth()

getPhysicalWindowHeight

double getPhysicalWindowHeight()

getUseStereo

boolean getUseStereo()

getLeftProjection

Transform3D getLeftProjection()

getRightProjection

Transform3D getRightProjection()

getLeftVpcToEc

Transform3D getLeftVpcToEc()

getRightVpcToEc

Transform3D getRightVpcToEc()

getLeftEcToVpc

Transform3D getLeftEcToVpc()

getRightEcToVpc

Transform3D getRightEcToVpc()

getInfLeftProjection

Transform3D getInfLeftProjection()

getInfRightProjection

Transform3D getInfRightProjection()

getInfLeftVpcToEc

Transform3D getInfLeftVpcToEc()

getInfRightVpcToEc

Transform3D getInfRightVpcToEc()

getInfLeftEcToVpc

Transform3D getInfLeftEcToVpc()

getInfgRightEcToVpc

Transform3D getInfgRightEcToVpc()

getInfVworldToVpc

Transform3D getInfVworldToVpc()

getLeftCcToVworld

Transform3D getLeftCcToVworld()

getRightCcToVworld

Transform3D getRightCcToVworld()

getImagePlateToVworld

Transform3D getImagePlateToVworld()

getLastVworldToImagePlate

Transform3D getLastVworldToImagePlate()

getVworldToImagePlate

Transform3D getVworldToImagePlate()

getVworldToTrackerBase

Transform3D getVworldToTrackerBase()

getVworldToCoexistenceScale

double getVworldToCoexistenceScale()

getInfVworldToCoexistenceScale

double getInfVworldToCoexistenceScale()

getLeftEyeInImagePlate

Point3d getLeftEyeInImagePlate()

getRightEyeInImagePlate

Point3d getRightEyeInImagePlate()

getCenterEyeInImagePlate

Point3d getCenterEyeInImagePlate()

getHeadToVworld

Transform3D getHeadToVworld()

getVpcToVworld

Transform3D getVpcToVworld()

getVworldToVpc

Transform3D getVworldToVpc()

getWindowXInImagePlate

double getWindowXInImagePlate(double x)

getWindowYInImagePlate

double getWindowYInImagePlate(double y)

getLeftFrustumPlanesInVworld

Vector4d[] getLeftFrustumPlanesInVworld()

getRightFrustumPlanesInVworld

Vector4d[] getRightFrustumPlanesInVworld()

getPixelLocationInImagePlate

void getPixelLocationInImagePlate(double x,
                                  double y,
                                  double z,
                                  Point3d imagePlatePoint)

getPixelLocationFromImagePlate

void getPixelLocationFromImagePlate(Point3d imagePlatePoint,
                                    Point2d pixelLocation)
Projects the specified point from image plate coordinates into AWT pixel coordinates.


setCanvas

void setCanvas(Canvas3D c)

setScreenViewCache

void setScreenViewCache(ScreenViewCache svc)

setViewCache

void setViewCache(ViewCache vc)


Copyright 1996-2008 Sun Microsystems, Inc. All Rights Reserved. Use is subject to license terms.