Now that we have the basic shapes, we need to combine them to create full scenes.
To do so, two basic shapes can be combined with an operation. Two operations can be again combined with an operation etc. This way, a tree builds up representing the final scene.
In this chapter, we just care about the operations and cover union, intersection, difference, negation and scale. They are shown in figure 1, except the scale.
The frayed edges of the difference shows that this implementation of dual marching cubes doesn’t preserve sharp edges.
Wang and Kaufman show the operations union, intersection, difference and negation on the density values in those formulas [WK94, S. 4 – 5]:
It doesn’t seem logical, that the difference is calculated by and the negation via because the resulting density value is changed by 1. That’s why those formulas are changed to this:
Beside the density value, the new gradient has to be calculated in a CSG operation. It is the one of the choosen density function by applying or . For example if has the greater density value in the union , its gradient is choosen. For the difference with being the smaller value, the gradient of multiplied by -1 is taken.
The last operator is another unary one (taking only one input, beside the union for example taking two inputs), the scaling. It scales its input (whether its a basic shape or a whole CSG tree) by a numerical factor . First we have to bring the coordinate into the space of the original density function of the input via a division by . The resulting value is multiplied by :