POV-Ray : Newsgroups : povray.binaries.scene-files : Stupid math problem, HELP!!!!! Server Time
29 Mar 2024 08:48:39 EDT (-0400)
  Stupid math problem, HELP!!!!! (Message 1 to 7 of 7)  
From: Mark Palmquist
Subject: Stupid math problem, HELP!!!!!
Date: 9 Feb 1999 21:52:10
Message: <36C0F5C2.400D03A5@earthlink.net>
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.

// ----------------------------------------
#declare grooves = 36
#declare vector = 360/grooves
#declare groove_now = 1

difference{
  cylinder{  <0,0,0>,  <0,3,0>,  1  pigment {Red}  }
  #while (groove_now <= grooves)
    cylinder{  <sin(vector), -1, cos(vector)>  <sin(vector), 4,
cos(vector)>,  .1  pigment {Blue}  }
    #declare groove_now = groove_now + 1
    #declare vector = vector + 360/grooves
  #end
}


Post a reply to this message

From: Peter Popov
Subject: Re: Stupid math problem, HELP!!!!!
Date: 9 Feb 1999 23:27:31
Message: <36c108d5.864491@news.povray.org>
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


Post a reply to this message

From: Ken
Subject: Re: Stupid math problem, HELP!!!!!
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

From: Mark Palmquist
Subject: Re: Stupid math problem, HELP!!!!!
Date: 10 Feb 1999 00:42:48
Message: <36C11DC0.66599660@earthlink.net>
Thanks guys, Ken it's not a 'bug' just need to move the 1st difference outside
the loop.
new code below.


#declare grooves = 16
#declare base = 0
#declare top = 5
#declare a = 0;

difference {
cylinder{y*base, y*top, 1.0 pigment {red 1}}
#while  (a < grooves)
  cylinder{y*(base - .01) , y*(top + .1) , 0.1 pigment {blue 1} translate x*1
rotate y*(360/grooves)*a}
  #declare a = a + 1;
#end
}

Ken wrote:

> 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

From: Peter Popov
Subject: Re: Stupid math problem, HELP!!!!!
Date: 10 Feb 1999 00:56:11
Message: <36c31cd5.5985409@news.povray.org>
On Tue, 09 Feb 1999 20:58:55 -0800, Ken <tyl### [at] pacbellnet> wrote:
<snip>
>Would someone care to elaborate as to why one method works
>and the other does not ?

You mean my method doesn't work? Then the original poster can use
yours, as I see it will works. The simplicity of true genius, right?


Post a reply to this message

From: Ken
Subject: Re: Stupid math problem, HELP!!!!!
Date: 10 Feb 1999 05:23:19
Message: <36C15DD8.142085AD@pacbell.net>
Peter Popov wrote:
> 
> On Tue, 09 Feb 1999 20:58:55 -0800, Ken <tyl### [at] pacbellnet> wrote:
> <snip>
> >Would someone care to elaborate as to why one method works
> >and the other does not ?
> 
> You mean my method doesn't work? Then the original poster can use
> yours, as I see it will works. The simplicity of true genius, right?

In fairness to you yes it did work once the typo's were removed.
Sure seemed like an awfull lot of extra typing to get the job done
is all.

 About the true genius part I was wondering when somebody would notice :)

-- 
Ken Tyler

mailto://tylereng@pacbell.net


Post a reply to this message

From: Eric Freeman
Subject: Re: Stupid math problem, HELP!!!!! (2.8 .INC File Attached)
Date: 20 Feb 1999 02:40:47
Message: <36ce66ff.0@news.povray.org>
Mark Palmquist wrote in message <36C0F5C2.400D03A5@earthlink.net>...
>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.
>
>// ----------------------------------------
>#declare grooves = 36
>#declare vector = 360/grooves
>#declare groove_now = 1
>
>difference{
>  cylinder{  <0,0,0>,  <0,3,0>,  1  pigment {Red}  }
>  #while (groove_now <= grooves)
>    cylinder{  <sin(vector), -1, cos(vector)>  <sin(vector), 4,
>cos(vector)>,  .1  pigment {Blue}  }
>    #declare groove_now = groove_now + 1
>    #declare vector = vector + 360/grooves
>  #end
>}

No need to use trig... translate and rotate work just fine.  Put the column
at the xz origin and cut the grooves out using translate and rotate.
Attached find an include file I made for 3.02 (should work with 3.1).  It's
kinda crude, but it works.  Instructions in the header of the file.

See some examples of my column at:

http://www.geocities.com/SiliconValley/Heights/2354/gallery/columns.jpg

http://www.geocities.com/SiliconValley/Heights/2354/gallery/column_field.jpg

http://www.geocities.com/SiliconValley/Heights/2354/gallery/column_fancy.jpg

Eric

--------------------------------
http://www.geocities.com/SiliconValley/Heights/2354/


Post a reply to this message


Attachments:
Download 'column.inc.txt' (3 KB)

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