Project 9

Instancing

Creative Image:

(Image scaled down. Click on images for fullsize view.)

A Dyson sphere (more technically, a Dyson swarm). The solar collectors are thin boxes that have been instanced from a single box that has been translated out to Point(1,0,0). The sun is simply a phong shaded sphere with a small phong exponent, with a light source near its surface.

Design choices:
I implemented a new abstract base class Instance and three implementing classes: TInstance, RInstance, and GInstance. The T- and R- varieties handle pure translation and rotation. The translation is specified by a Vector object, while rotation is set by supplying two parameters theta and phi. Theta controls rotation about the z-axis while phi rotates about the x-axis. The G- variety is a general matrix transform instance. The matrix and a translation vector can be supplied. This object can be used to scale, stretch, or near-annihilate another object. Responsibility for supplying well conditioned matrices is shunted onto the user.

The instances can also be combined. This is how I created the solar panels. A box sitting at the origin was instanced to a translated box at Point(1,0,0), and then the rotation instances simply take this translated box and swing it about the origin.