POV-Ray : Newsgroups : povray.bugreports : Bug in CSG difference with clipped_by : Bug in CSG difference with clipped_by Server Time
23 Jun 2024 15:51:36 EDT (-0400)
  Bug in CSG difference with clipped_by  
From: Ron Parker
Date: 27 Apr 1999 13:13:03
Message: <3725e20f.0@news.povray.org>
The following scene demonstrates a bug involving difference and clipped_by.  
When you render it, you should get three objects.  The one on the left, 
the red one, is rendered correctly.  

The one in the center (the green one) should be identical to the one on 
the left, but I added a clipped_by to the cylinder in an attempt to make 
it render faster (Inside_Box is slightly faster than Inside_Cone, but 
Inside_Object ignores bounded_by so I used clipped_by.)  It's obvious 
from looking at the result that the automatic inverse operation applied 
by difference doesn't properly deal with the clipping object(s).  This 
looks like a bug.

So, I applied the inverse to the clipping object manually.  The result is 
what you see on the right, the blue object.  I can't say I didn't expect 
this result, for it is true that !(A & B) (the "correct" result) is not equal 
to (!A & !B) (the result of inverting the clipping object separately).  So
we can't just set the inverse flags on the clipping objects and expect it 
to work right in a difference.  It looks like Inside_Object needs to return
the state of the inverse flag (of the parent object, not the clipping object) 
instead of false when it is given a point that is not in the clipping object.

It seems like this might change the behavior of existing scenes, however,
so perhaps it should only happen if the inverse was applied implicitly by 
a difference operation.  (I'll admit that I can't think of a scene where
the change in behavior would be noticeable, with the possible exception 
of one involving media, and I think media is already broken by clipped_by.)

-------------------------------------------------------
camera {location <0,1,-5> look_at <0,0,0>}
light_source { <50,50,-50> color rgb 3 }
    
difference {
  box {-.5,.5}
  cylinder {-.6*z,.6*z,.25}
  texture {pigment {color red 1} finish {ambient .5}}
  translate -1.1*x
}

difference {
  box {-.5,.5}
  cylinder {-.6*z,.6*z,.25 
            clipped_by{box {<-.26,-.26,-.6><.26,.26,.6>}}}
  texture {pigment {color green 1} finish {ambient .5}}
}

difference {
  box {-.5,.5}
  cylinder {-.6*z,.6*z,.25 
            clipped_by{box {<-.26,-.26,-.6><.26,.26,.6> inverse}}}
  texture {pigment {color blue 1} finish {ambient .5}}
  translate 1.1*x
}
-------------------------------------------------------


Post a reply to this message

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