Class Scene3D
Object
|
+--Scene3D
- class
Scene3D
Scene3D defines a new 3D scene (shocking, I know). A 3D Scene has two main components:
objects (to be displayed), and a camera (from which to view the objects). In this model of a 3D
scene, the camera is the main mover, not the objects (though they can be moved). A view plane is
defined through the origin with a normal in the direction from the origin to the camera; the
objects are projected onto this view plane, which is then matched up with the 2D plane of the
screen.
Defined in Scene3D.js
Field Summary |
point3D |
camera
The "camera" is the point from which the objects are being viewed. |
Number |
focus
The focus is the distance between the camera and the origin (in world coordinates) |
Array |
objects
The objects to be viewed/displayed. |
Plane |
plane
The view plane, onto which the objects are projected. |
Constructor Summary |
Scene3D(<Array> objs, <point3D> camera)
The constructor function for a new Scene3D object.
|
camera
point3D camera
The "camera" is the point from which the objects are being viewed.
focus
Number focus
The focus is the distance between the camera and the origin (in world coordinates)
objects
Array objects
The objects to be viewed/displayed. An array of Object3D objects.
plane
Plane plane
The view plane, onto which the objects are projected.
Scene3D
Scene3D(<Array> objs, <point3D> camera)
The constructor function for a new Scene3D object.
Parameters:
objs
- an Array of Object3D objects to be displayed
camera
- the position of the camera (as a point3D object); used to generate initial focus and view plane
addObject
Scene3D addObject(<Object3D> obj)
Add an object to the 3D Scene.
Parameters:
obj
- the object to be added to the 3D Scene
Returns:
this Scene3D, with the object added (returns null if obj is not an Object3D)
draw
void draw()
project
void project()
rotateCamera
Scene3D rotateCamera(<Number> theta, <Number> phi)
Moves the camera to a new position. Parameters are two angles, one in the XY-plane
from the positive x-axis and the other from the positive z-axis.
Parameters:
theta
- the degree (in radians) to rotate the camera from the positive x-axis
phi
- the degree (in radians) to rotate the camera from the positive z-axis
Returns:
this Scene3D object, with updated camera and view plane
setFocus
Scene3D setFocus(<Number> dist)
Sets the focus (distance between Origin and camera).
Parameters:
dist
- the new focal distance
Returns:
this Scene3D object, with updated focus distance and matching camera position
Documentation generated by
JSDoc on Tue Aug 5 10:22:22 2008