This section shows you the code and resulting image for a satellite. The satellite uses many of the features that have been described this far. Figure 11 is a picture of the satellite.
// The lighting is set just as in the newmirage project. vector focus_position = {0, 0, 0}; vector camera_position = {20, 14, 8}; the_object = the_satellite(); LINK(the_scene, PLUS, the_object); . . . object the_satellite(void) { object body, dish, solar, arm, cutter, spike, extra_bit; object S; body = stretch(1.0, 1.0, 0.5, shift(0.0, 0.0, 1.0, new_cube())); extra_bit = stretch(0.75, 0.57, 1.75, shift(0.0, 0.0, -1.0, new_unitcyl())); LINK(body, PLUS, bind(extra_bit)); extra_bit = shift(0.0, 0.0, -0.75,stretch(1.25, 0.25, 0.5, new_cube())); LINK(body, PLUS, bind(extra_bit)); LINK(body, PLUS, rotate(X, Y, 60, bind(extra_bit))) LINK(body, PLUS, rotate(X, Y, 120, bind(extra_bit))); body = bind(body); body->material = grey; extra_bit = stretch(1.0, 1.0, 1.5, shift(0.0, 0.0, -1.0, new_unitcyl())); extra_bit->material = ltgrey; LINK(body, PLUS, bind(extra_bit)); body = bind(body); dish = shift(0.0, 0.0, 1.0, new_sphere()); dish->material = dkgrey; cutter = shift(0.0, 0.0, 1.2, new_sphere()); cutter->material = ltgrey; LINK(dish, PAINTMINUS, bind(cutter)); cutter = rotate(X, Z, 90, new_torus(1.0, 0.02)); cutter = shift(0.0, 0.0, 1.22, bind(cutter)); LINK(cutter, PLUS, shift(0.0, 0.0, -0.2, bind(cutter))); LINK(dish, MINUS, bind(cutter)); cutter = rotate(X, Y, 30, bind(cutter)); LINK(dish, MINUS, bind(cutter)); cutter = rotate(X, Y, 30, bind(cutter)); LINK(dish, MINUS, bind(cutter)); cutter = rotate(X, Y, 30, bind(cutter)); LINK(dish, MINUS, bind(cutter)); cutter = rotate(X, Y, 30, bind(cutter)); LINK(dish, MINUS, bind(cutter)); cutter = rotate(X, Y, 30, bind(cutter)); LINK(dish, MINUS, bind(cutter)); cutter = rotate(X, Y, 30, bind(cutter)); LINK(dish, MINUS, bind(cutter)); dish = stretch(3.0, 3.0, 1.0, bind(dish)); spike = new_cone(0.1, 0.0, 5.0); spike->material = grey; LINK(dish, PLUS, bind(spike)); dish = shift(0.0, 0.0, 1.0, bind(dish)); dish = bind(dish); solar = bind(shift(0.25, 0.0, 0.25, rotate(Y, Z, 15, stretch(0.5, 5.0, 0.025, shift(0.0, 1.0, 1.0, new_cube()))))); solar->material = dkgrey; arm = stretch(0.1, 0.1, 7.0, new_unitcyl()); extra_bit = shift(0.0, 0.0, 7.0, scale(0.2, new_cube())); LINK(arm, PLUS, bind(extra_bit)); extra_bit = rotate(X, Y, 45, bind(extra_bit)); LINK(arm, PLUS, bind(extra_bit)); arm = bind(rotate(X, Y, 30, rotate(Z, X, 120, bind(arm)))); arm->material = dkgrey; S = new_nothing(); LINK(S, PLUS, bind(body)); LINK(S, PLUS, bind(dish)); LINK(S, PLUS, bind(solar)); LINK(S, PLUS, rotate(X, Y, 180, bind(solar))); LINK(S, PLUS, bind(arm)); return bind(S); }