public class Simple1DOFCamera
extends java.lang.Object
For rotationX = 0, the camera will be at y=distance, x=0, so that the default view will have the usual X/Y plane on the ground.
Modifier and Type | Class and Description |
---|---|
static interface |
Simple1DOFCamera.CameraListener
Camera Listener class
|
Modifier and Type | Field and Description |
---|---|
private double |
cosZ
Cache the Z rotation cosine
|
private double |
distance
Distance
|
private javax.media.opengl.glu.GLU |
glu
GLU utility
|
private double |
height
Height
|
(package private) java.util.ArrayList<Simple1DOFCamera.CameraListener> |
listeners
Camera listener list.
|
private double[] |
modelview
GLU model view matrix
|
private double[] |
projection
GLU projection matrix
|
private double |
ratio
Screen ratio
|
private double |
rotationZ
Rotation on X axis.
|
private double |
sinZ
Cache the Z rotation sine
|
private int[] |
viewp
GLU viewport storage
|
Constructor and Description |
---|
Simple1DOFCamera(javax.media.opengl.glu.GLU glu)
Constructor.
|
Simple1DOFCamera(Simple1DOFCamera other)
Copy constructor, for freezing a camera position.
|
Modifier and Type | Method and Description |
---|---|
void |
addCameraListener(Simple1DOFCamera.CameraListener lis)
Add a camera listener.
|
void |
apply(javax.media.opengl.GL2 gl)
Apply the camera to a GL context.
|
protected void |
fireCameraChangedEvent()
Fire the camera changed event.
|
double |
getDistance()
Get the distance
|
double |
getHeight()
Get camera height
|
double |
getRatio()
Get screen ratio.
|
double |
getRotationZ()
Get the Z rotation in radians.
|
void |
project(double x,
double y,
double z,
double[] out)
Project a coordinate
|
void |
removeCameraListener(Simple1DOFCamera.CameraListener lis)
Remove a camera listener.
|
void |
setDistance(double distance)
Set camera distance
|
void |
setHeight(double height)
Set camera height
|
void |
setRatio(double ratio)
Set screen ratio.
|
void |
setRotationZ(double rotationZ)
Set the z rotation angle in radians.
|
double |
squaredDistanceFromCamera(double x,
double y)
Distance from camera
|
double |
squaredDistanceFromCamera(double x,
double y,
double z)
Distance from camera
|
double[] |
unproject(double x,
double y,
double z)
Unproject a screen coordinate (at depth 0) to 3D model coordinates.
|
void |
unproject(double x,
double y,
double z,
double[] out)
Unproject a screen coordinate (at depth 0) to 3D model coordinates.
|
private double rotationZ
private double distance
private double height
private double ratio
private int[] viewp
private double[] modelview
private double[] projection
private javax.media.opengl.glu.GLU glu
private double cosZ
private double sinZ
java.util.ArrayList<Simple1DOFCamera.CameraListener> listeners
public Simple1DOFCamera(javax.media.opengl.glu.GLU glu)
glu
- GLU utility classpublic Simple1DOFCamera(Simple1DOFCamera other)
other
- Existing camerapublic double getDistance()
public void setDistance(double distance)
distance
- Distancepublic double getHeight()
public void setHeight(double height)
height
- Camera heightpublic double getRatio()
public void setRatio(double ratio)
ratio
- Screen ratiopublic double getRotationZ()
public void setRotationZ(double rotationZ)
rotationZ
- Z rotation angle.public void apply(javax.media.opengl.GL2 gl)
gl
- GL context.public double[] unproject(double x, double y, double z)
x
- Xy
- Yz
- Zpublic void unproject(double x, double y, double z, double[] out)
x
- Xy
- Yz
- Zout
- output bufferpublic void project(double x, double y, double z, double[] out)
x
- Xy
- Yz
- Zout
- output bufferpublic double squaredDistanceFromCamera(double x, double y)
x
- X positiony
- Y positionpublic double squaredDistanceFromCamera(double x, double y, double z)
x
- X positiony
- Y positionz
- Z positionpublic void addCameraListener(Simple1DOFCamera.CameraListener lis)
lis
- Listenerpublic void removeCameraListener(Simple1DOFCamera.CameraListener lis)
lis
- Listenerprotected void fireCameraChangedEvent()
Copyright © 2019 ELKI Development Team. License information.