POV-Ray : Newsgroups : povray.newusers : Newbie syntax problem : Re: Newbie syntax problem Server Time
4 Sep 2024 22:19:27 EDT (-0400)
  Re: Newbie syntax problem  
From: Christopher James Huff
Date: 11 Nov 2002 22:38:24
Message: <chrishuff-1485BA.22374811112002@netplex.aussie.org>
In article <3dd05985@news.povray.org>,
 "hughes, b." <omn### [at] charternet> wrote:

> No dodecahedron (yet), so I leave that up to you to try and figure out.

There's one in the include files.


> Especially since I'm not sure what I'm doing with it. Chris's loop idea
> sounds simpler but I couldn't get it to make one by rotating just the x
> value, not with the loop he suggested though.

The main problem was not with the loop, but with the prism statement, I 
didn't give a complete one. My excuse? I've never used the object 
before... ;-)
There was also a typo that would have made it work only with 12 sides, 
but that doesn't seem to be what you ran into.
I'm not sure what you mean by "rotating just the x value", unless you 
mean x as in < 1, 0, 0>.
This seems to work fine, with shorter code, and supporting any number of 
sides.

global_settings {assumed_gamma 1}

#declare CamPos = <-3, 2.5,-8>;
camera {
    location CamPos
    look_at < 0, 0, 0>
    angle 45
}

light_source {<-50,-50,-50>, color rgb 1}
light_source {CamPos, color rgb 0.05}

#macro VRotate2D(V, A)
    #local Tmp = vrotate(V, z*A);
    (< Tmp.x, Tmp.y>)
#end

#macro RegularPrism(Height1, Height2, Sides)
    prism {linear_sweep linear_spline
        Height1, Height2, Sides
        #local J = 0;
        #while(J < Sides)
            VRotate2D(x, 360*J/Sides)
            #local J = J + 1;
        #end
    }
#end

object {RegularPrism(0, 1, 12)
    pigment {color rgb 1}
    finish {ambient 0}
    rotate -x*45
}

-- 
Christopher James Huff <cja### [at] earthlinknet>
http://home.earthlink.net/~cjameshuff/
POV-Ray TAG: chr### [at] tagpovrayorg
http://tag.povray.org/


Post a reply to this message

Copyright 2003-2023 Persistence of Vision Raytracer Pty. Ltd.