JavaView© v3.95.000

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.


Field Summary
static int CAMERA_MODEL
          Misused camera type in display, simulates transformation of modeling matrix of geometry.
static java.lang.String[] CAMERA_NAME
          Array of camera names.
static int CAMERA_ORTHO_XY
          Camera type and projection mode projecting orthogonally onto xy-plane.
static int CAMERA_ORTHO_XZ
          Camera type and projection mode projecting orthogonally onto xz-plane.
static int CAMERA_ORTHO_YZ
          Camera type and projection mode projecting orthogonally onto yz-plane.
static int CAMERA_PERSPECTIVE
          Camera type and projection mode allowing to arbitrary rotate camera.
 
Method Summary
 double getDist()
          Get distance of camera position from point of interest in world coordinates.
 double getFarClip()
          Get distance of the far clipping plane.
 double getFieldOfView()
          Get opening angle of camera.
 PdVector getInterest()
          Get position at which camera is directed, i.e. the point of interest.
 double getNearClip()
          Get distance of the near clipping plane.
 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.
 PdMatrix getTransMatrix(int type)
          Get transformation matrices PV, P, V and their inverses in current camera and display.
 PdVector getUpVector()
          Get up vector as second row of viewing matrix divided by scaling factor.
 PdVector getViewDir()
          Get normalized viewing direction which is the vector pointing from the camera to its interest.
 boolean isEnabledClip()
          Determine whether horizontal clipping is enabled.
 boolean isEnabledSceneRatio()
          Check of aspect ratio of scene bounding box is enabled.
 void saveAsDefault()
          Save the current transformation matrices as default.
 void setBoxRatio(PdVector ratio)
          Set the scaling factor for all three camera axis to produce a non-square viewing frustum.
 void setDist(double newDist)
          Set distance of camera position from point of interest in world coordinates.
 void setEnabledBoxRatio(boolean flag)
          Enable usage of a variable aspect ratio for the viewing frustum of this camera.
 void setEnabledClip(boolean flag)
          Enable horizontal clipping.
 void setEnabledSceneRatio(boolean flag)
          Set aspect ratio of scene bounding box.
 void setFarClip(double dist)
          Get distance of far clipping plane.
 void setFieldOfView(double angle)
          Set opening angle of camera.
 void setFullPosition(PdVector interest, PdVector position, PdVector upDir)
          Set full orientation and location of camera in world coordinates.
 void setInterest(PdVector pos)
          Set position at which camera is directed, i.e. the point of interest.
 void setName(java.lang.String name)
          Set name of instance.
 void setNearClip(double dist)
          Get distance of the near clipping plane.
 void setPosition(PdVector pos)
          Set position of camera in world coordinates.
 void setProjectionMode(int mode)
          Set projection mode of the camera, for example, perspective, xy-projection etc.
 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 setTransMatrix(int type, PdMatrix mat)
          Set transformation matrices PV, P, V and their inverses in current camera and display.
 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.
 
Methods inherited from interface jv.object.PsUpdateIf
getFather, getName, setParent, update
 

Field Detail

CAMERA_PERSPECTIVE

public static final int CAMERA_PERSPECTIVE
Camera type and projection mode allowing to arbitrary rotate camera.

See Also:
Constant Field Values

CAMERA_ORTHO_XY

public static final int CAMERA_ORTHO_XY
Camera type and projection mode projecting orthogonally onto xy-plane.

See Also:
Constant Field Values

CAMERA_ORTHO_XZ

public static final int CAMERA_ORTHO_XZ
Camera type and projection mode projecting orthogonally onto xz-plane.

See Also:
Constant Field Values

CAMERA_ORTHO_YZ

public static final int CAMERA_ORTHO_YZ
Camera type and projection mode projecting orthogonally onto yz-plane.

See Also:
Constant Field Values

CAMERA_MODEL

public static final int CAMERA_MODEL
Misused camera type in display, simulates transformation of modeling matrix of geometry.

See Also:
Constant Field Values

CAMERA_NAME

public 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 JVX. since JavaView 2.31

Method Detail

setName

public void setName(java.lang.String name)
Set name of instance. since JavaView 2.31


saveAsDefault

public void saveAsDefault()
Save the current transformation matrices as default.

Since:
JavaView 2.47

getProjectionMode

public int getProjectionMode()
Get projection mode of the camera, for example, perspective, xy-projection etc. For a list of possible type see PvCameraIf#CAMERA_ORTHO_XY.

Returns:
current projection mode
See Also:
PvDisplayIf

setProjectionMode

public void setProjectionMode(int mode)
Set projection mode of the camera, for example, perspective, xy-projection etc. For a list of possible type see PvCameraIf#CAMERA_ORTHO_XY.

Parameters:
mode - new projection mode
See Also:
PvDisplayIf

getViewDir

public 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

public 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

public 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

public void setDist(double newDist)
Set distance of camera position from point of interest in world coordinates. Scale view matrix with factor=newDist/currDist.

Parameters:
newDist - distance of camera to interest in world coordinates.
See Also:
setScale(double)

getScale

public double getScale()
Get zoom factor of camera.

Returns:
zoom factor of camera.
See Also:
getDist()

setScale

public void setScale(double newScale)
Set zoom factor of camera.

Parameters:
newScale - zoom factor of camera.
See Also:
setDist(double)

getFieldOfView

public double getFieldOfView()
Get opening angle of camera.

Returns:
angle in (0,180)
See Also:
setFieldOfView(double)

setFieldOfView

public void setFieldOfView(double angle)
Set opening angle of camera.

Parameters:
angle - angle in (0,180)
See Also:
getFieldOfView()

getRoll

public 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 positiv y-axis is showing upward.

Returns:
angle in (-pi,pi)
See Also:
setRoll(double)

setRoll

public 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

public 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

public 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

public PdVector getPosition()
Get position of camera in world coordinates. The camera position is implicitly stored and computed from
position = interest - dist*viewDir
.

Returns:
3d-position of camera in world coordinates.

setPosition

public void setPosition(PdVector pos)
Set position of camera in world coordinates. The camera position is implicitly stored by equation
position = interest - dist*viewDir
.

Parameters:
pos - 3d-position of camera in world coordinates.

setFullPosition

public 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 formula
position = 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

getUpVector

public 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

public void setUpVector(PdVector up)
Set normalized up vector of camera in world coordinates.

Parameters:
up - normalized up vector of camera in world coordinates.

isEnabledClip

public boolean isEnabledClip()
Determine whether horizontal clipping is enabled.


setEnabledClip

public void setEnabledClip(boolean flag)
Enable horizontal clipping.


getNearClip

public 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

public 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

public 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

public boolean isEnabledSceneRatio()
Check of aspect ratio of scene bounding box is enabled.


setEnabledSceneRatio

public void setEnabledSceneRatio(boolean flag)
Set aspect ratio of scene bounding box.


setEnabledBoxRatio

public void setEnabledBoxRatio(boolean flag)
Enable usage of a variable aspect ratio for the viewing frustum of this camera.


setBoxRatio

public 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

public 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

public 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, see PvDisplay.MATRIX_
Returns:
pointer to transformation matrix
Since:
JavaView 2.99.016

setTransMatrix

public 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, see PvDisplay.MATRIX_
mat - new transformation matrix
Since:
JavaView 2.47

JavaView© v3.95.000

The software JavaView© is copyright protected. All Rights Reserved.