|
MathWorx | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
Object | +--Object3D
Object3D is a class that defines 3D objects to displayed by Scene3D objects.
A 3D object as defined is a face-vertex mesh. A face is an ordered list of
vertex indices in the vertex array which are to be connected by lines. This model allows lines
as well as surfaces and solids to all be Object3D objects.
Defined in Object3D.js
Requires:
Field Summary | |
Array |
faces
The array of faces. |
Array |
vertices
The list of vertices of the 3D object. |
Array |
vertices2D
The list of vertices after being projected onto a plane. |
Constructor Summary | |
Object3D(<Array> vertices, <Array> faces)
Creates a new 3D Object. |
Method Summary | |
Object3D
|
addFace(<Array> vertices)
Adds a face to the 3D Object. |
void
|
draw(<Object> svg, <Object> settings)
Draws the given object. |
Object3D
|
to2D(<Number> focus)
After object has been moved to Scene coordinates (via viewIn method), this performs a perspective transformation to put the object in the XY plane. |
Object3D
|
toEach(<Function> func)
Perform a function on each vertex of an object. |
String
|
toString()
Generates a string representation of the Object (a face-vertex mesh). |
Object3D
|
translate(<Number> tx, <Number> ty, <Number> tz)
Translate an object by tx, ty, and tz. |
Object3D
|
viewIn(<Object> camera)
Moves 3D object into new coordinates defined by 3D scene's camera. |
<static> Object3D
|
Cube(<Number> side, <point3D> center)
Creates a new Cube as an Object3D object. |
<static> Object3D
|
Line(<Array> points)
Creates a new line as an Object3D |
<static> Object3D
|
Sphere(<Number> rad, <point3D> cent, <Number> segments)
Creates a new Sphere as an Object3D object. |
<static> Object3D
|
Xaxis(<Number> min, <Number> max)
Creates a new 3D Object that is the x-axis. |
<static> Object3D
|
Yaxis(<Number> min, <Number> max)
Creates a new 3D Object that is the y-axis. |
<static> Object3D
|
Zaxis(<Number> min, <Number> max)
Creates a new 3D Object that is the z-axis. |
Field Detail |
Array faces
Array vertices
Array vertices2D
Constructor Detail |
Object3D(<Array> vertices, <Array> faces)
vertices
- an array of point3D objects that are the vertices of the object
faces
- (Optional) the array (2-dimensional!) of faces (i.e. [[0,1,2],[2,3,4]] defines two faces connecting vertices[0],vertices[1] and vertices[2], etc.)
Method Detail |
Object3D addFace(<Array> vertices)
vertices
- the orderered list of vertex indices that should be connected to form a face
void draw(<Object> svg, <Object> settings)
svg
- the jQuery SVG object
settings
- the settings to apply to each line of the wireframe; settings.transform = 'scale(1,-1)' automatically applied
Object3D to2D(<Number> focus)
focus
- the focal distance (between camera and origin)
Object3D toEach(<Function> func)
func
- the function to perform on each vertex
String toString()
Object3D translate(<Number> tx, <Number> ty, <Number> tz)
tx
- the x translation
ty
- the y translation
tz
- the z translation
Object3D viewIn(<Object> camera)
camera
- the 3D Scene camera object through which to view this object; MUST have properties theta and phi
<static> Object3D Cube(<Number> side, <point3D> center)
side
- the length of each side of the cube.
center
- (optional) the center point of the cube, default is (0,0,0)
<static> Object3D Line(<Array> points)
points
- an Array of point2D or point3D objects that define the line sequentially
<static> Object3D Sphere(<Number> rad, <point3D> cent, <Number> segments)
rad
- the radius of the sphere
cent
- (optional) the center of the sphere; defaults to (0,0,0)
segments
- (optional) the number of segments to divide the sphere into; directly relates to the number of vertices/faces
<static> Object3D Xaxis(<Number> min, <Number> max)
min
- the minimum x value
max
- the maximum x value
<static> Object3D Yaxis(<Number> min, <Number> max)
min
- the minimum y value
max
- the maximum y value
<static> Object3D Zaxis(<Number> min, <Number> max)
min
- the minimum z value
max
- the maximum z value
|
MathWorx | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |