Previous:Polygon Object Main Index Next:Teaching An Old Spline New Tricks

### Prism Object

The prism is essentially a polygon or closed curve which is swept along a linear path. We can imagine the shape so swept leaving a trail in space, and the surface of that trail is the surface of our prism. The curve or polygon making up a prism's face can be a composite of any number of sub-shapes, can use any kind of three different splines, and can either keep a constant width as it is swept, or slowly tapering off to a fine point on one end. But before this gets too confusing, let's start one step at a time with the simplest form of prism. We enter and render the following POV code (see file `prismdm1.pov`).

      #include "colors.inc"

      background{White}

      camera {

        angle 20

        location <2, 10, -30>

        look_at <0, 1, 0>

      }

      light_source { <20, 20, -20> color White }

      prism {

        linear_sweep

        linear_spline

        0, // sweep the following shape from here ...

        1, // ... up through here

        7, // the number of points making up the shape ...

        <3,5>, <-3,5>, <-5,0>, <-3,-5>, <3, -5>, <5,0>, <3,5>

        pigment { Green }

      }

A hexagonal prism shape.

This produces a hexagonal polygon, which is then swept from y=0 through y=1. In other words, we now have an extruded hexagon. One point to note is that although this is a six sided figure, we have used a total of seven points. That is because the polygon is supposed to be a closed shape, which we do here by making the final point the same as the first. Technically, with linear polygons, if we didn't do this, POV-Ray would automatically join the two ends with a line to force it to close, although a warning would be issued. However, this only works with linear splines, so we mustn't get too casual about those warning messages!

Previous:Polygon Object Main Index Next:Teaching An Old Spline New Tricks