Class Camera
java.lang.Object
org.opensourcephysics.display3d.simple3d.Camera
- All Implemented Interfaces:
Camera
-
Nested Class Summary
Nested ClassesNested 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_PERSPECTIVE_OFF, MODE_PERSPECTIVE_ON, MODE_PLANAR_XY, MODE_PLANAR_XZ, MODE_PLANAR_YZ
-
Method Summary
Modifier and TypeMethodDescriptionvoid
Copies its configuration from another camerafinal double
Get the elevation (vertical) angle of the camera position in spherical coordinates with respect to the focus point.final double
Get the horizontal angle of the camera position in spherical coordinates with respect to the focus point.final double
Returns the distance from the camera to the projecting screen.final double
Returns the focus X coordinatefinal double
Returns the focus Y coordinatefinal double
Returns the focus Z coordinatestatic XML.ObjectLoader
final int
Gets the projecting mode of the camera.final double
Returns the angle that the camera is rotated along the line of sight.final Transformation
Returns the transfomation used to project (x,y,z) points in space to points of the form (a,b,distance).final double
getX()
Returns the camera X coordinatefinal double
getY()
Returns the camera Y coordinatefinal double
getZ()
Returns the camera Z coordinatevoid
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.
-
Method Details
-
setProjectionMode
public void setProjectionMode(int mode) Description copied from interface:Camera
Sets one of the projecting modes. Possible values are:- MODE_PERSPECTIVE or MODE_PERSPECTIVE_ON: 3D mode in which objects far away look smaller.
- MODE_NO_PERSPECTIVE or MODE_PERSPECTIVE_OFF: 3D mode in which distance doesn't affect the size of the objects
- MODE_PLANAR_XY: 2D mode in which only the X and Y coordinates are displayed.
- MODE_PLANAR_XZ: 2D mode in which only the X and Z coordinates are displayed.
- MODE_PLANAR_YZ: 2D mode in which only the Y and Z coordinates are displayed.
Changing the mode does not reset the camera.
- Specified by:
setProjectionMode
in interfaceCamera
- Parameters:
mode
- int
-
getProjectionMode
public final int getProjectionMode()Description copied from interface:Camera
Gets the projecting mode of the camera.- Specified by:
getProjectionMode
in interfaceCamera
- 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. -
setXYZ
public void setXYZ(double x, double y, double z) Description copied from interface:Camera
Sets the position of the camera. -
setXYZ
public void setXYZ(double[] point) Description copied from interface:Camera
Sets the position of the camera. -
getX
public final double getX()Description copied from interface:Camera
Returns the camera X coordinate -
getY
public final double getY()Description copied from interface:Camera
Returns the camera Y coordinate -
getZ
public final double getZ()Description copied from interface:Camera
Returns the camera Z coordinate -
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 interfaceCamera
- Parameters:
x
- doubley
- doublez
- double
-
setFocusXYZ
public void setFocusXYZ(double[] point) Description copied from interface:Camera
Sets the focus of the camera.- Specified by:
setFocusXYZ
in interfaceCamera
- Parameters:
point
- double[]
-
getFocusX
public final double getFocusX()Description copied from interface:Camera
Returns the focus X coordinate -
getFocusY
public final double getFocusY()Description copied from interface:Camera
Returns the focus Y coordinate -
getFocusZ
public final double getFocusZ()Description copied from interface:Camera
Returns the focus Z coordinate -
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 interfaceCamera
- 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 interfaceCamera
- 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 interfaceCamera
- 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 interfaceCamera
- 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 interfaceCamera
- 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 interfaceCamera
- 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 interfaceCamera
- 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 interfaceCamera
- 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 interfaceCamera
- Parameters:
azimuth
- the desired azimuthal angle in radiansaltitude
- the desired altitude angle in radians in the range [-Math.PI/2,Math.PI/2]
-
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 interfaceCamera
- Returns:
- double
-
copyFrom
Description copied from interface:Camera
Copies its configuration from another camera -
getLoader
-