Jazz3D API


com.sygem.jazz3d3
Class Camera3d

java.lang.Object
  |
  +--com.sygem.jazz3d3.Camera3d

public class Camera3d
extends java.lang.Object

A viewpoint into the world. The use of a Camera3d class can make your interactive Jazz3D programs considerably more efficient. For example, if you wanted to move around the World without a Camera3d object, you would need to move every single object in the World to achieve the illusion of movement. With the use of a Camera3d object, this is not required. Note that every World always has a default Camera3d added to it, at position (0,0,0).

Version:
3.0a
Author:
SyGem Software

Constructor Summary
Camera3d()
          Default constructor.
 
Method Summary
 Vertex getPosition()
          Get the position of the camera.
 double getXPosition()
          Get the x position of the camera.
 double getYPosition()
          Get the y position of the camera.
 double getZPosition()
          Get the z position of the camera.
 void pointAt(double x, double y, double z)
          Point the camera somewhere.
 void pointAt(Object3d obj)
          Point the camera at an object.
 void pointAt(Vertex v)
          Point the camera somewhere.
 void rotateLocal(double x, double y, double z)
          Rotates the camera a given amount around the camera's own axis.
 void rotateLocal(double x, double y, double z, double px, double py, double pz)
          Rotates the camera a given amount around a specified point, around the camera's own axis.
 void rotatePointAt(double x, double y, double z)
          Rotate the pointAt vector to point the camera somewhere.
 void rotateWorld(double x, double y, double z)
          Rotates the camera a given amount around the static world axis.
 void rotateWorld(double x, double y, double z, double px, double py, double pz)
          Rotates the camera a given amount around a specified point, around the static world axis.
 void setPosition(double x, double y, double z)
          Sets the position of the camera.
 void setPosition(Vertex v)
          Sets the position of the camera.
 void translateLocal(double x, double y, double z)
          Move the camera relative to its own axis.
 void translateWorld(double x, double y, double z)
          Move the camera relative to the world axis.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Camera3d

public Camera3d()
Default constructor. Creates a camera at position (0,0,0).
Method Detail

setPosition

public final void setPosition(Vertex v)
Sets the position of the camera.

Parameters:
v - A vertex representing the new location of the camera.
See Also:
setPosition(double, double, double)

setPosition

public final void setPosition(double x,
                              double y,
                              double z)
Sets the position of the camera.
Parameters:
x - The x component of the new location of the camera.
y - The y component of the new location of the camera.
z - The z component of the new location of the camera.
See Also:
setPosition(Vertex)

getXPosition

public final double getXPosition()
Get the x position of the camera. This is relative to the world axis.
Returns:
The x position of the camera

getYPosition

public final double getYPosition()
Get the y position of the camera. This is relative to the world axis.
Returns:
The y position of the camera

getZPosition

public final double getZPosition()
Get the z position of the camera. This is relative to the world axis.
Returns:
The z position of the camera

getPosition

public final Vertex getPosition()
Get the position of the camera. This is relative to the world axis.
Returns:
A vertex containing the position of the camera

translateWorld

public final void translateWorld(double x,
                                 double y,
                                 double z)
Move the camera relative to the world axis.
Parameters:
x - The distance to move the camera along the x axis.
y - The distance to move the camera along the y axis.
z - The distance to move the camera along the z axis.

translateLocal

public final void translateLocal(double x,
                                 double y,
                                 double z)
Move the camera relative to its own axis.
Parameters:
x - The distance to move the camera along the x axis.
y - The distance to move the camera along the y axis.
z - The distance to move the camera along the z axis.

rotateWorld

public final void rotateWorld(double x,
                              double y,
                              double z)
Rotates the camera a given amount around the static world axis.
Parameters:
x - The number of degrees to rotate the camera around the x-axis.
y - The number of degrees to rotate the camera around the y-axis.
z - The number of degrees to rotate the camera around the z-axis.
See Also:
rotateWorld(double, double, double, double, double, double)

rotateWorld

public final void rotateWorld(double x,
                              double y,
                              double z,
                              double px,
                              double py,
                              double pz)
Rotates the camera a given amount around a specified point, around the static world axis.
Parameters:
x - The number of degrees to rotate the camera around the x-axis.
y - The number of degrees to rotate the camera around the y-axis.
z - The number of degrees to rotate the camera around the z-axis.
px - The x position of the point to rotate around.
py - The y position of the point to rotate around.
pz - The z position of the point to rotate around.
See Also:
rotateWorld(double, double, double)

rotateLocal

public final void rotateLocal(double x,
                              double y,
                              double z)
Rotates the camera a given amount around the camera's own axis.
Parameters:
x - The number of degrees to rotate the camera around the x-axis.
y - The number of degrees to rotate the camera around the y-axis.
z - The number of degrees to rotate the camera around the z-axis.
See Also:
rotateLocal(double, double, double, double, double, double)

rotateLocal

public final void rotateLocal(double x,
                              double y,
                              double z,
                              double px,
                              double py,
                              double pz)
Rotates the camera a given amount around a specified point, around the camera's own axis.
Parameters:
x - The number of degrees to rotate the camera around the x-axis.
y - The number of degrees to rotate the camera around the y-axis.
z - The number of degrees to rotate the camera around the z-axis.
px - The x position of the point to rotate around.
py - The y position of the point to rotate around.
pz - The z position of the point to rotate around.
See Also:
rotateLocal(double, double, double)

rotatePointAt

public final void rotatePointAt(double x,
                                double y,
                                double z)
Rotate the pointAt vector to point the camera somewhere.
Parameters:
x - The number of degrees to rotate the camera around the x-axis.
y - The number of degrees to rotate the camera around the y-axis.
z - The number of degrees to rotate the camera around the z-axis.

pointAt

public final void pointAt(Vertex v)
Point the camera somewhere.
Parameters:
v - A vertex to point the camera at.

pointAt

public final void pointAt(double x,
                          double y,
                          double z)
Point the camera somewhere.
Parameters:
x - The x co-ordinate of the point to look at.
y - The y co-ordinate of the point to look at.
z - The z co-ordinate of the point to look at.

pointAt

public final void pointAt(Object3d obj)
Point the camera at an object. In fact, the camera is pointed at the center of the object, as returned by Object3d.getCenter().
Parameters:
obj - A reference to an object.
See Also:
Object3d.getCenter()

©2001 SyGem Software