POV-Ray : Newsgroups : povray.general : Bug? difference of intersections isn't right. : Bug? difference of intersections isn't right. Server Time
29 Jul 2024 12:19:31 EDT (-0400)
  Bug? difference of intersections isn't right.  
From: Ron Parker
Date: 21 Jul 1998 12:47:23
Message: <35b4b80b.0@news.povray.org>
(Followups are set to povray.programming, but the problem might be of general
 interest so it's crossposted to povray.general.  That's how crossposting
 is supposed to work, y'all.)

When I do the following in POV 3.02 or 3.1b4, I get the "wrong" result:

difference {
  sphere {0,1}
  intersection {
    sphere {-.3*x,.5}
    sphere {.3*x,.5}
  }
  texture {pigment {rgbf .8}}
}

Instead of getting a sphere with a lens sort of thing removed from the
interior, I get a sphere with interior surfaces corresponding to the two 
smaller spheres, with the lens removed.

I have traced this to the file CSG.C, in the function 
Invert_CSG_Intersection, at line 703 or thereabouts in the 3.02 code.  
The line reads:

  Object->Methods = &CSG_Union_Methods;

This works fine when the object isn't transparent, but it leads to 
unexpected interior surfaces for transparent objects.  To make the problem
go away, one could replace CSG_Union_Methods with CSG_Merge_Methods, but 
since merges are more expensive than unions, it might be preferable to have
a keyword that causes the merge methods to be used instead of the union 
methods when the scene requires it.

The workaround, of course, is to rewrite your scene to do the substitution
for you:

intersection {
  sphere {0,1}
  merge {
    sphere {-.3*x,.5 inverse}
    sphere {.3*x,.5 inverse}
  }
  texture {pigment {rgbf .8}}
}

I will probably do this with the code I'm having the problem with, but it
would tend to make one's head hurt if required on a large scale, and it does
make the code harder to visualize.


Post a reply to this message

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