POV-Ray : Newsgroups : povray.binaries.images : CSG merge/union test Server Time
4 Nov 2024 17:33:58 EST (-0500)
  CSG merge/union test (Message 1 to 8 of 8)  
From: StephenS
Subject: CSG merge/union test
Date: 12 Jun 2010 11:35:01
Message: <web.4c13a8b6bda1e33d1fbc8ec90@news.povray.org>
In an attempt to model a glass food container with locking lid, I can across the
following behaviour.

There is a different result when useing merge or union in the following scene,
which I was not expecting. I think it comes down to this setup which contains a
co-incident surface.

intersection {
 merge {        // union
  difference { }
  difference { }
 }
 box { }
}

Removing the co-incident surface fixes the problem, but why is there a problem
to begin with? Useing a difference{} with two boxes instead of the intersection
did not change the result.

A full scene:

background { color rgb <1.000,1.000,1.000> }

#declare Gray_85_ =
texture {
 pigment {
  color rgbft <0.850,0.850,0.850,0.000,0.000>
 }
}

camera {
 perspective
 location <1.814,4.257,-13.213>
 up y
 right 1.333*x
 angle 11.731
 sky <-0.041,0.953,0.301>
 look_at < 0.000, -0.000, 0.000 >
}

light_source {
 < 0.000000, 0.000000, 0.000000 >, color rgb <1.000,1.000,1.000>
 fade_power 0.000
 fade_distance 100.000
 media_attenuation off
 media_interaction on
 translate <8.125000,6.250000,-2.656250>
}

intersection {
 merge {                                       // union // merge
  difference {  // Tube3
   cylinder {-0.5625000*y,0.5625000*y,1.075}
   cylinder {-1.5625000*y,1.5625000*y,0.925}   // .925
   translate <0.000000,-0.562500,0.000000>
  }

  difference {  // Tube0
   cylinder {-0.0900000*y,0.0900000*y,1.235}
   cylinder {-1.0900000*y,1.0900000*y,0.925}   // .925  // .926
   translate <0.000000,-0.200000,0.000000>
  }

 }

 box {
  < -0.6500000, -0.7500000, -0.6500000 >, < 0.6500000, 0.7500000, 0.6500000 >
  translate <-0.650000,-0.625000,0.650000>
 }
 texture{ Gray_85_ }
}

In the following picture;
 the corner of the soon to be glass container,
 useing union,
 useing merge.

The fix for the problem is to change the second tube object to avoid the
co-incident surface.

Why is there a difference between a union and merge in this scene?


Post a reply to this message


Attachments:
Download 'test_csg_merge_union.png' (34 KB)

Preview of image 'test_csg_merge_union.png'
test_csg_merge_union.png


 

From: clipka
Subject: Re: CSG merge/union test
Date: 12 Jun 2010 13:17:02
Message: <4c13c10e$1@news.povray.org>
Am 12.06.2010 17:33, schrieb StephenS:

> Why is there a difference between a union and merge in this scene?

Essentially, POV-Ray's "merge" works by ignoring all intersections that 
lie inside other CSG members.

Note that this applies to /all/ intersections, including the very first 
one. So in case of coincident surfaces, it all boils down to whether 
POV-Ray considers the surface of an object to be part of its inside: In 
that case, any intersection point on the coincident surface with member 
A is considered "inside" member B and vice versa, so both intersection 
points are discarded. Add the problem of precision to this, and you know 
that you're generally screwed.

For some objects - e.g. cylinders - there's good news: The algorithm to 
find an intersection point and the algorithm to test whether a point is 
inside go together pretty well, so that the surface of a cylinder seems 
to /always/ be considered "outside" the cylinder.

The bad news is that when differencing away a cylinder from some other 
object, the surface of the cut-away cylinder is /always/ considered 
"outside" the cylinder, and thus "inside" the resulting CSG object. Have 
two such CSG difference objects with coinciding surfaces, and you get 
the aforementioned problem that the surface of A is considered inside B 
and vice versa, and therefore to be discarded in a merge.


Post a reply to this message

From: StephenS
Subject: Re: CSG merge/union test
Date: 12 Jun 2010 14:20:01
Message: <web.4c13cedc2c8ab722e7c0d8760@news.povray.org>
clipka <ano### [at] anonymousorg> wrote:
> Am 12.06.2010 17:33, schrieb StephenS:
>
> > Why is there a difference between a union and merge in this scene?
>
> Essentially, POV-Ray's "merge" works by ignoring all intersections that
> lie inside other CSG members.
....
Thank you, will need to think on this some more.

Stephen S


Post a reply to this message

From: StephenS
Subject: Re: CSG merge/union test
Date: 12 Jun 2010 14:25:01
Message: <web.4c13d0b82c8ab722e7c0d8760@news.povray.org>
"StephenS" <nomail@nomail> wrote:
> In an attempt to model a glass food container with locking lid, I can across the
> following behaviour.
.....
Merge{} is not helping me if I use difference{} inside to make some of the
parts. I can remove some of the internal surfaces, but not all.

Will start to look into lathe{bezier_spline}} and prism{bezier_spline}} with
merge{} holding no other CSG's.

Stephen S


Post a reply to this message


Attachments:
Download 'glass_container_pair.png' (111 KB)

Preview of image 'glass_container_pair.png'
glass_container_pair.png


 

From: clipka
Subject: Re: CSG merge/union test
Date: 12 Jun 2010 15:40:17
Message: <4c13e2a1$1@news.povray.org>
Am 12.06.2010 20:24, schrieb StephenS:
> "StephenS"<nomail@nomail>  wrote:
>> In an attempt to model a glass food container with locking lid, I can across the
>> following behaviour.
> .....
> Merge{} is not helping me if I use difference{} inside to make some of the
> parts. I can remove some of the internal surfaces, but not all.
>
> Will start to look into lathe{bezier_spline}} and prism{bezier_spline}} with
> merge{} holding no other CSG's.
>
> Stephen S

I'd suggest

   difference {
     merge {
       /* individual primitive objects comprising the basic shape */
     }
     union {
       /* individual primitive objects to be cut away */
     }
   }

or simply

   difference {
     merge {
       /* individual primitive objects comprising the basic shape */
     }
     /* individual primitive objects to be cut away */
   }


Post a reply to this message

From: StephenS
Subject: Re: CSG merge/union test
Date: 14 Jun 2010 06:45:01
Message: <web.4c16070b2c8ab7227ff7427f0@news.povray.org>
clipka <ano### [at] anonymousorg> wrote:
> I'd suggest
>
>    difference {
>      merge {
>        /* individual primitive objects comprising the basic shape */
>      }
>      union {
>        /* individual primitive objects to be cut away */
>      }
>    }
>
> or simply
>
>    difference {
>      merge {
>        /* individual primitive objects comprising the basic shape */
>      }
>      /* individual primitive objects to be cut away */
>    }

Thanks,
difference {
 merge{}
 union{}
}
is giveing me some good results. Use of translate, .000001, is helping to avoid
co-incident surface, the other major problem in this progect. Will post a
picture after some more progress.

Stephen S


Post a reply to this message

From: StephenS
Subject: Re: CSG merge/union test
Date: 20 Jun 2010 21:55:01
Message: <web.4c1ec5d52c8ab72228c9b7e20@news.povray.org>
"StephenS" <nomail@nomail> wrote:
> Thanks,
> difference {
>  merge{}
>  union{}
> }
> is giveing me some good results. Use of translate, .000001, is helping to avoid
> co-incident surface, the other major problem in this progect. Will post a
> picture after some more progress.
>
> Stephen S

Update;
Some more work to do on the top inside edge, and some text on the bottom.
Will then be ready for the top.

Stephen S


Post a reply to this message


Attachments:
Download 'food_containers_0000.png' (217 KB)

Preview of image 'food_containers_0000.png'
food_containers_0000.png


 

From: Stephen
Subject: Re: CSG merge/union test
Date: 21 Jun 2010 01:21:34
Message: <4c1ef6de$1@news.povray.org>
On 21/06/2010 2:52 AM, StephenS wrote:
> Update;
> Some more work to do on the top inside edge, and some text on the bottom.
> Will then be ready for the top.
>

This is good news for me. I had the same problem when making my Tardis 
dematerialise. It might work now without showing all the internal edges.

-- 

Best Regards,
	Stephen


Post a reply to this message

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