Previous:Built-in Vector Identifiers Main Index Next:Specifying Colors

POV-Ray defines a variety of built-in functions for manipulating floats, vectors and strings. Function calls consist of a keyword which specifies the name of the function followed by a parameter list enclosed in parentheses. Parameters are separated by commas. For example:

keyword(param1,param2)

The following are the functions which return vector values. They take one or more float, integer, vector, or string parameters. Assume that

and **A**

are any valid expression that evaluates to a vector; and **B**

is any float expression.**F**

Rotate **vaxis_rotate(A,B,F)**

about **A**

by **B**

. Given the x,y,z coordinates of a point in space designated by the vector **F**

, rotate that point about an arbitrary axis defined by the vector **A**

. Rotate it through an angle specified in degrees by the float value **B**

. The result is a vector containing the new x,y,z coordinates of the point.**F**

Cross product of **vcross(A,B) **

and **A**

. Returns a vector that is the vector cross product of the two vectors. The resulting vector is perpendicular to the two original vectors and its length is proportional to the angle between them. See the animated demo scene **B**`VECT2.POV`

for an illustration.

Normalize vector **vnormalize(A) **

. Returns a unit length vector that is the same direction as **A**

. Formula is **A***vnormalize=A/vlength(A)*.

Rotate **vrotate(A,B) **

about origin by **A**

. Given the x,y,z coordinates of a point in space designated by the vector **B**

, rotate that point about the origin by an amount specified by the vector **A**

. Rotate it about the x-axis by an angle specified in degrees by the float value **B**

. Similarly **B.x**

and **B.y**

specify the amount to rotate in degrees about the y-axis and z-axis. The result is a vector containing the new x,y,z coordinates of the point.**B.z**

See section "Float Functions" for other functions which are somewhat vector-related but which return floats. In addition to the above built-in functions, you may also define your own functions using the new

directive. See the section "User Defined Macros" for more details.**#macro**

Previous:Built-in Vector Identifiers Main Index Next:Specifying Colors