POV-Ray : Newsgroups : povray.advanced-users : Errors in Povray's CSG??? Server Time
27 Dec 2024 06:33:02 EST (-0500)
  Errors in Povray's CSG??? (Message 1 to 10 of 10)  
From: Captain Chemistry
Subject: Errors in Povray's CSG???
Date: 10 Dec 2004 06:10:00
Message: <web.41b982a290a9c2304c6939d0@news.povray.org>
Hello everyone.

I know this sounds extremely arrogant and I apologise if it doesn't do the
same thing on anyone else's computer but you should check this out:

Copy and paste the code snippet below exactly as it looks and render it at
any 4:3 resolution.

I have tried it on both perspective and orthographic cameras and the results
are the same: the left object renders fine but the middle and right objects
are cut off in a kind of square shape at the bottom.

The following is a description of the code:

There are three sets: A,B,C.
These sets correspond to a sphere, a cylinder, and a torus respectively.
The torus has been designed to be completely contained in (ie a subset of)
the sphere.
The operation "Union" is represented as "U".
The operation "Intersection" is represented as "^".
The operation "Complement" is represented as "'".

The final object (using csg) is: A ^ (C U B')
This is exactly what the white object on the left is.

The middle object has simply been expanded using set theory:
(A U C) ^ (C U B')

The object on the right assumes that C (torus) is a subset of A (sphere) and
thus reduces (A U C) to simply A.
Otherwise it is the same as the middle object.

The problem is that both the middle and right objects do not render
correctly even though they are the same as the left one (in set theory that
is).

I was under the impression that sets and the theory they command correspond
directly to pov's CSG.

Can anyone give an explanation???

I accept that the following may be true:
* my computer is jibbed and everyone else's works
* I have misunderstood set theory and/or povray CSG
* I have understood both set theory and povray CSG correctly but I have
misunderstood how to merge the two concepts (pun intended!)

The code is below:

// BEGINNING OF CODE
camera{location<0,4,-6>look_at 0}
light_source{<0,4,-6>rgb 1.5}

#declare A=sphere{0 1}
#declare B=cylinder{<0,0.3,0><0,2,0>0.7}
#declare C=torus{0.5 0.3 translate<0,0.3,0>}

// the only one that works
// A ^ (C U B')
union
{
 object{C}
 intersection
 {
  object{A}
  object{B inverse}
 }
 translate<-3,0,0>
 pigment{rgb 1}
}

// the same thing in set theory at least
// (A U C) ^ (C U B')
intersection
{
 union
 {
  object{A}
  object{C}
 }
 union
 {
  object{C}
  object{B inverse}
 }
 pigment{rgb 1}
}

// this one assumes C is a subset of A (which it should be here)
// A ^ (C U B')
intersection
{
 object{A}
 union
 {
  object{C}
  object{B inverse}
 }
 translate<3,0,0>
 pigment{rgb 1}
}
// END OF CODE

Nathan


Post a reply to this message

From: Christoph Hormann
Subject: Re: Errors in Povray's CSG???
Date: 10 Dec 2004 06:30:02
Message: <cpc146$5e7$1@chho.imagico.de>
Captain Chemistry wrote:
> 
> Can anyone give an explanation???
> 
> I accept that the following may be true:
> * my computer is jibbed and everyone else's works
> * I have misunderstood set theory and/or povray CSG
> * I have understood both set theory and povray CSG correctly but I have
> misunderstood how to merge the two concepts (pun intended!)

It is probably:

* You did not read the manual which is completely obvious because you 
would not have mistaken union as a CSG operation then.

I don't know if your theoretical thoughts have any point but POV-Ray CSG 
works as described in the manual.

Christoph

-- 
POV-Ray tutorials, include files, Sim-POV,
HCR-Edit and more: http://www.tu-bs.de/~y0013390/
Last updated 23 Sep. 2004 _____./\/^>_*_<^\/\.______


Post a reply to this message

From: Captain Chemistry
Subject: Re: Errors in Povray's CSG???
Date: 10 Dec 2004 06:50:00
Message: <web.41b98d256a3448ccc429631f0@news.povray.org>
Christoph Hormann <chr### [at] gmxde> wrote:
> * You did not read the manual which is completely obvious because you
> would not have mistaken union as a CSG operation then.

Very good point. I apologise.
(But what about merge? Isn't that a CSG operation? -- It does the same thing
with merge as well... I tried.)

> I don't know if your theoretical thoughts have any point but POV-Ray CSG
> works as described in the manual.

It's really nothing anyway but it did intrigue me.


Post a reply to this message

From: Thorsten Froehlich
Subject: Re: Errors in Povray's CSG???
Date: 10 Dec 2004 08:04:02
Message: <41b99ec2$1@news.povray.org>
In article <web.41b98d256a3448ccc429631f0@news.povray.org> , "Captain 
Chemistry" <njj### [at] studentmonasheduau> wrote:

> Christoph Hormann <chr### [at] gmxde> wrote:
>> * You did not read the manual which is completely obvious because you
>> would not have mistaken union as a CSG operation then.
>
> Very good point. I apologise.
> (But what about merge? Isn't that a CSG operation? -- It does the same thing
> with merge as well... I tried.)

Probably you should ask such basic questions in povray.newusers!

    Thorsten

____________________________________________________
Thorsten Froehlich
e-mail: mac### [at] povrayorg

I am a member of the POV-Ray Team.
Visit POV-Ray on the web: http://mac.povray.org


Post a reply to this message

From: Mike Williams
Subject: Re: Errors in Povray's CSG???
Date: 10 Dec 2004 08:06:30
Message: <9egMYFAE9ZuBFw5N@econym.demon.co.uk>
Wasn't it Captain Chemistry who wrote:
>Hello everyone.
>
>I know this sounds extremely arrogant and I apologise if it doesn't do the
>same thing on anyone else's computer but you should check this out:

It appears to be a bounding bug.

If you switch bounding off, ("-MB" in the command line) then the POV
results match what you'd expect from set theory. So the POV code doing
the actual intersection, union and inversion code is working as you
would expect but the automatic bounding is chopping bits off.

The bit that goes

 union
 {
  object{C}
  object{B inverse}
 }

seems to have its bounding inverted, giving it finite bounds instead of
infinite bounds. That would be fine if that were the top level of the
CSG, but when it's part of an intersection the infinite part is really
needed.

-- 
Mike Williams
Gentleman of Leisure


Post a reply to this message

From: Chris B
Subject: Re: Errors in Povray's CSG???
Date: 10 Dec 2004 09:10:33
Message: <41b9ae59$1@news.povray.org>
"Mike Williams" <nos### [at] econymdemoncouk> wrote in message
news:9eg### [at] econymdemoncouk...
> Wasn't it Captain Chemistry who wrote:
> >Hello everyone.
> >
> >I know this sounds extremely arrogant and I apologise if it doesn't do
the
> >same thing on anyone else's computer but you should check this out:
>
> It appears to be a bounding bug.
>
> If you switch bounding off, ("-MB" in the command line) then the POV
> results match what you'd expect from set theory. So the POV code doing
> the actual intersection, union and inversion code is working as you
> would expect ... snip ...

Hi Captain,
I think Mike has answered your main question about why bits of your shape
were missing,
but I think that POV is not doing quite what you think it is.

I'm not very familiar with set theory, but I suspect that the 'union' in set
theory combines both sets, whereas in POVRay it combines the two surfaces
(leaving internal surfaces in place). I think you probably want the POVRay
'merge' operation which creates a surface around the outside of the points
considered to be inside the object. You can see the difference if you add a
'clipped_by {plane{-z,0}}' to your CSG.

p.s.
In your left hand POVRay object you've transposed the intersection and merge
(and objects A and C), which seems to avoid the bounding bug. If you reverse
these to the form represented by your set description A ^ (C U B') you get
the same sort of problem as you had with your other two shapes.

Chris B.


Post a reply to this message

From: Ross
Subject: Re: Errors in Povray's CSG???
Date: 10 Dec 2004 14:44:44
Message: <41b9fcac$1@news.povray.org>
"Christoph Hormann" <chr### [at] gmxde> wrote in message
news:cpc146$5e7$1@chho.imagico.de...
> Captain Chemistry wrote:
> >
> > Can anyone give an explanation???
> >
> > I accept that the following may be true:
> > * my computer is jibbed and everyone else's works
> > * I have misunderstood set theory and/or povray CSG
> > * I have understood both set theory and povray CSG correctly but I have
> > misunderstood how to merge the two concepts (pun intended!)
>
> It is probably:
>
> * You did not read the manual which is completely obvious because you
> would not have mistaken union as a CSG operation then.
>

Hi Christoph,

forgive me for asking what you mean by "you would not have mistaken union as
a CSG operation"? the documentation says "There are four basic types of CSG
operations: union, intersection, difference, and merge." then goes on to
explain Union as a CSG operation in 3.3.6.2.

So i'm confused (easily done, admittedly). Maybe you mean that union isn't
limited to solid geometry, as explained in the sentence, "Therefore any
objects may be combined using union but only solid objects, i.e. objects
that have a well-defined interior can be used in the other kinds of CSG"
(found in the last paragraph of 3.3.6.1).

-ross


Post a reply to this message

From: Christoph Hormann
Subject: Re: Errors in Povray's CSG???
Date: 10 Dec 2004 15:45:01
Message: <cpd1k4$pfv$1@chho.imagico.de>
Ross wrote:
> 
> forgive me for asking what you mean by "you would not have mistaken union as
> a CSG operation"? the documentation says "There are four basic types of CSG
> operations: union, intersection, difference, and merge." then goes on to
> explain Union as a CSG operation in 3.3.6.2.

The documentation is quite sparse in that section but still it should be 
obvious that union is something quite different to merge, intersection 
and difference - it just groups the object but does not change the way 
they are rendered.  But indeed the docs could explain this in more 
detail since it is quite important - there also is a FAQ entry about it:

http://tag.povray.org/povQandT/miscQandT.html#csgspeed

Christoph

-- 
POV-Ray tutorials, include files, Sim-POV,
HCR-Edit and more: http://www.tu-bs.de/~y0013390/
Last updated 23 Sep. 2004 _____./\/^>_*_<^\/\.______


Post a reply to this message

From: Captain Chemistry
Subject: Re: Errors in Povray's CSG???
Date: 10 Dec 2004 16:35:01
Message: <web.41ba15686a3448cceac8f2b10@news.povray.org>
Mike Williams <nos### [at] econymdemoncouk> wrote:
> It appears to be a bounding bug.
>
> If you switch bounding off, ("-MB" in the command line) then the POV
> results match what you'd expect from set theory. So the POV code doing
> the actual intersection, union and inversion code is working as you
> would expect but the automatic bounding is chopping bits off.
>
> The bit that goes
>
>  union
>  {
>   object{C}
>   object{B inverse}
>  }
>
> seems to have its bounding inverted, giving it finite bounds instead of
> infinite bounds. That would be fine if that were the top level of the
> CSG, but when it's part of an intersection the infinite part is really
> needed.
>
> --
> Mike Williams
> Gentleman of Leisure

Mike, that worked perfectly!!! Well done!

I clearly have much to learn about povray and I am thankful for the help
others give me.

Nathan


Post a reply to this message

From: Captain Chemistry
Subject: Re: Errors in Povray's CSG???
Date: 10 Dec 2004 16:40:00
Message: <web.41ba16c76a3448cceac8f2b10@news.povray.org>
Christoph Hormann <chr### [at] gmxde> wrote:
> The documentation is quite sparse in that section but still it should be
> obvious that union is something quite different to merge, intersection
> and difference - it just groups the object but does not change the way
> they are rendered.  But indeed the docs could explain this in more
> detail since it is quite important - there also is a FAQ entry about it:
>
> http://tag.povray.org/povQandT/miscQandT.html#csgspeed
>
> Christoph

Thanks Christoph!

Part of what the FAQ entry says is:

"In this type of cases POV-Ray makes a huge bounding box which is useless.
You should bound this kind of objects by hand (specially when the it has
lots of member objects). This can be done with the bounded_by keyword."

....which is what I think I need to do.

Thankyou for your help.

Nathan


Post a reply to this message

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