CSG: union

A union ties several entities together, in order to handle them as a single entity. Then, you can translate, rotate, scale or even change the material for the whole union with just one operation.

Unions have another important responsability: the ray tracing algorithm can take advantage of grouping to optimize intersections. For instance, shapes with infinite bounds, such as planes, are moved to the last position in a union. There are several special union classes which the scene optimizer can use as substitutes for unions.

Syntax

Please note that a union does not have an associated material definition: according to the intersection point, each part of the union use the material from the corresponding primitive shape. If you need to assign the same material to all shapes in a union, you should use the dress operation.

Unions don't eliminate internal surfaces. This is not a problem since we have not included yet support for transparency. In a future XSight version, a new CSG operation (Merge) should be added for this purpose.

Example

    set met(c) = metal(c, 0.03, 0.00, 0.7, 0.3, 5);

    set little_guy(x, z) = union(
        cylinder(x, -1.5, z, 1.5, 1, met(royalblue)),
        cone(x, 1.3, z, 1.5, 1, met(red)),
        sphere(x, 0.8, z,0.8, met(seashell)));

    little_guy( 0, 0.0);
    little_guy(-3, 5.0);
    little_guy(+3, 2.2);

See also

Home | Small Instantiation Language overview | CSG operations | Difference | Intersection | Cone | Cylinder | Sphere | Torus