POV-Ray : Newsgroups : povray.general : Grads to pov trig funcs - 57.3 where? Server Time
29 Nov 2024 19:58:41 EST (-0500)
  Grads to pov trig funcs - 57.3 where? (Message 1 to 3 of 3)  
From: Stefan Viljoen
Subject: Grads to pov trig funcs - 57.3 where?
Date: 19 May 2005 18:30:08
Message: <428d136f@news.povray.org>
Hi guys

Is the correct povray representation of the top two formulas at

http://mathworld.wolfram.com/Spirograph.html

#while (my_degrees < 360)

        #declare x_loc = (radius_fixed + radius_rotating) * cos(my_degrees / 57.3)
- 
        (radius_rotating + spiro_offset) * cos(((((radius_fixed + radius_rotating)
/       
        radius_rotating)) * my_degrees) / 57.3);                
        
        //#debug concat("X:" , str(x_loc,3,3) "\n")
        
        #declare y_loc = (radius_fixed + radius_rotating) * sin(my_degrees / 57.3)
- 
        (radius_rotating + spiro_offset) * sin(((((radius_fixed + radius_rotating)
/       
        radius_rotating)) * my_degrees) / 57.3);                
        
        //#debug concat("Y:" , str(y_loc,3,3) "\n")
        
        sphere
        {
                <x_loc,y_loc,0>,0.25
                material
                {
                        texture
                        {
                                pigment
                                {
                                        color Red
                                }
                        }
                }
        }
        
        #declare my_degrees = my_degrees + 0.5;
#end

as regards the conversion of degrees to radians in order to use Povray's sin
and cos functions (which work with radians?)

I must be doing something wrong - the shapes look "sincos - like" but not
like those on the spirograph page...

Any help appreciated!

-- 
Stefan Viljoen
Software Support Technician / Programmer
Polar Design Solutions


Post a reply to this message

From: Slime
Subject: Re: Grads to pov trig funcs - 57.3 where?
Date: 19 May 2005 18:51:25
Message: <428d186d$1@news.povray.org>
> as regards the conversion of degrees to radians in order to use Povray's
sin
> and cos functions (which work with radians?)

If you think that's the problem (I didn't render the scene), just use
POV-Ray's radians() function. If you'd rather not use that, you could use
degrees * pi/180. Though, 57.3 is fairly close, I think it will start to
look wrong after a large number of rotations.

 - Slime
 [ http://www.slimeland.com/ ]


Post a reply to this message

From: Mike Williams
Subject: Re: Grads to pov trig funcs - 57.3 where?
Date: 19 May 2005 20:22:17
Message: <2VW+6EAo2SjCFwNT@econym.demon.co.uk>
Wasn't it Stefan Viljoen who wrote:
>Hi guys
>
>Is the correct povray representation of the top two formulas at
>
>http://mathworld.wolfram.com/Spirograph.html
>
>
>as regards the conversion of degrees to radians in order to use Povray's sin
>and cos functions (which work with radians?)
>
>I must be doing something wrong - the shapes look "sincos - like" but not
>like those on the spirograph page...
>
>Any help appreciated!

The conversion factor (180/pi) is close enough to 57.3 for this purpose.

The only things you need to be aware of are:-

1. The results shown on that page are generated from the second pair of
equations. To get similar results from the first pair, "radius_rotating"
needs to be set to a negative value, and I'm not sure how to convert "a"
into "spiro_offset"

2. When "radius_rotating" and "radius_fixed" have no common divisors
(which is how you'd usually run things) you'll need to go round the
circle more than once.

Try these values for an example that looks like the Mathworld result for
(2,5) with a=1.0.

#declare my_degrees=0;
#declare radius_fixed = 5;
#declare radius_rotating = -2;
#declare spiro_offset = 7;

#while (my_degrees < 360*abs(radius_rotating))



-- 
Mike Williams
Gentleman of Leisure


Post a reply to this message

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