| 
|  |  |  
|  |  |  |  |  |  |  |  |  |  |  
|  |  |  |  |  |  |  |  |  |  |  
|  |  | 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'
  
 |  |  |  |  |  |  |  |  
|  |  |  |  |  |  |  |  |  |  |  
|  |  | 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
 |  |  |  |  |  |  |  |  
|  |  |  |  |  |  |  |  |  |  |  
|  |  | clipka <ano### [at] anonymous org> 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
 |  |  |  |  |  |  |  |  
|  |  |  |  |  |  |  |  |  |  |  
|  |  | "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'
  
 |  |  |  |  |  |  |  |  
|  |  |  |  |  |  |  |  |  |  |  
|  |  | 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
 |  |  |  |  |  |  |  |  
|  |  |  |  |  |  |  |  |  |  |  
|  |  | clipka <ano### [at] anonymous org> 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
 |  |  |  |  |  |  |  |  
|  |  |  |  |  |  |  |  |  |  |  
|  |  | "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'
  
 |  |  |  |  |  |  |  |  
|  |  |  |  |  |  |  |  |  |  |  
|  |  | 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
 |  |  |  |  |  |  |  |  
|  |  |  |  |  |  |  |  |  |