|
JavaView® v2.00.008 | ||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Object
|
+--jv.object.PsObject
|
+--jv.viewer.PvCamera
Camera for PvDisplay. Four different projection types.
Handled by PvDisplay.
If camera info panel is showing, then it is updated when geometry is rotated. On slow machines just switch the visible panel to stop the panel update.
PvDisplay, Serialized Form| Field Summary | |
protected boolean |
m_bEnableClip
Enable or disable clipping in z-direction. |
protected PvDisplay |
m_display
Parent display of this camera. |
protected PuDouble |
m_farClip
Distance of far clip plane. |
protected double |
m_fieldOfView
|
protected double |
m_fit
|
protected PdMatrix |
m_incrView
|
protected PdMatrix |
m_incrViewInv
|
protected int |
m_mode
Control mode i.e. scale, translate, rotate, pick |
protected PuDouble |
m_nearClip
Distance of near clip plane. |
protected double |
m_nHeight
Size of associated display window is initialized with non-zero values to avoid problems |
protected double |
m_nWidth
|
protected PdVector |
m_pick
|
protected PdMatrix |
m_proj
Transformation matrices and inverses. |
protected PdMatrix |
m_projInv
|
protected int |
m_projMode
Projection mode, i.e. perspective, x-y, ... |
protected double |
m_roll
|
protected PdVector |
m_rotAxis
|
protected double |
m_scaleTotal
|
protected double |
m_scaleValue
|
PdMatrix |
m_trans
|
PdMatrix |
m_transInv
|
protected PdVector |
m_vec
|
protected PdVector |
m_vecAlt
|
PdMatrix |
m_view
|
PdMatrix |
m_viewInv
|
protected PdVector |
m_worldPick
|
protected double |
m_xTransValue
|
protected double |
m_yTransValue
|
| Fields inherited from class jv.object.PsObject |
HAS_CONFIG_PANEL, HAS_INFO_PANEL, HAS_MATERIAL_PANEL, INSPECTOR_INFO, INSPECTOR_INFO_EXT, IS_DELETED, IS_FIXED, IS_SELECTED, IS_USED, m_infoPanel, m_name, m_panelList, m_parent, m_tag, m_updateList, NUM_TAGS |
| Constructor Summary | |
PvCamera(PvDisplay display,
int projMode)
|
|
| Method Summary | |
void |
fit(double diameter)
Fit object with given diameter into current display window. |
PdVector[] |
getBounds()
Get transformed bounding box used in clipping. |
double |
getDist()
Get distance of camera position from point of interest in world coordinates. |
PdVector |
getInterest()
Get position at which camera is directed, i.e. the point of interest. |
protected int |
getMode()
Get the transformation mode, for a list of possible type see PvDisplay#M_MODE_SCALE.
|
PdVector |
getPosition()
Get position of camera in world coordinates. |
int |
getProjectionMode()
Get projection mode of the camera, for example, perspective, xy-projection etc. |
double |
getRoll()
Get angle which camera is rotated around viewing direction against default position. |
double |
getScale()
Get zoom factor of camera. |
PdVector |
getUpVector()
Get up vector as second row of viewing matrix divided by scaling factor. |
PdVector |
getViewDir()
Get normalized viewing direction as the vector pointing from the camera to its interest. |
void |
init()
Initializes and resets current camera. |
protected void |
mouseAnimate()
Iteratively apply incremental transformation matrices during auto-rotate. |
protected void |
mouseAnimateGeometry()
Iteratively apply incremental transformation matrices during auto-rotate. |
protected void |
mouseDragged(int x,
int y)
Calculate transformation matrices based on incremental mouse movements. |
protected void |
mousePressed(int x,
int y)
Reset some values used in increment calculations when mouse is pressed. |
protected void |
resizeImage(double aWidth,
double aHeight)
Assign dimension of viewing canvas to allow normalization of pixel coordinates. |
void |
setDist(double newDist)
Set distance of camera position from point of interest in world coordinates. |
void |
setInterest(PdVector pos)
Set location at which camera is directed, i.e. the point of interest. |
protected void |
setMode(int aMode)
Set the transformation mode, for a list of possible type see PvDisplay#M_MODE_SCALE.
|
void |
setPosition(PdVector pos)
Set position of camera in world coordinates. |
void |
setRoll(double roll)
Set angle which camera is rotated around viewing direction against default position. |
void |
setScale(double newScale)
Set zoom factor of camera. |
void |
setUpVector(PdVector up)
Set normalized up vector of camera in world coordinates. |
void |
setViewDir(PdVector pos)
Set viewing direction as the vector pointing from the camera to its interest. |
boolean |
update(java.lang.Object event)
event == this : geometry has changed by itself without widget event, therefore somewhere in a superclass the infoPanel must be updated. call: super.update(event, e.g. this) event == null : geometry has change by widget event which has been handled call: super.update(null) event == else : we must handle the event here or pass it to superclass. |
| Methods inherited from class jv.object.PsObject |
addInspector, addUpdateListener, clearTag, clone, clone, clone, copy, getFather, getInfoPanel, getInspector, getName, getNumObjects, hasInspector, hasTag, hasUpdateListener, instanceOf, instanceOf, removeInspector, removeUpdateListener, setName, setParent, setTag, toString, updatePanels |
| Methods inherited from class java.lang.Object |
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
protected double m_roll
protected double m_fieldOfView
protected PuDouble m_nearClip
protected PuDouble m_farClip
protected boolean m_bEnableClip
protected PdMatrix m_proj
protected PdMatrix m_projInv
public PdMatrix m_view
public PdMatrix m_viewInv
protected PdMatrix m_incrView
protected PdMatrix m_incrViewInv
public PdMatrix m_trans
public PdMatrix m_transInv
protected int m_mode
protected int m_projMode
protected double m_nHeight
protected double m_nWidth
protected double m_fit
protected double m_scaleTotal
protected double m_scaleValue
protected double m_xTransValue
protected double m_yTransValue
protected PdVector m_vecAlt
protected PdVector m_vec
protected PdVector m_rotAxis
protected PdVector m_pick
protected PdVector m_worldPick
protected PvDisplay m_display
| Constructor Detail |
public PvCamera(PvDisplay display,
int projMode)
| Method Detail |
public void init()
init in class PsObjectpublic boolean update(java.lang.Object event)
update in class PsObjectjv.object.PsObjectPsObject.setParent(PsUpdateIf),
PsObject.getFather(),
PsObject.addUpdateListener(PsUpdateIf)public int getProjectionMode()
PvDisplayIf#CAMERA_ORTHO_XY.getProjectionMode in interface PvCameraIfPvDisplayIfprotected int getMode()
PvDisplay#M_MODE_SCALE.
Method is invoked by PvDisplay.protected void setMode(int aMode)
PvDisplay#M_MODE_SCALE.
Method is invoked by PvDisplay.current - transformation modepublic PdVector getViewDir()
Internally the viewing direction is the negative of third row of the viewing matrix divided by the scaling factor.
viewDir = -view[2][.] / getScale().
getViewDir in interface PvCameraIfpublic void setViewDir(PdVector pos)
setViewDir in interface PvCameraIfviewing - direction in world coordinatespublic double getDist()
getDist in interface PvCameraIfgetScale()public void setDist(double newDist)
factor=newDist/currDist.setDist in interface PvCameraIfdistance - of camera to interest in world coordinates.setScale(double)public double getScale()
getScale in interface PvCameraIfgetDist()public void setScale(double newScale)
setScale in interface PvCameraIfzoom - factor of camera.setDist(double)public double getRoll()
Mathematically, the roll is the angle between the two planes p1=(viewDir, defaultUpVector) and p2=(viewDir, upVector). The defaultUpVector depends on the projection mode, in xy-projection mode we have defaultUpVector=(0,1,0) since camera looks down the negative z-axis and the positive y-axis is showing upward.
getRoll in interface PvCameraIfsetRoll(double)public void setRoll(double roll)
setRoll in interface PvCameraIfangle - in (-pi,pi)getRoll()public PdVector getInterest()
interest = viewInv[.][3]
getInterest in interface PvCameraIfpublic void setInterest(PdVector pos)
This behaviour results from the steering inside the camera panel where a user may change the interest, viewing direction and distance. User who want to set camera position and interest are advised either to first set the interest and then the position, or to set the viewing direction and the interest.
setInterest in interface PvCameraIfpos - 3d-coordinates of interest in world coordinates.public PdVector getPosition()
position = interest - dist*viewDir.
getPosition in interface PvCameraIfpublic void setPosition(PdVector pos)
position = interest - dist*viewDir.
setPosition in interface PvCameraIfpos - 3d-position of camera in world coordinates.public PdVector getUpVector()
upDir = -view[1][.] / getScale().
getUpVector in interface PvCameraIfpublic void setUpVector(PdVector up)
setUpVector in interface PvCameraIfnormalized - up vector of camera in world coordinates.public void fit(double diameter)
protected void resizeImage(double aWidth,
double aHeight)
protected void mousePressed(int x,
int y)
protected void mouseDragged(int x,
int y)
The trackball computation uses the increment in the mouse movement in the canvas to calculate the axis of rotation and the angle about to rotate. The axis is obtained as crossproduct of the following to vectors: First, m_vec is the vector obtained by projecting the current mouse position to the sphere by inverse stereographic projection PdVector.invStereoProj(). Second, the vector of the previous mouse position is still stored in m_vecAlt. The angle to rotate is just the angle between both vectors.
Then the increment of transformation matrix is just the matrix which rotates around m_vec x m_vecAlt with above angle. The code for computing this transformation matrix is PuReflect.makeRotation().
protected void mouseAnimate()
protected void mouseAnimateGeometry()
public PdVector[] getBounds()
|
JavaView® v2.00.008 | ||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||