|
MathWorx | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
Object | +--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.
Most methods return this, so calls can be made sequentially.
Defined in Scene3D.js
Requires:
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. |
Method Summary | |
Scene3D
|
addObject(<Object3D> obj)
Add an object to the 3D Scene. |
void
|
draw(<Array> objs, <Object> svg, <Object> settings)
Draws the 3D scene, with the specified objects. |
Scene3D
|
emptySVG(<Object> svg)
Empties the SVG canvas supplied. |
Scene3D
|
rotateCamera(<Number> theta, <Number> phi)
Moves the camera to a new position. |
Scene3D
|
setFocus(<Number> dist)
Sets the focus (distance between Origin and camera). |
String
|
toString()
Returns a string representation of the Scene (camera and objects). |
Field Detail |
point3D camera
Number focus
Array objects
Plane plane
Constructor Detail |
Scene3D(<Array> objs, <point3D> camera)
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; also used to define this.camera = {loc: point3D, theta: angle, phi: angle}
Method Detail |
Scene3D addObject(<Object3D> obj)
obj
- the object to be added to the 3D Scene
void draw(<Array> objs, <Object> svg, <Object> settings)
objs
- an array of object indices to be displayed.
svg
- the jQuery SVG object in which to draw the scene
settings
- the settings to give to each line of the objects; can be an Array of settings, where each index of the array corresponds to the index of the objects passed to this function
Scene3D emptySVG(<Object> svg)
svg
- the jQuery SVG root canvas
Scene3D rotateCamera(<Number> theta, <Number> phi)
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
Scene3D setFocus(<Number> dist)
dist
- the new focal distance
String toString()
|
MathWorx | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |