POV-Ray : Newsgroups : povray.newusers : blob in while loop.... Server Time
5 Sep 2024 18:20:27 EDT (-0400)
  blob in while loop.... (Message 1 to 6 of 6)  
From: Jason Dinger
Subject: blob in while loop....
Date: 22 Sep 1999 21:05:31
Message: <01bf0560$90c397c0$9a1ee1cf@jimmy-the-fish>
when trying to change the object of my while loop from a regular sphere to
a blob
it seems to perform the while command but ignoring the blob and using only
spheres?

/*here's the code i'm using*/

#declare ct = 0; 
 #while (ct<10)
blob { threshold .5
 sphere {0,1,1 translate ct*y}
 pigment {rgb <1,0,0>} }
 #declare ct = ct + .5;
#end


Post a reply to this message

From: Remco de Korte
Subject: Re: blob in while loop....
Date: 22 Sep 1999 22:24:09
Message: <37E98F9B.FDCBAEA7@xs4all.nl>
Jason Dinger wrote:
> 
> when trying to change the object of my while loop from a regular sphere to
> a blob
> it seems to perform the while command but ignoring the blob and using only
> spheres?
> 
> /*here's the code i'm using*/
> 
> #declare ct = 0;
>  #while (ct<10)
> blob { threshold .5
>  sphere {0,1,1 translate ct*y}
>  pigment {rgb <1,0,0>} }
>  #declare ct = ct + .5;
> #end

Yep.
Get the blob-statement and the closing bracket out of the loop.

Cheers!

Remco


Post a reply to this message

From: Robert Chaffe
Subject: Re: blob in while loop....
Date: 22 Sep 1999 23:56:42
Message: <37e9a4fa@news.povray.org>
Perhaps this?

blob { threshold .5
  #declare ct = 0;
  #while (ct<10)
    sphere {0,1,1 translate ct*y}
  #declare ct = ct + .5;
  #end
  pigment {rgb <1,0,0>} }


Jason Dinger <jas### [at] hotmailcom> wrote in message
news:01bf0560$90c397c0$9a1ee1cf@jimmy-the-fish...
> when trying to change the object of my while loop from a regular sphere to
> a blob
> it seems to perform the while command but ignoring the blob and using only
> spheres?
>
> /*here's the code i'm using*/
>
> #declare ct = 0;
>  #while (ct<10)
> blob { threshold .5
>  sphere {0,1,1 translate ct*y}
>  pigment {rgb <1,0,0>} }
>  #declare ct = ct + .5;
> #end


Post a reply to this message

From: Chimera S  Grafi
Subject: Re: blob in while loop....
Date: 23 Sep 1999 05:06:50
Message: <37e9edaa@news.povray.org>
This is a general rule with such things, if blob were union instead same
thing applies.  Probably a common mistake.  Looping the entire thing makes a
group of single component blobs, which is basically a sphere anyway.

--
/* Chimera */

Robert Chaffe <rch### [at] compaqnet> wrote in message
news:37e9a4fa@news.povray.org...
| Perhaps this?
|
| blob { threshold .5
|   #declare ct = 0;
|   #while (ct<10)
|     sphere {0,1,1 translate ct*y}
|   #declare ct = ct + .5;
|   #end
|   pigment {rgb <1,0,0>} }
|
|
| Jason Dinger <jas### [at] hotmailcom> wrote in message
| news:01bf0560$90c397c0$9a1ee1cf@jimmy-the-fish...
| > when trying to change the object of my while loop from a regular sphere
to
| > a blob
| > it seems to perform the while command but ignoring the blob and using
only
| > spheres?
| >
| > /*here's the code i'm using*/
| >
| > #declare ct = 0;
| >  #while (ct<10)
| > blob { threshold .5
| >  sphere {0,1,1 translate ct*y}
| >  pigment {rgb <1,0,0>} }
| >  #declare ct = ct + .5;
| > #end
|
|


Post a reply to this message

From: Nieminen Juha
Subject: Re: blob in while loop....
Date: 23 Sep 1999 06:43:03
Message: <37ea0437@news.povray.org>
Jason Dinger <jas### [at] hotmailcom> wrote:
: #declare ct = 0; 
: #while (ct<10)
:   blob { threshold .5
:     sphere {0,1,1 translate ct*y}
:     pigment {rgb <1,0,0>} }
:   #declare ct = ct + .5;
: #end 

  Think about it. Each time the #while-loop is parsed, a copy of all that is
between the #while and the #end is created.
  So the first time this is created:

  blob { threshold .5
    sphere {0,1,1 translate ct*y}
    pigment {rgb <1,0,0>} }
  #declare ct = ct + .5;

  Now we loop again and we get another copy:

  blob { threshold .5
    sphere {0,1,1 translate ct*y}
    pigment {rgb <1,0,0>} }
  #declare ct = ct + .5;
  blob { threshold .5
    sphere {0,1,1 translate ct*y}
    pigment {rgb <1,0,0>} }
  #declare ct = ct + .5;

and so on. When we loop 10 times we get 10 (independent) blob statements.

  Obviously you don't want 10 separated blob statements, but one single
blob statement with 10 spheres inside it. Thus we have to create the
blob statement just once:

blob { threshold .5
  #declare ct = 0; 
  #while (ct<10)
    sphere {0,1,1 translate ct*y}
    #declare ct = ct + .5;
  #end 
  pigment {rgb <1,0,0>}
}

-- 
main(i,_){for(_?--i,main(i+2,"FhhQHFIJD|FQTITFN]zRFHhhTBFHhhTBFysdB"[i]
):5;i&&_>1;printf("%s",_-70?_&1?"[]":" ":(_=0,"\n")),_/=2);} /*- Warp -*/


Post a reply to this message

From: Ken
Subject: Re: blob in while loop....
Date: 23 Sep 1999 06:48:40
Message: <37EA04FC.E2C35522@pacbell.net>
Nieminen Juha wrote:
> 
> Jason Dinger <jas### [at] hotmailcom> wrote:

>   Think about it. Each time the #while-loop is parsed, a copy of all that is
> between the #while and the #end is created.

>   Obviously you don't want 10 separated blob statements, but one single
> blob statement with 10 spheres inside it. Thus we have to create the
> blob statement just once:

  I think the confusion here is understandable. One would naturaly
conclude that a blob is an object. However it is only the spheres
in the blob statement that are a true object while the blob itself
is a function wrapper much like a CSG operation would be when used
with while loops.

-- 
Ken Tyler

See my 1000+ Povray and 3D Rendering and Raytracing Links at:
http://home.pacbell.net/tylereng/index.html


Post a reply to this message

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