POV-Ray : Newsgroups : povray.newusers : Trig problem : Re: Trig problem Server Time
4 Nov 2024 21:22:50 EST (-0500)
  Re: Trig problem  
From: Mike Williams
Date: 16 Mar 2003 16:21:13
Message: <GweJACAPqOd+EwLB@econym.demon.co.uk>
Wasn't it Will W who wrote:
>I didn't notice anything about this in the FAQs I've seen, and it might not
>be a POV problem.
>
>The rotate command isn't working the way I expect on my system. Here is a
>simple test that fails for me:
>
>// --   begin code --
>light_source { <0,0,-10> rgb 1 parallel }
>plane { -z, -1 pigment { checker rgb 1, rgb 0.8 } }
>camera { location <5, 2.5, -5>  look_at  <2.5, 2.5, 1>  angle 67 }
>
>// baseline of points:
>// up 2 units for each unit over:
>// 60 degree slope (verify by shadow)
>union {
>   #declare I = 0;
>   #while (I < 6)
>      sphere { <0,0,0>, 0.1 pigment { rgb <1,0,0> } translate <0.5*I, I,
>0> }
>      #declare I = I+1;
>   #end
>}
>
>// This should intersect each point
>cylinder {<0,0,0>, <5,0,0>, 0.075 pigment { rgb <0,0,1> } rotate 60*z }
>//--  end code --
>
>Instead of the cylinder intersecting each point as I would expect, it
>appears to have rotated only about 58 degrees. (The parallel light shadows
>on the checker background demonstrate that the points are being placed
>correctly). This is on a Dell 4400 using a Pentium 4 at 1.6 GHz, with 256 Mb
>ram.
>
>So are Intel's FP trig routines messed up that badly? My googling shows some
>concerns with 15th digit accuracy with Intel's basic sin and cos, but what
>I'm seeing looks like at least ten orders of magnitude worse than that.
>
>Is POV somehow at fault? If so, what work-arounds are there?
>
>Is there (yet another) gaping hole in what I remember from my long ago trig
>courses?

POV is correct, it's your trig that's wrong. The angle that goes up 2
for each 1 across is atan(2)=63.4349 degrees. A 60 degree angle goes 2
along the *diagonal* for each 1 across, which is slightly different.

-- 
Mike Williams
Gentleman of Leisure


Post a reply to this message

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