com.visioglobe.libVisioDevKit
Class VgICamera

java.lang.Object
  extended by com.visioglobe.libVisioDevKit.VgICamera

public class VgICamera
extends java.lang.Object

This interface is used to retreive and control the camera parameters. Those parameters are the camera's position, heading and pitch. The position is expressed in "scene" coordinates (See VgICamera::getPosition and VgICamera::setPosition for more information). The heading is the angle with the North direction (See VgICamera::setHeading for more information). The pitch is the angle with the tangent plane (See VgICamera::setPitch for more information).

Interface:
VgEngine::VgICamera
Date:
25/02/2010

Field Summary
protected  boolean swigCMemOwn
           
 
Constructor Summary
VgICamera(long cPtr, boolean cMemoryOwn)
           
 
Method Summary
 void delete()
           
protected  void finalize()
           
static long getCPtr(VgICamera obj)
           
 double getFovX()
          Gets the camera's horizontal field of view.
 double getFovY()
          Gets the camera's vertical field of view.
 double getHeading()
          Retrieves the current camera's heading (in degrees).
 double getPitch()
          Retrieves the current camera's pitch (in degrees).
 VgPosition getPosition()
          Retrieves the current camera's position.
 VgIViewPoint getViewpoint()
          Gets the camera viewpoint.
 VgIViewPoint getViewpointFromPositions(VgPositionVector pPositions, long pTop, long pBottom, long pLeft, long pRight)
          Computes a viewpoint using the current pitch and heading, at which all given positions are visible
 VgIViewPoint getViewpointFromPositions(VgPositionVector pPositions, long pTop, long pBottom, long pLeft, long pRight, double pPitch, double pHeading)
          Computes a viewpoint using the current pitch and heading, at which all given positions are visible
 boolean pickGeographicPoint(double pX, double pY, VgPosition pPosition)
          Casts a ray from a point on the screen in the 3D scene.
 void projectOnScreen(VgPosition pPosition, double[] pXScreen, double[] pYScreen)
           
 void projectOnScreen(VgPosition pPosition, double[] pXScreen, double[] pYScreen, double[] pZScreen)
          Projects a position on the screen.
 void setFovX(double pFovX)
           
 void setFovX(double pFovX, double pRatio)
          Sets the camera's field of view.
 void setHeading(double pHeadingInDegrees)
          Sets the camera's heading (0 for north, increasing value start to east).
 void setPitch(double pPitchInDegrees)
          Sets the camera's pitch.
 void setPosition(VgPosition pPosition)
          Sets the camera's position.
 void setViewpoint(VgIViewPoint pViewpoint)
          Sets the camera viewpoint.
 
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

swigCMemOwn

protected boolean swigCMemOwn
Constructor Detail

VgICamera

public VgICamera(long cPtr,
                 boolean cMemoryOwn)
Method Detail

getCPtr

public static long getCPtr(VgICamera obj)

finalize

protected void finalize()
Overrides:
finalize in class java.lang.Object

delete

public void delete()

setPosition

public void setPosition(VgPosition pPosition)
Sets the camera's position.

Parameters:
pPosition - The position where the camera must be placed.
Remark:
In case the pPosition parameter is in the WGS84 spatial reference system, if the new position is not in the current dataset but is in the same UTM zone, the position remains unchanged. If the new position is in another UTM zone, the behaviour is undefined.
Note:
Since verion 2.0, the positions can now be expressed in various spatial reference systems. As a camera can only exist in "scene" coordinates, the provided position will be converted to the scene's spatial reference system. see VgEngine::VgPosition and VgEngine::VgSRS for more details.

setHeading

public void setHeading(double pHeadingInDegrees)
Sets the camera's heading (0 for north, increasing value start to east).

Parameters:
pHeadingInDegrees - Heading angle, expressed in degrees.

setPitch

public void setPitch(double pPitchInDegrees)
Sets the camera's pitch. 0 to look "forward" (at the horizon), -85 to look down and +85 to towards the zenith.

Parameters:
pPitchInDegrees - Pitch angle, expressed in degrees.

getPosition

public VgPosition getPosition()
Retrieves the current camera's position.

Returns:
The camera's position expressed in the scene's metric SRS.

getHeading

public double getHeading()
Retrieves the current camera's heading (in degrees). See VgICamera::setHeading for more information.


getPitch

public double getPitch()
Retrieves the current camera's pitch (in degrees). See VgICamera::setPitch for more information.


setViewpoint

public void setViewpoint(VgIViewPoint pViewpoint)
Sets the camera viewpoint.

Parameters:
pViewpoint - The viewpoint to set.
Note:
The same note on positions as in VgEngine::VgICamera::setPosition applies here.

getViewpoint

public VgIViewPoint getViewpoint()
Gets the camera viewpoint.

Note:
The same note on positions as in VgEngine::VgICamera::getPosition applies here. Position in the returned viewpoint is in the scene's SRS.

projectOnScreen

public void projectOnScreen(VgPosition pPosition,
                            double[] pXScreen,
                            double[] pYScreen,
                            double[] pZScreen)
Projects a position on the screen.

Parameters:
pPosition - the geographic position to be projected on the screen.
pXScreen - the projected X coordinate on the screen. This value is normalized between 0 and 1, where 0 is on the left of the screen
pYScreen - the projected Y coordinate on the screen. This value is normalized between 0 and 1, where 0 is on the bottom of the screen.
pZScreen - the projected Z coordinate on the screen. If the projected point is in the view frustum the value is between 0 and 1.
Note:
The same note on positions as in VgEngine::VgICamera::setPosition applies here.

projectOnScreen

public void projectOnScreen(VgPosition pPosition,
                            double[] pXScreen,
                            double[] pYScreen)

pickGeographicPoint

public boolean pickGeographicPoint(double pX,
                                   double pY,
                                   VgPosition pPosition)
Casts a ray from a point on the screen in the 3D scene.

Parameters:
pX - the normalized X screen coordinate (0 is on the left of the screen, 1 on the right).
pY - the normalized Y screen coordinate (0 is on the bottom of the screen, 1 on the top).
pPosition - the geographic position if an intersection has been found. Expressed in the scene's SRS
Returns:
true if there is an intersection, false otherwise.

getViewpointFromPositions

public VgIViewPoint getViewpointFromPositions(VgPositionVector pPositions,
                                              long pTop,
                                              long pBottom,
                                              long pLeft,
                                              long pRight,
                                              double pPitch,
                                              double pHeading)
Computes a viewpoint using the current pitch and heading, at which all given positions are visible

Parameters:
pPositions - List of positions to see.
pTop - The top padding area's height to use (in pixels)
pBottom - The bottom padding area's height to use (in pixels)
pLeft - The left padding area's width to use (in pixels)
pRight - The right padding area's width to use (in pixels)
pPitch - The pitch to use for computation if "not-a-number" current pitch will be used.
pHeading - The pitch to use for computation if "not-a-number" current heading will be used.
Note:
When no position is provided (empty vector), the current viewpoint is returned., When only one position is provided there is an additional constraint that forces the viewpoint to keep the current altitude. This can lead to results where the provided position would be behind the camera. For example, this will happen if the view is looking down and the point is above the camera., The same notes on positions as in VgEngine::VgICamera::setPosition and VgEngine::VgICamera::getPosition apply here. The input positions will be converted to the scene's metric SRS. The computing will be done in the scene's metric SRS, and the resulting viewpoint's position expressed in it.

getViewpointFromPositions

public VgIViewPoint getViewpointFromPositions(VgPositionVector pPositions,
                                              long pTop,
                                              long pBottom,
                                              long pLeft,
                                              long pRight)
Computes a viewpoint using the current pitch and heading, at which all given positions are visible

Parameters:
pPositions - List of positions to see.
pTop - The top padding area's height to use (in pixels)
pBottom - The bottom padding area's height to use (in pixels)
pLeft - The left padding area's width to use (in pixels)
pRight - The right padding area's width to use (in pixels)
Note:
When no position is provided (empty vector), the current viewpoint is returned., When only one position is provided there is an additional constraint that forces the viewpoint to keep the current altitude. This can lead to results where the provided position would be behind the camera. For example, this will happen if the view is looking down and the point is above the camera., The same notes on positions as in VgEngine::VgICamera::setPosition and VgEngine::VgICamera::getPosition apply here. The input positions will be converted to the scene's metric SRS. The computing will be done in the scene's metric SRS, and the resulting viewpoint's position expressed in it.

getFovX

public double getFovX()
Gets the camera's horizontal field of view.

Returns:
The camera's horizontal field of view angle in degrees.
Remark:
This value depends on the rendering viewport size. Remember to call this after resize if necessary.

getFovY

public double getFovY()
Gets the camera's vertical field of view.

Returns:
The camera's vertical field of view angle in degrees.
Remark:
This value depends on the rendering viewport size. Remember to call this after resize if necessary.

setFovX

public void setFovX(double pFovX,
                    double pRatio)
Sets the camera's field of view. The VisioDevKit's policy for the field of view is adaptative, this means that the engine will try to always have the same "amount of view" per pixel. As a result, when the size of the rendering surface changes, the field of view changes in order to keep a constant pixel ratio.

Parameters:
pFovX - The new field of view angle in degrees (will be clamped to reasonable values).
pRatio - Optional aspect ratio (if negative, ratio will be computed from screen resolution).

setFovX

public void setFovX(double pFovX)

VisioDevKit 2.0, Visioglobe® 2013