POV-Ray : Newsgroups : povray.advanced-users : Errors in Povray's CSG??? : Errors in Povray's CSG??? Server Time
28 Jul 2024 16:19:17 EDT (-0400)
  Errors in Povray's CSG???  
From: Captain Chemistry
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

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