POV-Ray : Newsgroups : povray.newusers : math Server Time
14 Nov 2024 16:25:01 EST (-0500)
  math (Message 1 to 4 of 4)  
From: Ross Litscher
Subject: math
Date: 10 Apr 1998 19:32:19
Message: <352EAC03.2230@osu.edu>
I have a mathematical equation and I was wondering if it is possible to
do something like put one sphere at each vlaue or something. simple
example would be y = 3x + 1 or something... and have a while loop with
values from 0 to 10 being put in. how, if possible, would I do this?


Post a reply to this message

From: Jerry Anning
Subject: Re: math
Date: 11 Apr 1998 00:10:51
Message: <352EED49.E780C35D@dhol.com>
Ross Litscher wrote:

> I have a mathematical equation and I was wondering if it is possible
> to
> do something like put one sphere at each vlaue or something. simple
> example would be y = 3x + 1 or something... and have a while loop with
>
> values from 0 to 10 being put in. how, if possible, would I do this?

   // Begin POV code

#include "colors.inc"
#include "textures.inc"

// Your camera here

// Your lights here

#declare J = 0
#while (J < 11)
    sphere
        { <J, 3 * J + 1, 0>,  .5
            texture { pigment { color Red } normal { dents 3 } finish {
Shiny } } }
    #declare J = J + 1
#end

// End POV code

Jerry Anning
cle### [at] dholcom


Post a reply to this message

From: Alain CULOS
Subject: Re: math
Date: 11 Apr 1998 08:18:42
Message: <352F5FA2.EDFBAC69@bigfoot.com>
Hi Ross,

You can :

1/ define a starting point, i.e. :
#declare x=0

2/ do your loop until an end point, i.e. :
#while (x <= 10)

3/ do your calculation, i.e. :
#declare y=3*x+1

4/ define your object based on this calculation, i.e. :
sphere {<x, y, 0> 5}

5/ do something to keep x incrementing, i.e. :
#declare x=x+1

6/ close your loop :
#end

And you have it.
Hope this helps,
Al.


Ross Litscher wrote:

> I have a mathematical equation and I was wondering if it is possible to
> do something like put one sphere at each vlaue or something. simple
> example would be y = 3x + 1 or something... and have a while loop with
> values from 0 to 10 being put in. how, if possible, would I do this?

--
ANTI SPAM / ANTI ARROSAGE COMMERCIAL :

To answer me, please take out the Z from my address.


Post a reply to this message

From: Ross Litscher
Subject: Re: math
Date: 11 Apr 1998 18:52:16
Message: <352FF420.7E51@osu.edu>
Alain CULOS wrote:
> 
> Hi Ross,
> 
> You can :
> 
> 1/ define a starting point, i.e. :
> #declare x=0
> 
> 2/ do your loop until an end point, i.e. :
> #while (x <= 10)
> 
> 3/ do your calculation, i.e. :
> #declare y=3*x+1
> 
> 4/ define your object based on this calculation, i.e. :
> sphere {<x, y, 0> 5}
> 
> 5/ do something to keep x incrementing, i.e. :
> #declare x=x+1
> 
> 6/ close your loop :
> #end
> 
> And you have it.
> Hope this helps,
> Al.
> 


yes, that helps. Thankyou.


Post a reply to this message

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