jv.project
Interface PvCameraIf
-
- All Superinterfaces:
- PsUpdateIf
- All Known Implementing Classes:
- PvCamera
public interface PvCameraIf extends PsUpdateIf
This interface must be implemented by all cameras.- Author:
- Eike Preuss, Konrad Polthier
- Version:
- 14.12.03, 1.80 revised (kp) New method setFullPosition() added.
11.08.02, 1.70 revised (kp) Some static variables transferred from PvDisplayIf.
11.08.02, 1.61 revised (kp) Method setName(String) added.
29.04.01, 1.60 revised (kp) New method setProjectionMode added.
15.03.01, 1.50 revised (kp) Now interface extends PsUpdateIf.
15.03.01, 1.40 revised (kp) Methods for horizontal clipping added.
25.07.00, 1.20 revised (kp) Some methods removed, documentation added.
25.07.00, 1.10 revised (kp) Interface renamed to PvCameraIf from PgCameraIf.
27.03.00, 1.00 created (ep)
-
-
Field Summary
Fields Modifier and Type Field and Description static intCAMERA_MODELMisused camera type in display, simulates transformation of modeling matrix of geometry.static java.lang.String[]CAMERA_NAMEArray of camera names.static intCAMERA_ORTHO_XYCamera type and projection mode projecting orthogonally onto xy-plane.static intCAMERA_ORTHO_XZCamera type and projection mode projecting orthogonally onto xz-plane.static intCAMERA_ORTHO_YZCamera type and projection mode projecting orthogonally onto yz-plane.static intCAMERA_PERSPECTIVECamera type and projection mode allowing to arbitrary rotate camera.
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method and Description doublegetDist()Get distance of camera position from point of interest in world coordinates.doublegetFarClip()Get distance of the far clipping plane.doublegetFieldOfView()Get opening angle of camera.PdVectorgetInterest()Get position at which camera is directed, i.e. the point of interest.doublegetNearClip()Get distance of the near clipping plane.PdVectorgetPosition()Get position of camera in world coordinates.intgetProjectionMode()Get projection mode of the camera, for example, perspective, xy-projection etc.doublegetRoll()Get angle which camera is rotated around viewing direction against default position.doublegetScale()Get zoom factor of camera.PdMatrixgetTransMatrix(int type)Get transformation matrices PV, P, V and their inverses in current camera and display.PdVectorgetUpVector()Get up vector as second row of viewing matrix divided by scaling factor.PdVectorgetViewDir()Get normalized viewing direction which is the vector pointing from the camera to its interest.booleanisEnabledClip()Determine whether horizontal clipping is enabled.booleanisEnabledSceneRatio()Check of aspect ratio of scene bounding box is enabled.voidsaveAsDefault()Save the current transformation matrices as default.voidsetBoxRatio(PdVector ratio)Set the scaling factor for all three camera axis to produce a non-square viewing frustum.voidsetDist(double newDist)Set distance of camera position from point of interest in world coordinates.voidsetEnabledBoxRatio(boolean flag)Enable usage of a variable aspect ratio for the viewing frustum of this camera.voidsetEnabledClip(boolean flag)Enable horizontal clipping.voidsetEnabledSceneRatio(boolean flag)Set aspect ratio of scene bounding box.voidsetFarClip(double dist)Get distance of far clipping plane.voidsetFieldOfView(double angle)Set opening angle of camera.voidsetFullPosition(PdVector interest, PdVector position, PdVector upDir)Set full orientation and location of camera in world coordinates.voidsetInterest(PdVector pos)Set position at which camera is directed, i.e. the point of interest.voidsetName(java.lang.String name)Set name of instance.voidsetNearClip(double dist)Get distance of the near clipping plane.voidsetPosition(PdVector pos)Set position of camera in world coordinates.voidsetProjectionMode(int mode)Set projection mode of the camera, for example, perspective, xy-projection etc.voidsetRoll(double roll)Set angle which camera is rotated around viewing direction against default position.voidsetScale(double newScale)Set zoom factor of camera.voidsetTransMatrix(int type, PdMatrix mat)Set transformation matrices PV, P, V and their inverses in current camera and display.voidsetUpVector(PdVector up)Set normalized up vector of camera in world coordinates.voidsetViewDir(PdVector pos)Set viewing direction as the vector pointing from the camera to its interest.-
Methods inherited from interface jv.object.PsUpdateIf
getFather, getName, setParent, update
-
-
-
-
Field Detail
-
CAMERA_PERSPECTIVE
static final int CAMERA_PERSPECTIVE
Camera type and projection mode allowing to arbitrary rotate camera.- See Also:
- Constant Field Values
-
CAMERA_ORTHO_XY
static final int CAMERA_ORTHO_XY
Camera type and projection mode projecting orthogonally onto xy-plane.- See Also:
- Constant Field Values
-
CAMERA_ORTHO_XZ
static final int CAMERA_ORTHO_XZ
Camera type and projection mode projecting orthogonally onto xz-plane.- See Also:
- Constant Field Values
-
CAMERA_ORTHO_YZ
static final int CAMERA_ORTHO_YZ
Camera type and projection mode projecting orthogonally onto yz-plane.- See Also:
- Constant Field Values
-
CAMERA_MODEL
static final int CAMERA_MODEL
Misused camera type in display, simulates transformation of modeling matrix of geometry.- See Also:
- Constant Field Values
-
CAMERA_NAME
static final java.lang.String[] CAMERA_NAME
Array of camera names. Position of names must match the integer id's of PvCameraIf.CAMERA_PERSPECTIVE etc. Names are not translated since same names are used to in JVD. since JavaView 2.31
-
-
Method Detail
-
setName
void setName(java.lang.String name)
Set name of instance. since JavaView 2.31
-
saveAsDefault
void saveAsDefault()
Save the current transformation matrices as default.- Since:
- JavaView 2.47
- Version:
- 28.11.02, 1.00 created (kp)
-
getProjectionMode
int getProjectionMode()
Get projection mode of the camera, for example, perspective, xy-projection etc. For a list of possible type seePvCameraIf#CAMERA_ORTHO_XY.- Returns:
- current projection mode
- See Also:
PvDisplayIf
-
setProjectionMode
void setProjectionMode(int mode)
Set projection mode of the camera, for example, perspective, xy-projection etc. For a list of possible type seePvCameraIf#CAMERA_ORTHO_XY.- Parameters:
mode- new projection mode- See Also:
PvDisplayIf
-
getViewDir
PdVector getViewDir()
Get normalized viewing direction which is the vector pointing from the camera to its interest.- Returns:
- normalized viewing direction in world coordinates
-
setViewDir
void setViewDir(PdVector pos)
Set viewing direction as the vector pointing from the camera to its interest. Length of vector is irrelevant.- Parameters:
pos- viewing direction in world coordinates
-
getDist
double getDist()
Get distance of camera position from point of interest in world coordinates. Distance is inverse to scaling factor of viewing matrix.- Returns:
- distance of camera to interest in world coordinates.
- See Also:
getScale()
-
setDist
void setDist(double newDist)
Set distance of camera position from point of interest in world coordinates. Scale view matrix withfactor=newDist/currDist.- Parameters:
newDist- distance of camera to interest in world coordinates.- See Also:
setScale(double)
-
getScale
double getScale()
Get zoom factor of camera.- Returns:
- zoom factor of camera.
- See Also:
getDist()
-
setScale
void setScale(double newScale)
Set zoom factor of camera.- Parameters:
newScale- zoom factor of camera.- See Also:
setDist(double)
-
getFieldOfView
double getFieldOfView()
Get opening angle of camera.- Returns:
- angle in (0,180)
- See Also:
setFieldOfView(double)
-
setFieldOfView
void setFieldOfView(double angle)
Set opening angle of camera.- Parameters:
angle- angle in (0,180)- See Also:
getFieldOfView()
-
getRoll
double getRoll()
Get angle which camera is rotated around viewing direction against default position. The default position depends on the projection mode of the camera.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 look down the negative z-axis and the positive y-axis is showing upward.
- Returns:
- angle in (-pi,pi)
- See Also:
setRoll(double)
-
setRoll
void setRoll(double roll)
Set angle which camera is rotated around viewing direction against default position. The default position depends on the projection mode of the camera.- Parameters:
roll- angle in (-pi,pi)- See Also:
getRoll()
-
getInterest
PdVector getInterest()
Get position at which camera is directed, i.e. the point of interest. Interest is implicitly stores as the 4th column of the inverse viewing matrix.interest = viewInv[.][3]
- Returns:
- 3d-coordinates of interest in world coordinates.
-
setInterest
void setInterest(PdVector pos)
Set position at which camera is directed, i.e. the point of interest.- Parameters:
pos- 3d-coordinates of interest in world coordinates.
-
getPosition
PdVector getPosition()
Get position of camera in world coordinates. The camera position is implicitly stored and computed fromposition = interest - dist*viewDir
.- Returns:
- 3d-position of camera in world coordinates.
-
setPosition
void setPosition(PdVector pos)
Set position of camera in world coordinates. The camera position is implicitly stored by equationposition = interest - dist*viewDir
.- Parameters:
pos- 3d-position of camera in world coordinates.
-
setFullPosition
void setFullPosition(PdVector interest, PdVector position, PdVector upDir)
Set full orientation and location of camera in world coordinates. The camera position and interest are related by the formulaposition = interest - dist*viewDir
.UpDir must be orthogonal to the vector interest-position.
- Parameters:
interest- 3d-coordinates of point of interest in world coordinates.position- 3d-coordinates of position of camera in world coordinates.upDir- normalized up vector of camera in world coordinates.- Since:
- JavaView 3.03.002
- Version:
- 14.12.03, 1.00 created (kp)
-
getUpVector
PdVector getUpVector()
Get up vector as second row of viewing matrix divided by scaling factor.upDir = -view[1][.] / getScale()
.- Returns:
- normalized up vector of camera in world coordinates.
-
setUpVector
void setUpVector(PdVector up)
Set normalized up vector of camera in world coordinates.- Parameters:
up- normalized up vector of camera in world coordinates.
-
isEnabledClip
boolean isEnabledClip()
Determine whether horizontal clipping is enabled.
-
setEnabledClip
void setEnabledClip(boolean flag)
Enable horizontal clipping.
-
getNearClip
double getNearClip()
Get distance of the near clipping plane. The near and far clipping planes of a camera are orthogonal to the viewing direction at a positive distance. The near clip plane is closer to the camera than the far clip plane, and this order is not allowed to change.- Returns:
- positive distance of the near clip plane
-
setNearClip
void setNearClip(double dist)
Get distance of the near clipping plane. The near and far clipping planes of a camera are orthogonal to the viewing direction at a positive distance. The near clip plane is closer to the camera than the far clip plane, and this order is not allowed to change.- Parameters:
dist- positive distance of the near clip plane
-
getFarClip
double getFarClip()
Get distance of the far clipping plane. The near and far clipping planes of a camera are orthogonal to the viewing direction at a positive distance. The near clip plane is closer to the camera than the far clip plane, and this order is not allowed to change.- Returns:
- positive distance of the far clip plane
-
isEnabledSceneRatio
boolean isEnabledSceneRatio()
Check of aspect ratio of scene bounding box is enabled.
-
setEnabledSceneRatio
void setEnabledSceneRatio(boolean flag)
Set aspect ratio of scene bounding box.
-
setEnabledBoxRatio
void setEnabledBoxRatio(boolean flag)
Enable usage of a variable aspect ratio for the viewing frustum of this camera.
-
setBoxRatio
void setBoxRatio(PdVector ratio)
Set the scaling factor for all three camera axis to produce a non-square viewing frustum.- Parameters:
ratio- three scaling factors, default square has (1.,1.,1.).
-
setFarClip
void setFarClip(double dist)
Get distance of far clipping plane. The near and far clipping planes of a camera are orthogonal to the viewing direction at a positive distance. The near clip plane is closer to the camera than the far clip plane, and this order is not allowed to change.- Parameters:
dist- positive distance of the far clip plane
-
getTransMatrix
PdMatrix getTransMatrix(int type)
Get transformation matrices PV, P, V and their inverses in current camera and display. Allows to transform world coordinates into screen coordinates [0,0]*[width-1,height-1] of display.Modeling matrix should be set in original geometry model.
- Parameters:
type- type of transformation matrix, seePvDisplay.MATRIX_- Returns:
- pointer to transformation matrix
- Since:
- JavaView 2.99.016
- Version:
- 26.09.03, 1.00 created (kp)
-
setTransMatrix
void setTransMatrix(int type, PdMatrix mat)Set transformation matrices PV, P, V and their inverses in current camera and display. Allows to transform world coordinates into screen coordinates [0,0]*[width-1,height-1] of display.Modeling matrix should be set in original geometry model.
- Parameters:
type- type of transformation matrix, seePvDisplay.MATRIX_mat- new transformation matrix- Since:
- JavaView 2.47
- Version:
- 28.11.02, 1.00 created (kp) Body moved from PvDisplay#setTransMatrix().
-
-
"