323 design
 
specifications
 
Objects
Manipulating and traversing the tree
 
object child(object o) returns the first child of o, or NULL if o has no children.
object parent(object o) returns the parent of o, or NULL if o has no parent.
object next(object o) returns the next sibling of o, or NULL if o is the last element in the list.
object previous(object o) returns the previous sibling of o, or NULL if o is the first element in the list.
objecttype type(object o) returns the type of object o, i.e. POLY, CAMERA, COLLECTION, etc.
object insert(object p, object c) Inserts c as the child of p, and returns p if successful.  Returns NULL on failure.
object detach(object c) Detaches c from its parent, and returns c if sucessful.  Returns NULL on failure.
 
Creating new objects
poly new_poly() Returns a new poly.
frame new_frame() Returns a new frame.
curve new_curve() Returns a new curve.
light new_light() Returns a new light.
camera new_camera() Returns a new camera.
vertex new_vertex(vector v) Returns a new vertex located at position v.
rendering new_rendering() Returns a new rendering.
collection new_collection() Returns a new collection.
object copy(object o) Returns a copy of object o.
 
Writing to a file
write_pov(object o) Write a POV-RAY file for the object o.  Output is sent to stdout.
write_mi(object o) Write a Mental Ray (mi) file for the object o.  Output is sent to stdout.
write_english(object o) Write the object o, and all the objects beneath it, in human readable form to stdout.
 
Primitive shapes
poly cube(float s) Returns a cube with side length s, centered around the origin.
poly sphere(float s, int u, int v) Returns a sphere of radius s, with u lines of latitude and v lines of longitude, centered around the origin.
curve polygon(float s, int c) Returns a regular polygon with c sides and "radius" s.  (i.e. for c=4, a square, for c=6 a hexagon, etc.)
 
Transformation and distortions
translate(object o, vector v) Move object o by vector v.
rotate(object o, vector v) Rotate object o about the origin, around the x axis by v.x, around the y axis by v.y, and then around the z axis, by v.z. All angles measured in radians.
scale(object o, vector v) Scale the coordinates of object o by vector v.
reshape(object o, function f, parameter p) Function f is used to reshape object o in an arbitrary way. Each vector (vertexes, camera positions, etc.) in o is passed to f, which then returns a new value for it. Parameter p is also passed to f in the following way: 
newvector=f(oldvector, p)
 
Building complex shapes
poly extrude(curve c1, curve c2) Create an extrution of c1 along the path of c2.
poly lathe(curve c, float a1, float a2, int u) Rotate the curve c around the z axis to cut a 3D shape from angle a1 though angle a2. Divide the rotated surface into u steps. (Angles measured in radians, a1 < a2.)
poly parametric( function f, parameter p, int u, int v) Create a surface of the parametric function f. f is called like this 
newpoint=f(u1, v1, p) 
where f returns a vector, u1 and v1 are floating point numbers between 0 and 1. The returned surface will be divided into u steps in one direction and v steps in the other.
collection curve3d(curve c, float s) Returns a collection of objects that "draw" the curve c. Vertices of c are represented by little spheres, segments of c are represented by thin cynliders. s is a scaling factor that controls the radius of the spheres and cylinders.
 
Math
vector add_vector(vector v1, vector v2) return the addition of v1 and v2.
vector mul_vector(float s, vector v) return the multiplication of s by v.
 
Miscellany
vector make_vector( float x, float y, float z) Returns a vector with coordinates x, y, and z. Used as a convienience to replace:
v.x = a; 
v.y = b; 
v.z = c; 
with the more simple form:
v = makevector(x,y,z);
color make_color(float r, float g, float b) See make_vector above.
 

© copyright 323 design. all rights reserved.
last modified: