POV-Ray : Newsgroups : povray.advanced-users : Closing brace bug ? : Re: Closing brace bug ? Server Time
30 Jul 2024 10:23:33 EDT (-0400)
  Re: Closing brace bug ?  
From: Ron Parker
Date: 15 Oct 1999 11:49:17
Message: <slrn80eitl.v8.parkerr@ron.gwmicro.com>
On Fri, 15 Oct 1999 08:19:44 -0700, Ken wrote:
>
>
>Ken wrote:
>
>  Something still bothering me about this code. After fixing it so that the
>loop starts at zero and the csg operation is performed properly I am getting
>a coincident surface problem with the sphere object. No amount of shuffling
>of the code or pigments seems to eliminate the problem. Technicaly there
>should be no coincident surface as far as I can tell. Example below:

Your code expands to:

camera { location<0,0,-3> look_at 0}
light_source {<0,0,-300> rgb 1}
 
difference {
   sphere   {<0,0,0>, 1 pigment { rgb 1 }}
   sphere   {<0,0,0>,.9 pigment { rgb 1 }}
   cylinder { <-1.1,0, 0.0>,<1.0,0,0.0>,.1  rotate y*360/.001 pigment {rgb 1}}
   cylinder { < 0.0,0,-1.1>,<0.0,0,1.1>,.1  rotate x*360/.001 pigment {rgb 1}}
   sphere   {<0,0,0>, 1 pigment { rgb 1 }}
   sphere   {<0,0,0>,.9 pigment { rgb 1 }}
   cylinder { <-1.1,0, 0.0>,<1.0,0,0.0>,.1  rotate y*360/1.001 pigment {rgb 1}}
   cylinder { < 0.0,0,-1.1>,<0.0,0,1.1>,.1  rotate x*360/1.001 pigment {rgb 1}}
    :
    :
   sphere   {<0,0,0>, 1 pigment { rgb 1 }}
   sphere   {<0,0,0>,.9 pigment { rgb 1 }}
   cylinder { <-1.1,0, 0.0>,<1.0,0,0.0>,.1  rotate y*360/11.001 pigment {rgb 1}}
   cylinder { < 0.0,0,-1.1>,<0.0,0,1.1>,.1  rotate x*360/11.001 pigment {rgb 1}}
}

First, I'm guessing you didn't really mean to multiply by 360/A; you probably 
meant something else, as rotating by 360,000 degrees is meaningless and strange.
Perhaps you meant to multiply by 360*A/12 ?  If so, note that the cylinder 
created for A=6 will be coincident with the one created for A=0 as well.  In 
addition, the two cylinders for A=3 and the two for A=9 will be coincident.

That said, notice that you're differencing the same sphere many, many times and 
in fact you're differencing the first sphere from itself.  Of course you have a
coincident surface problem.

Here's your code with my changes.  I added the high ambient so I could see the
back side of the sphere through the hole; you probably don't want it.

camera { location<0,0,-3> look_at 0}
light_source {<0,0,-300> rgb 1}
default {finish {ambient .5}}
 
difference {
  sphere   {<0,0,0>, 1 pigment { rgb 1 }}
  sphere   {<0,0,0>,.9 pigment { rgb 1 }}

  #declare A = .001;
  #while (A<6)
 
   cylinder { <-1.1,0, 0.0>,<1.0,0,0.0>,.1  rotate y*A*30 pigment {rgb 1}}
   #if (A != 3 )
     cylinder { < 0.0,0,-1.1>,<0.0,0,1.1>,.1  rotate x*A*30 pigment {rgb 1}}
   #end

 #declare A=A+1;
 #end
}


Post a reply to this message

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