POV-Ray : Newsgroups : povray.newusers : Newbie syntax problem : Re: Newbie syntax problem Server Time
4 Sep 2024 22:19:13 EDT (-0400)
  Re: Newbie syntax problem  
From: Christopher James Huff
Date: 11 Nov 2002 18:54:17
Message: <chrishuff-AB4C9B.18534211112002@netplex.aussie.org>
In article <3DD0220B.1B5F76C3@att.net>, LibraryMan <mrm### [at] attnet> 
wrote:

> POV choked on it!  AARRGGGH!  It's SO simple!  Why isn't it possible?!

It is possible, POV just choked because you gave it bad information. It 
is expecting a 2D vector in this case, you gave it a 3D vector. I'm not 
really sure what it would do in this case, either chop off the third 
component or give an error. Either way, it would not work...the third 
component is one you need. If you replace each "v_XX" with "< v_XX.x, 
v_XX.z>" it should work fine. If POV truncates 3D vectors to 2D ones, 
you just need to use coordinates in the xy plane and rotate around the z 
axis. I know that seems counterintuitive when the prism is in the xz 
plane.

Here are a couple macros that might be useful:

This macro truncates a vector to 2D, only useful if POV doesn't do it 
automatically:
#macro V2D(V) (<V.x, V.y>) #end
You would need to rearrange your vectors to be in the xy plane to use 
this macro. Or use this version:
#macro V_XZ(V) (<V.x, V.z>) #end

Another one, takes a 2D vector and angle to rotate it around the z axis:
#macro VRotate2D(V, A)
    #local Tmp = vrotate(V, z*A);
    (< Tmp.x, Tmp.y>)
#end

And if you are trying to get a perfect dodecagon, you are doing it the 
hard way...you could just use a loop:

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

object {RegularPrism(12)
    pigment {color Green}
}

-- 
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.