Previous: Point and vector literals, Up: Literals



3.1.3.3 Transform literals

Most transform literals are formed by constructors. These are summarized in the following table.

Constructor Param types Description
rotate(A,P,X) scalar,point,vector Rotate A degrees about point P with axis X according to the right hand rule. See Right hand rule. P and X are both optional and default to the origin and the z-axis respectively.
translate(X) vector Translate by X.
scale(S) scalar Scale uniformly by factor S.
scale(V) vector Scale along each axis by components of V.
project() Same as scale([1,1,0]).
project(S) scalar Perspective projection with view center at origin and projection plane z=-S.
perspective(S) scalar Perspective transform identical to project(S) except that the z-coordinate of the transformed result is pseudodepth, usable by the hidden surface algorithm.
view(E,D,U) point,vector,vector View transform similar to that of OpenGL's. The eye point E is translated to the origin while a rotation is also applied that makes the view direction vector D and the view “up” vector U point in the negative z- and the y-directions respectively. If U is omitted, it defaults to [0,1,0]. When U is omitted, D may be also; it defaults to (0,0,0)-(E), a vector pointing from the eye toward the origin.
view(E,L,U) point,point,vector An alternate form of view(E,D,U) above where the view direction parameter D is replaced with a “look at” point L, i.e., a point where the viewer is focusing her attention. This form of view is equivalent to view(E, (L)-(E), U), where (L)-(E) is a direction vector. U is optional and defaults to [0,1,0].
[[a_11,a_12,a_13,a_14]
 [a_21,a_22,a_23,a_24]
 [a_31,a_32,a_33,a_34]
 [a_41,a_42,a_43,a_44]]
16 scalars Direct transform matrix definition. Each of the a_ij is a scalar expression. If you don't know what this is about, you don't need it.
The project constructor is not generally useful because it defeats hidden surface removal by collapsing the scene onto a single plane. It is a special purpose transform for drawing pictures of scenes where three-dimensional objects are being projected onto planes. See, for example, Overview.