SILLY supports numeric, vector and shape expressions, and they are always evaluated at compile time, when the scene tree is constructed.
The typical set of symbolic operators acting on numeric, vector and shape operands, is supported.
Operator + implements the sum of numbers and vectors, and can be used as an alternative syntax for shape union.
Operation | Yields | Meaning |
number + number | number | Numeric addition. |
vector + vector | vector | Vector sum. |
shape + shape | shape | Shape union. |
Operation | Yields | Meaning |
number - number | number | Numeric substraction. |
vector - vector | vector | Vector substraction. |
shape - shape | shape | Shape difference. |
Operation | Yields | Meaning |
number * number | number | Numeric multiplication. |
vector * vector | number | Vector inner product. |
number * vector | vector | Vector scalar product. |
vector * number | vector | Vector scalar product. |
shape * shape | shape | Shape intersection. |
Operation | Yields | Meaning |
number / number | number | Numeric division. |
vector / number | vector | Vector scalar division. |
Function | Meaning |
Abs | Absolute value |
Cos | Cosine |
Sin | Sine |
Tan | Tangent |
Sqrt | Squared root |
A very important feature of ray tracers is the ability to apply Euclidean transformations to basic and complex shapes. This transformations are implemented by the XSight RT Engine as special shape classes. For instance, if you want to rotate a red box around the Y axis, you could use one of the constructors from the Rotate class:
rotate(0, 45, 0, box([1-,-1,-1], [+1,+1,+1], plastic(red)))
As you can see, the shape to be rotated is passed as a parameter. However, this notation is not the most convenient one. Nesting constructor calls add more parenthesis and complexity to a scene. For this reason, we have designed three special operators corresponding to the three basic Euclidian transformations:
Operator | Equivalent class |
move | Translate |
spin | Rotate |
size | Scale |
These are binary operators, that accepts a shape as their first operand and a vector in their second operand. The size operator also allows a numeric value in its second operand, for an isotropic scale change. The rotated red box example can now be written this way:
box([1-,-1,-1], [+1,+1,+1], plastic(red)) spin 45^Y
Another advantage of the transformation operators has to do with cascading transformations:
translate(10, 0, 0, rotate(0, 45, 0, box([1-,-1,-1], [+1,+1,+1], plastic(red)))
The above expression must be read as "translate ten units a rotated by 45 degrees box", which is unnatural. Compare now with the alternative:
box([1-,-1,-1], [+1,+1,+1], plastic(red)) spin 45^Y move 10^X
Now you can read: "take a red box, rotate 45 degrees around the Y axis, and then move it 10 units to the right".
Home | XSight Ray Tracer overview | Small Instantiation Language | Using XSight's Ray Editor | Basic syntax | Data types | Animation support | Macros | Scenes