|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectde.ba_ravensburg.gdv.model.Scene
public class Scene
The Scene contains all triangles as well as the camera. The camera is defined by its position, direction and aperture. The height of the camera position (z-coordinate) cannot be less than zero, the aperture must be greater than zero, but at most 180°.
Field Summary | |
---|---|
(package private) static double |
DEFAULT_APERTURE
The default aperture of the camera. |
(package private) static double[] |
DEFAULT_CAMERA_X
The default direction of the x-axis of the camera coordinate. |
(package private) static double[] |
DEFAULT_CAMERA_Y
The default direction of the y-axis of the camera coordinate. |
(package private) static double[] |
DEFAULT_CAMERA_Z
The default direction of the z-axis of the camera coordinate. |
(package private) static double[] |
DEFAULT_DIRECTION
The default viewing direction of the camera. |
(package private) static double[] |
DEFAULT_POSITION
The default position of the camera. |
static int |
DIMENSION
The dimension of the Scene. |
static Color |
GROUND_COLOR
The default color of the scene's base. |
(package private) static int |
LEFTRIGHT
Constant representing horizontal turns. |
(package private) static int |
UPDOWN
Constant representing vertical turns. |
static int |
X
Constant representing x-direction. |
static int |
Y
Constant representing y-direction. |
static int |
Z
Constant representing z-direction. |
Constructor Summary | |
---|---|
Scene()
Constructs a new scene with default camera position, camera direction and camera aperture. |
|
Scene(double x,
double y,
double z)
Constructs a new scene with given camera position and default camera direction and camera aperture. |
|
Scene(double x,
double y,
double z,
double phi,
double rho)
Constructs a new scene with given camera position and camera direction and default camera aperture. |
|
Scene(double x,
double y,
double z,
double dirX,
double dirY,
double dirZ)
Constructs a new scene with given camera position and camera direction and default camera aperture. |
Method Summary | |
---|---|
boolean |
add(Triangle theTriangle)
Add a triangle to the scene. |
double |
getAperture()
Get the current aperture of the camera. |
double[] |
getDirection()
Get the view direction of the camera. |
double[] |
getPos()
Get the current camera position in the world coordinate. |
HashSet |
getTriangles()
Get all triangles from the scene. |
void |
moveBackward(double step)
Move the camera backward. |
void |
moveDownward(double step)
Move the camera downward. |
void |
moveForward(double step)
Move the camera forward. |
void |
moveLeft(double step)
Move the camera to the left. |
void |
moveRight(double step)
Move the camera to the right. |
void |
moveUpward(double step)
Move the camera upward. |
void |
setAperture(double theAperture)
Set the aperture of the camera. |
void |
setDirection(double yawAngle,
double pitchAngle)
Set the new direction of the camera. |
void |
setDirection(double x,
double y,
double z)
Set the new direction of the camera. |
void |
setPos(double x,
double y,
double z)
Set camera position in the scene. |
void |
turnDownward(double angle)
Turn the camera downward. |
void |
turnLeft(double angle)
Turn the camera to the left. |
void |
turnRight(double angle)
Turn the camera to the right. |
void |
turnUpward(double angle)
Turn the camera upward. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
static final double DEFAULT_APERTURE
static final double[] DEFAULT_CAMERA_X
static final double[] DEFAULT_CAMERA_Y
static final double[] DEFAULT_CAMERA_Z
static final double[] DEFAULT_DIRECTION
static final double[] DEFAULT_POSITION
public static final int DIMENSION
public static final Color GROUND_COLOR
static final int LEFTRIGHT
static final int UPDOWN
public static final int X
public static final int Y
public static final int Z
Constructor Detail |
---|
public Scene() throws IllegalArgumentException
IllegalArgumentException
public Scene(double x, double y, double z) throws IllegalArgumentException
x
- x-coordinate of the camera position in the world coordinate.y
- y-coordinate of the camera position in the world coordinate.z
- z-coordinate of the camera position in the world coordinate.
IllegalArgumentException
public Scene(double x, double y, double z, double phi, double rho) throws IllegalArgumentException
x
- x-coordinate of the camera position in the world coordinate.y
- y-coordinate of the camera position in the world coordinate.z
- z-coordinate of the camera position in the world coordinate.phi
- x-coordinate of initial view direction of the camera.rho
- y-coordinate of initial view direction of the camera.
IllegalArgumentException
public Scene(double x, double y, double z, double dirX, double dirY, double dirZ) throws IllegalArgumentException
x
- x-coordinate of the camera position in the world coordinate.y
- y-coordinate of the camera position in the world coordinate.z
- z-coordinate of the camera position in the world coordinate.dirX
- x-coordinate of initial view direction of the camera.dirY
- y-coordinate of initial view direction of the camera.dirZ
- z-coordinate of initial view direction of the camera.
IllegalArgumentException
Method Detail |
---|
public boolean add(Triangle theTriangle)
theTriangle
- triangle to be added to the scene.
public double getAperture()
public double[] getDirection()
public double[] getPos()
public HashSet getTriangles()
public void moveBackward(double step)
step
- the distance how far the camera shall be moved.public void moveDownward(double step)
step
- the distance how far the camera shall be moved.public void moveForward(double step)
step
- the distance how far the camera shall be moved.public void moveLeft(double step)
step
- the distance how far the camera shall be moved.public void moveRight(double step)
step
- the distance how far the camera shall be moved.public void moveUpward(double step)
step
- the distance how far the camera shall be moved.public void setAperture(double theAperture) throws IllegalArgumentException
Pre: | 0° < theAperture <= 180° |
Post: | aperture == theAperture |
theAperture
- the new aperture.
IllegalArgumentException
public void setDirection(double yawAngle, double pitchAngle)
Pre: | true |
Post: | The view direction of the camera is changed according to the given angles. The scene is rotated accordingly. |
yawAngle
- horizontal spheric coordinate angle of the new camera
direction.pitchAngle
- vertical spheric coordinate angle of the new camera
direction.public void setDirection(double x, double y, double z) throws IllegalArgumentException
Pre: | at least one of x, y and z is different from zero. |
Post: | The view direction of the camera is changed to the new coordinates. The scene is rotated accordingly. |
x
- x-coordinate of the new camera direction.y
- y-coordinate of the new camera direction.z
- z-coordinate of the new camera direction.
IllegalArgumentException
public void setPos(double x, double y, double z) throws IllegalArgumentException
Pre: | z >= 0 |
Post: | The position of the camera is set to cameraPosition |
x
- x-coordinate of the new camera position.y
- y-coordinate of the new camera position.z
- z-coordinate of the new camera position.
IllegalArgumentException
public void turnDownward(double angle)
angle
- the angle in degree.public void turnLeft(double angle)
angle
- the angle in degree.public void turnRight(double angle)
angle
- the angle in degree.public void turnUpward(double angle)
angle
- the angle in degree.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |