POV-Ray : Newsgroups : povray.general : CSG troubles : Re: CSG troubles Server Time
30 Jul 2024 10:19:54 EDT (-0400)
  Re: CSG troubles  
From: stevenvh
Date: 8 Mar 2009 16:40:00
Message: <web.49b42c9cda4bf64fc0721a1d0@news.povray.org>
"clipka" <nomail@nomail> wrote:
> The problem is that e.g. a window needs to both add *and* subtract something
> from the object it is to be placed into. There is no CSG operation that can
> achieve both at the same time.

That's what I first thought, but it isn't true.

  difference { A  difference { B C } }

will subtract B from A, but C will be added again.
I think my problem was that I tried to use 'inverse' and that IMO behaves oddly.
Can anyone explain the behavior I'm describing in my OP?

Anyway, I rewrote my code without the 'inverse' and this seems to work:

  // code start =====2=========3=========4=========5=========6=========7====
  #include "colors.inc"
  //#include "axes.inc"

  #macro singledoor()
    difference {
      box { < 2, 0, -2 >, < 6, 9, 3 > }     // door
      box { < 3, 6, -3 >, < 5, 8, 4 > }     // window
    }
  #end

  #macro doubledoor()
    difference {
      box { < 1, 0, -1 >, < 12, 10, 2 > }   // hole in wall
      object { singledoor() }
      object { singledoor() translate x * 5 }
    }
  #end

  difference {
    box { < -5, 0, 0 >, < 17, 14, 1 > }     // wall
    object { doubledoor() }
    pigment { rgb 0.6 }
  }

  camera {
    location < -100, 100, -200 >
    look_at < 4, 7, 0 >
    angle 6
  }

  light_source { < -1000, 1000, 1000> color White }
  background { Gray80 }
  // code end =======2=========3=========4=========5=========6=========7====

Thanks for your reply, clipka.


Post a reply to this message

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