8.5 Reflection

In addition to the translation, scale and rotation operations, Khepri also implements the reflection operation, by providing the function mirror. This function receives, as arguments, the object to reflect, and a reflection plane described by a point contained in the plane and a normal vector to the plane. By omission, the reflection plane is the \(XY\) plane.

As an example, let us consider the hourglass shown in this figure that has as parameters the base center point, the base radius, the neck radius, and the height.

An hourglass.

image

It is not difficult to conceive this shape as the union of two cone frustums:

hourglass(p, rb, rn, h) =

  union(cone_frustum(p, rb, p+vz(h/2), rn),

        cone_frustum(p+vz(h/2), rn, p+vz(h), rb))

However, it is possible to simplify the previous definition by using the mirror operation:

hourglass(p, rb, rn, h) = mirror(cone_frustum(p, rb, p+vz(h/2), rn), p+vz(h/2))

In the following section, we will see an example where these operations are applied in the modeling of one of the most famous buildings in the world.