|
![](/i/fill.gif) |
Brendan Ryan <ary### [at] global2000 net> wrote:
> I am trying to create a macro for making regular polygons and prisms. I
> can't get one point to rotate to the vertexes.
...
> I need 2d vectors for polygons but vrotate changes them into 3d vectors.
POV-Ray shouldn't have a problem with 3D vectors in the prism definition (or
lathes, or sor's), as long as they lie in the correct plane (ie. XZ for the
prism, XY for the other two). Here's an answer I posted back in July '97
when this question was asked on comp.graphics.rendering.raytracing:
#declare NumberofSides = 5;
#declare BasePrism = prism {0, 1, NumberofSides + 1
#declare Rot = 0; #while (Rot < 360)
vrotate (x, z * Rot),
#declare Rot = Rot + 360 / NumberofSides; #end
x}
By changing the NumberofSides, you can create any sided figure,
automatically centred around the origin. You can then use this object
to create other objects, eg:
difference {
object {BasePrism scale <2, 4, 2>}
object {BasePrism scale <1.5, 2, 1.5> translate <0, 3, 0>}
pigment {rgb 1}}
In the above example we have scaled the first prism by 2 in width, and
the second by 1.5; you can change the thickness of the sides by
adjusting the numbers, eg: 2 and 1.9 for thinner sides, 2 and 1.1 for
thicker sides.
Post a reply to this message
|
![](/i/fill.gif) |