org.opensourcephysics.display3d.simple3d
Class Camera

java.lang.Object
  extended by org.opensourcephysics.display3d.simple3d.Camera
All Implemented Interfaces:
Camera

public class Camera
extends java.lang.Object
implements Camera


Nested Class Summary
protected static class Camera.CameraLoader
           
 
Nested classes/interfaces inherited from interface org.opensourcephysics.display3d.core.Camera
Camera.Loader
 
Field Summary
 
Fields inherited from interface org.opensourcephysics.display3d.core.Camera
MODE_NO_PERSPECTIVE, MODE_PERSPECTIVE, MODE_PLANAR_XY, MODE_PLANAR_XZ, MODE_PLANAR_YZ
 
Method Summary
 void copyFrom(Camera camera)
          Copies its configuration from another camera
 double getAltitude()
          Get the elevation (vertical) angle of the camera position in spherical coordinates with respect to the focus point.
 double getAzimuth()
          Get the horizontal angle of the camera position in spherical coordinates with respect to the focus point.
 double getDistanceToScreen()
          Returns the distance from the camera to the projecting screen.
 double getFocusX()
          Returns the focus X coordinate
 double getFocusY()
          Returns the focus Y coordinate
 double getFocusZ()
          Returns the focus Z coordinate
static XML.ObjectLoader getLoader()
           
 int getProjectionMode()
          Gets the projecting mode of the camera.
 double getRotation()
          Returns the angle that the camera is rotated along the line of sight.
 Transformation getTransformation()
          Returns the transfomation used to project (x,y,z) points in space to points of the form (a,b,distance).
 double getX()
          Returns the camera X coordinate
 double getY()
          Returns the camera Y coordinate
 double getZ()
          Returns the camera Z coordinate
 void reset()
          Resets the camera to the default.
 void setAltitude(double angle)
          Set the elevation (vertical) angle of the camera position in spherical coordinates with respect to the focus point.
 void setAzimuth(double angle)
          Set the azimuthal (horizontal) angle of the camera position in spherical coordinates with respect to the focus point.
 void setAzimuthAndAltitude(double azimuth, double altitude)
          Set the angles of the camera position in spherical coordinates with respect to the focus point.
 void setDistanceToScreen(double distance)
          Sets the distance from the camera to the projecting screen.
 void setFocusXYZ(double[] point)
          Sets the focus of the camera.
 void setFocusXYZ(double x, double y, double z)
          Sets the focus point of the camera.
 void setProjectionMode(int mode)
          Sets one of the projecting modes.
 void setRotation(double angle)
          Sets the angle that the camera is rotated along the line of sight.
 void setXYZ(double[] point)
          Sets the position of the camera.
 void setXYZ(double x, double y, double z)
          Sets the position of the camera.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

setProjectionMode

public void setProjectionMode(int mode)
Description copied from interface: Camera
Sets one of the projecting modes. Possible values are:

Changing the mode does not reset the camera.

Specified by:
setProjectionMode in interface Camera
Parameters:
mode - int

getProjectionMode

public final int getProjectionMode()
Description copied from interface: Camera
Gets the projecting mode of the camera.

Specified by:
getProjectionMode in interface Camera
Returns:
int #see #setProjectionMode(int)

reset

public void reset()
Description copied from interface: Camera
Resets the camera to the default. The camera is placed along the X direction, at a reasonable distance from the center of the panel, which becomes the focus, and is not rotated. The screen is also placed at a reasonable distance so that to view the whole scene.

Specified by:
reset in interface Camera

setXYZ

public void setXYZ(double x,
                   double y,
                   double z)
Description copied from interface: Camera
Sets the position of the camera.

Specified by:
setXYZ in interface Camera
Parameters:
x - double
y - double
z - double

setXYZ

public void setXYZ(double[] point)
Description copied from interface: Camera
Sets the position of the camera.

Specified by:
setXYZ in interface Camera
Parameters:
point - double[]

getX

public final double getX()
Description copied from interface: Camera
Returns the camera X coordinate

Specified by:
getX in interface Camera
Returns:
double the X coordinate of the camera position

getY

public final double getY()
Description copied from interface: Camera
Returns the camera Y coordinate

Specified by:
getY in interface Camera
Returns:
double the Y coordinate of the camera position

getZ

public final double getZ()
Description copied from interface: Camera
Returns the camera Z coordinate

Specified by:
getZ in interface Camera
Returns:
double the Z coordinate of the camera position

setFocusXYZ

public void setFocusXYZ(double x,
                        double y,
                        double z)
Description copied from interface: Camera
Sets the focus point of the camera. That it, the point in space at which the camera is pointing.

Specified by:
setFocusXYZ in interface Camera
Parameters:
x - double
y - double
z - double

setFocusXYZ

public void setFocusXYZ(double[] point)
Description copied from interface: Camera
Sets the focus of the camera.

Specified by:
setFocusXYZ in interface Camera
Parameters:
point - double[]

getFocusX

public final double getFocusX()
Description copied from interface: Camera
Returns the focus X coordinate

Specified by:
getFocusX in interface Camera
Returns:
double the X coordinate of the focus position

getFocusY

public final double getFocusY()
Description copied from interface: Camera
Returns the focus Y coordinate

Specified by:
getFocusY in interface Camera
Returns:
double the Y coordinate of the focus position

getFocusZ

public final double getFocusZ()
Description copied from interface: Camera
Returns the focus Z coordinate

Specified by:
getFocusZ in interface Camera
Returns:
double the Z coordinate of the focus position

setRotation

public void setRotation(double angle)
Description copied from interface: Camera
Sets the angle that the camera is rotated along the line of sight. Default is 0.

Specified by:
setRotation in interface Camera
Parameters:
angle - double The angle in radians

getRotation

public final double getRotation()
Description copied from interface: Camera
Returns the angle that the camera is rotated along the line of sight.

Specified by:
getRotation in interface Camera
Returns:
double

setDistanceToScreen

public void setDistanceToScreen(double distance)
Description copied from interface: Camera
Sets the distance from the camera to the projecting screen.

Specified by:
setDistanceToScreen in interface Camera
Parameters:
distance - double

getDistanceToScreen

public final double getDistanceToScreen()
Description copied from interface: Camera
Returns the distance from the camera to the projecting screen.

Specified by:
getDistanceToScreen in interface Camera
Returns:
double

setAzimuth

public void setAzimuth(double angle)
Description copied from interface: Camera
Set the azimuthal (horizontal) angle of the camera position in spherical coordinates with respect to the focus point. A value of 0 places the camera in the XZ plane.

Specified by:
setAzimuth in interface Camera
Parameters:
angle - the desired angle in radians

getAzimuth

public final double getAzimuth()
Description copied from interface: Camera
Get the horizontal angle of the camera position in spherical coordinates with respect to the focus point. A value of 0 means the camera is in the XZ plane.

Specified by:
getAzimuth in interface Camera
Returns:
double

setAltitude

public void setAltitude(double angle)
Description copied from interface: Camera
Set the elevation (vertical) angle of the camera position in spherical coordinates with respect to the focus point. A value of 0 places the camera is in the XY plane.

Specified by:
setAltitude in interface Camera
Parameters:
angle - the desired angle in radians in the range [-Math.PI/2,Math.PI/2]

getAltitude

public final double getAltitude()
Description copied from interface: Camera
Get the elevation (vertical) angle of the camera position in spherical coordinates with respect to the focus point. A value of 0 means the camera is in the XY plane.

Specified by:
getAltitude in interface Camera
Returns:
double

setAzimuthAndAltitude

public void setAzimuthAndAltitude(double azimuth,
                                  double altitude)
Description copied from interface: Camera
Set the angles of the camera position in spherical coordinates with respect to the focus point.

Specified by:
setAzimuthAndAltitude in interface Camera
Parameters:
azimuth - the desired azimuthal angle in radians
altitude - the desired altitude angle in radians in the range [-Math.PI/2,Math.PI/2]

getTransformation

public final Transformation getTransformation()
Description copied from interface: Camera
Returns the transfomation used to project (x,y,z) points in space to points of the form (a,b,distance). (a,b) are the coordinates of the projected point in the screen coordinate system. distance is a measure of how far the point is from the camera. Typically, points in the plane parallel to the screen at the focus point are at distance=1.

Specified by:
getTransformation in interface Camera
Returns:
double

copyFrom

public void copyFrom(Camera camera)
Description copied from interface: Camera
Copies its configuration from another camera

Specified by:
copyFrom in interface Camera

getLoader

public static XML.ObjectLoader getLoader()