POV-Ray : Newsgroups : povray.general : Double union{ difference{ problem Server Time
29 Jul 2024 08:10:09 EDT (-0400)
  Double union{ difference{ problem (Message 1 to 8 of 8)  
From: bluestar
Subject: Double union{ difference{ problem
Date: 20 Apr 2012 14:05:00
Message: <web.4f91a4173d42deb63f3b2c70@news.povray.org>
I have built a cube with a spherical void inside. I am having difficulty cutting
away a slice of the cube to expose the inner spherical void. I first included

work. Then I just built the cube and sphere and then later tried to add the

Here is the code I am working with:

//============================  box
#declare blackbox =
 union {
 difference {

    box { <0,0,0>, <8,8,8>      // Outside box
        pigment{ color rgb <1,0,0> *2 }
        scale < 1,1,1>  * 1
        rotate  < 0,0,0>
        translate < -4,0,-4>
       }
  }
    sphere { <0,0,0>, 4       //Inside sphere
        pigment{ color rgb <1,1,1> *2}
        scale < 1,1,1>  * 1
        rotate  < 0,0,0>
        translate < 0,4,0>
       }
  }

//============================  plane
#declare sliceplane =
   box { <0,0,0>, <6,12,12>   // slice plane
       pigment { color rgb <1,1,1> * 1}
       scale < 1,1,1>  * 1
       rotate  < -75,-25,0>
       translate < -6,-1,-3>
      }

union { difference { object {blackbox} }  object{sliceplane}}


Post a reply to this message

From: Warp
Subject: Re: Double union{ difference{ problem
Date: 20 Apr 2012 14:10:36
Message: <4f91a69c@news.povray.org>
bluestar <nomail@nomail> wrote:
> union { difference { object {blackbox} }  object{sliceplane}}

  You are creating a union of the box and the plane, rather than a
difference.

-- 
                                                          - Warp


Post a reply to this message

From: bluestar
Subject: Re: Double union{ difference{ problem
Date: 20 Apr 2012 14:45:01
Message: <web.4f91adc8b56d5aa93f3b2c70@news.povray.org>
> > union { difference { object {blackbox} }  object{sliceplane}}
>
>   You are creating a union of the box and the plane, rather than a
> difference.
>                                                          - Warp

Hey Warp,
I tried this and got the same effect.

 difference { object {blackbox} }  object{sliceplane}

The above syntax was the same used to make the spherical void in the cube except
with that image I also use the preceeding union statement.


Post a reply to this message

From: bluestar
Subject: Re: Double union{ difference{ problem
Date: 20 Apr 2012 14:50:01
Message: <web.4f91af59b56d5aa93f3b2c70@news.povray.org>
Warp <war### [at] tagpovrayorg> wrote:
> bluestar <nomail@nomail> wrote:
> > union { difference { object {blackbox} }  object{sliceplane}}
>
>   You are creating a union of the box and the plane, rather than a
> difference.
>
> --
>                                                           - Warp


Hey Warp
I dropped the union{ statement and got the same effect.

 difference { object {blackbox} }  object{sliceplane}

This syntax is the same I used to create the spherical void in the cube except
then I included the union{ statement. In this case I am unclear what is wrong.


Post a reply to this message

From: Warp
Subject: Re: Double union{ difference{ problem
Date: 20 Apr 2012 14:53:41
Message: <4f91b0b5@news.povray.org>
bluestar <nomail@nomail> wrote:
> Hey Warp,
> I tried this and got the same effect.

>  difference { object {blackbox} }  object{sliceplane}

  Now you are creating two separate objects with no connection to each
other.

-- 
                                                          - Warp


Post a reply to this message

From: Warp
Subject: Re: Double union{ difference{ problem
Date: 20 Apr 2012 14:55:05
Message: <4f91b109@news.povray.org>
Warp <war### [at] tagpovrayorg> wrote:
> bluestar <nomail@nomail> wrote:
> > Hey Warp,
> > I tried this and got the same effect.

> >  difference { object {blackbox} }  object{sliceplane}

>   Now you are creating two separate objects with no connection to each
> other.

  Ok, I'll stop being so mean. Try this:

difference
{
    object { blackbox }
    object { sliceplane }
}

-- 
                                                          - Warp


Post a reply to this message

From: bluestar
Subject: Re: Double union{ difference{ problem
Date: 20 Apr 2012 15:15:01
Message: <web.4f91b500b56d5aa93f3b2c70@news.povray.org>
Warp <war### [at] tagpovrayorg> wrote:
> bluestar <nomail@nomail> wrote:
> > Hey Warp,
> > I tried this and got the same effect.
>
> >  difference { object {blackbox} }  object{sliceplane}
>
>   Now you are creating two separate objects with no connection to each
> other.
>
> --
>                                                           - Warp

OK,ok I got it.
This chopped off the box. Wrong side, but I'll fix that.

 difference { object {blackbox}   object{sliceplane} }

Also noticed the sphere void was not present, so I'll check syntax on that
object as well.

Also, I will seperate out all obects and will try the following to see if it
works.

difference { object {blackbox}   object{spherevoid} object{sliceplane} }

or the second half may need to be in brackets

difference { object {blackbox}   {object{spherevoid} object{sliceplane}} }

Hey Warp, thanks for the nudges, much appreciated!!!


Post a reply to this message

From: Alain
Subject: Re: Double union{ difference{ problem
Date: 20 Apr 2012 18:00:10
Message: <4f91dc6a@news.povray.org>

> Warp<war### [at] tagpovrayorg>  wrote:
>> bluestar<nomail@nomail>  wrote:
>>> Hey Warp,
>>> I tried this and got the same effect.
>>
>>>   difference { object {blackbox} }  object{sliceplane}
>>
>>    Now you are creating two separate objects with no connection to each
>> other.
>>
>> --
>>                                                            - Warp
>
> OK,ok I got it.
> This chopped off the box. Wrong side, but I'll fix that.
>
>   difference { object {blackbox}   object{sliceplane} }

Simple, just negate the plane's normal.
plane{y,0} becomes plane{-y,0}
If the plane ton't pass through the origin, like this:
plane{y, 10}, then you need to also negate the distance like this:
plane{-y, -10}

You can also use inverse.

>
> Also noticed the sphere void was not present, so I'll check syntax on that
> object as well.
>
> Also, I will seperate out all obects and will try the following to see if it
> works.
>
> difference { object {blackbox}   object{spherevoid} object{sliceplane} }

This construction is OK
You start with the base object, then you remove the sphere and the plane.

>
> or the second half may need to be in brackets
>
> difference { object {blackbox}   {object{spherevoid} object{sliceplane}} }

This one is not, at least, it's not recomended...

>
> Hey Warp, thanks for the nudges, much appreciated!!!
>
>


Post a reply to this message

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