Shapes: box

Second to spheres, boxes are the second faster primitive shape in a typical ray tracer. The intersection routine for a ray and a sphere involves taking a square root. Intersection with boxes do not require any non algebraic operations, but they have a lot of jumps, and jumps in code are expensive.


When specifying a box shape, you must provide a pair of points of one diagonal:

In this variant, there's no need to group coordinates between brackets:

Primitive boxes are always aligned to the axis. If you need another orientation, you must use the rotate primitive with the box. You can also apply a scale operation to the rotated box. Note, however, it doesn't make sense to scale a non-rotated box, since the same effect could be achieved with the box primitive.

See also

Home | Small Instantiation Language overview | Scenes | Solid shapes | Cone | Cylinder | Sphere | Torus | Blob | Polyhedra | Transforms | CSG operations