POV-Ray : Newsgroups : povray.binaries.scene-files : Stupid math problem, HELP!!!!! : Re: Stupid math problem, HELP!!!!! Server Time
29 Apr 2024 07:44:10 EDT (-0400)
  Re: Stupid math problem, HELP!!!!!  
From: Ken
Date: 10 Feb 1999 00:00:15
Message: <36C1120F.769CF0C0@pacbell.net>
Peter Popov wrote:
> 
> On Tue, 09 Feb 1999 18:58:11 -0800, Mark Palmquist
> <mpa### [at] earthlinknet> wrote:
> 
> >Trying to use POV to generate columns with x number grooves, forget my
> >math (to many years ago.....).  this is the code I used but not working,
> >
> >can someone enlighten me please.  I know it has something to do with the
> >
> >sin/cos stuff but can't figure it out with the remaining 3 brain cells
> >in my skull.
> >
> <code>
> 
> As I see it, you are using degrees instead of radians. POV's trig
> funcitons take radians as parameters.  I think this should work.
> 
> // ----------------------------------------
> #declare grooves = 36
> #declare vector = 2*pi/grooves
> #declare Angle=0;
> #declare groove_radius=0.1
> #declare groove_center=1.05
> 
> difference
> {
>   cylinder{  <0,0,0>,  <0,3,0>,  1  pigment {Red}  }
> 
>   #while (Angle < 2*pi )
>     cylinder
>     {
>       <groove_ center*cos(Angle),-1, groove_center* sin(Angle))>,
>       <groove_ center*cos(Angle),4, groove_center* sin(Angle))>,
>       groove_radius
>       pigment {Blue}
>     }
> 
>     #declare Angle=Angle+vector;
>   #end
> }
> 
> //-----------------
> 
> Should work except for a typo or two (or three). Didn't test it
> though.
> 
> Peter

You math guy's make me laugh. As I see it he want's 10 grooves
equaly spaced around a cylinder right ?

camera{location<0,0,-7> look_at 0}
light_source{<0, 35,-400>rgb 1}


#declare a = 0;
#while  (a < 10)
difference {

cylinder{y*0.00, y*3.0, 1.0 pigment {red 1}}
cylinder{y*-0.1, y*3.1, 0.1 pigment {blue 1} translate x*1 rotate y*36*a}}

#declare a = a + 1;
#end

Unfortunatly the above positioned the differencing cylinders
correctly around the cylinder but does not perform the csg operation.
Is this a bug ? 


The situation below places the differencing cylinders in the exact
same positions and does the csg operation correctly.

#declare DiffObject =
cylinder{y*-.1,y*3.1,.1 pigment{blue 1}translate x*1}

difference{
cylinder{y*0,y*3,1 pigment {red 1}}

object{DiffObject rotate y*  0}
object{DiffObject rotate y* 36}
object{DiffObject rotate y* 72}
object{DiffObject rotate y*108}
object{DiffObject rotate y*144}
object{DiffObject rotate y*180}
object{DiffObject rotate y*216}
object{DiffObject rotate y*252}
object{DiffObject rotate y*288}                          
object{DiffObject rotate y*324}}

Would someone care to elaborate as to why one method works
and the other does not ?

-- 
Ken Tyler

mailto://tylereng@pacbell.net


Post a reply to this message

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