de.ba_ravensburg.gdv.model
Class Scene

java.lang.Object
  extended by de.ba_ravensburg.gdv.model.Scene

public class Scene
extends Object

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°.

Author:
Ansgar Wiechers

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

DEFAULT_APERTURE

static final double DEFAULT_APERTURE
The default aperture of the camera.

See Also:
Constant Field Values

DEFAULT_CAMERA_X

static final double[] DEFAULT_CAMERA_X
The default direction of the x-axis of the camera coordinate.


DEFAULT_CAMERA_Y

static final double[] DEFAULT_CAMERA_Y
The default direction of the y-axis of the camera coordinate. This is the viewing direction of the camera.


DEFAULT_CAMERA_Z

static final double[] DEFAULT_CAMERA_Z
The default direction of the z-axis of the camera coordinate.


DEFAULT_DIRECTION

static final double[] DEFAULT_DIRECTION
The default viewing direction of the camera.


DEFAULT_POSITION

static final double[] DEFAULT_POSITION
The default position of the camera.


DIMENSION

public static final int DIMENSION
The dimension of the Scene.

See Also:
Constant Field Values

GROUND_COLOR

public static final Color GROUND_COLOR
The default color of the scene's base.


LEFTRIGHT

static final int LEFTRIGHT
Constant representing horizontal turns.

See Also:
Constant Field Values

UPDOWN

static final int UPDOWN
Constant representing vertical turns.

See Also:
Constant Field Values

X

public static final int X
Constant representing x-direction.

See Also:
Constant Field Values

Y

public static final int Y
Constant representing y-direction.

See Also:
Constant Field Values

Z

public static final int Z
Constant representing z-direction.

See Also:
Constant Field Values
Constructor Detail

Scene

public Scene()
      throws IllegalArgumentException
Constructs a new scene with default camera position, camera direction and camera aperture.

Throws:
IllegalArgumentException

Scene

public Scene(double x,
             double y,
             double z)
      throws IllegalArgumentException
Constructs a new scene with given camera position and default camera direction and camera aperture.

Parameters:
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.
Throws:
IllegalArgumentException

Scene

public Scene(double x,
             double y,
             double z,
             double phi,
             double rho)
      throws IllegalArgumentException
Constructs a new scene with given camera position and camera direction and default camera aperture.

Parameters:
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.
Throws:
IllegalArgumentException

Scene

public Scene(double x,
             double y,
             double z,
             double dirX,
             double dirY,
             double dirZ)
      throws IllegalArgumentException
Constructs a new scene with given camera position and camera direction and default camera aperture.

Parameters:
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.
Throws:
IllegalArgumentException
Method Detail

add

public boolean add(Triangle theTriangle)
Add a triangle to the scene.

Parameters:
theTriangle - triangle to be added to the scene.
Returns:
true if the triangle was successfully added, else false.

getAperture

public double getAperture()
Get the current aperture of the camera.

Returns:
current aperture of the camera in degree.

getDirection

public double[] getDirection()
Get the view direction of the camera. This returns just the viewing direction (the y-axis of the camera coordinate), not the entire orientation of the camera.

Returns:
view direction of the camera.

getPos

public double[] getPos()
Get the current camera position in the world coordinate.

Returns:
current position of the camera.

getTriangles

public HashSet getTriangles()
Get all triangles from the scene.

Returns:
collection with all triangles of the scene.

moveBackward

public void moveBackward(double step)
Move the camera backward.

Parameters:
step - the distance how far the camera shall be moved.

moveDownward

public void moveDownward(double step)
Move the camera downward.

Parameters:
step - the distance how far the camera shall be moved.

moveForward

public void moveForward(double step)
Move the camera forward.

Parameters:
step - the distance how far the camera shall be moved.

moveLeft

public void moveLeft(double step)
Move the camera to the left.

Parameters:
step - the distance how far the camera shall be moved.

moveRight

public void moveRight(double step)
Move the camera to the right.

Parameters:
step - the distance how far the camera shall be moved.

moveUpward

public void moveUpward(double step)
Move the camera upward.

Parameters:
step - the distance how far the camera shall be moved.

setAperture

public void setAperture(double theAperture)
                 throws IllegalArgumentException
Set the aperture of the camera.

Pre: 0° < theAperture <= 180°
Post: aperture == theAperture

Parameters:
theAperture - the new aperture.
Throws:
IllegalArgumentException

setDirection

public void setDirection(double yawAngle,
                         double pitchAngle)
Set the new direction of the camera.

Pre: true
Post: The view direction of the camera is changed according to the given angles. The scene is rotated accordingly.

Parameters:
yawAngle - horizontal spheric coordinate angle of the new camera direction.
pitchAngle - vertical spheric coordinate angle of the new camera direction.

setDirection

public void setDirection(double x,
                         double y,
                         double z)
                  throws IllegalArgumentException
Set the new direction of the camera.

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.

Parameters:
x - x-coordinate of the new camera direction.
y - y-coordinate of the new camera direction.
z - z-coordinate of the new camera direction.
Throws:
IllegalArgumentException

setPos

public void setPos(double x,
                   double y,
                   double z)
            throws IllegalArgumentException
Set camera position in the scene.

Pre: z >= 0
Post: The position of the camera is set to cameraPosition

Parameters:
x - x-coordinate of the new camera position.
y - y-coordinate of the new camera position.
z - z-coordinate of the new camera position.
Throws:
IllegalArgumentException

turnDownward

public void turnDownward(double angle)
Turn the camera downward.

Parameters:
angle - the angle in degree.

turnLeft

public void turnLeft(double angle)
Turn the camera to the left.

Parameters:
angle - the angle in degree.

turnRight

public void turnRight(double angle)
Turn the camera to the right.

Parameters:
angle - the angle in degree.

turnUpward

public void turnUpward(double angle)
Turn the camera upward.

Parameters:
angle - the angle in degree.


Copyright © 2004 Max Schloss and Ansgar Wiechers. All Rights Reserved.