Re: clip polyhedron mesh [message #90986 is a reply to message #90972] |
Wed, 20 May 2015 11:39   |
Dick Jackson
Messages: 347 Registered: August 1998
|
Senior Member |
|
|
Hi Guni,
On Tuesday, 19 May 2015 10:51:48 UTC-7, guni wrote:
> Dear all,
> I have a 3-dimensional polyhedron mesh where two polyhedrons are overlapped. I want to clip the polyhedron to make new polyhedrons where one portion belong the overlapping region and other non-overlapping region. If somebody knows how to do this, please let me know.
First, it's a much simpler problem if you know you're working with *convex* polyhedra.
A Google search on [intersection of convex polyhedra algorithm] shows that at least *somebody* knows how to do this. :-) For example:
"Finding the intersection of two convex polyhedra" from 1977:
http://www.sciencedirect.com/science/article/pii/03043975789 00518
There are lengthy algorithms that might take a lot of work to implement. Some even give solutions for intersecting convex and non-convex polyhedra.
> 2nd option:I saw IDL's 'mesh_clip' but it is a clip using a planar surface. I dont prefer to clip using a plane, but in case if I have to use it, how I can get the coordinates of the overlapping portion?
Something like this came up some time ago, and it may be the easiest way to go (assuming convex polyhedra). If you use each polygon from mesh 1 as a clipping plane into mesh 2 (and keep the correct piece each time!), when you're done, you'll be left with the intersection. This link includes another link to a useful example:
https://groups.google.com/forum/#!searchin/comp.lang.idl-pvw ave/intersection$20polyhedron/comp.lang.idl-pvwave/qAvnBjaws oY/JaiOeUS3KpoJ
> 3rd option: I also saw some discussions like polygon union/intersection ( https://groups.google.com/forum/#!searchin/comp.lang.idl-pvw ave/polygon$20intersection/comp.lang.idl-pvwave/uVpIUkvt-94/ Sd3NwjH-BxEJ) where Mati Maeron suggested shape_overlap.pro. But I canot find his libarry and the script. I checked in this link http://www.astro.washington.edu/docs/idl/htmlhelp/slibrary23 .html. Does anyone know where I can get his library and script?
I haven't tracked it down, but I'm guessing that those discussions are about polygons in 2-D, not polyhedra in 3-D.
I hope this helps!
Cheers,
-Dick
Dick Jackson Software Consulting Inc.
Victoria, BC, Canada --- http://www.d-jackson.com
P.S.: This was a nice example you gave:
> Anyway my script/polyhedron is something like this. Dick helped me to create polyhedrons, but here I used iplot, and ipolygon.
>
> ;;1st polyhedron
> x=randomu(seed,4)
> y=randomu(seed,4)
> z=randomu(seed,4)
> xyz=[transpose(x),transpose(y),transpose(z)]
> iPLOT,xyz,LINESTYLE=6,AXIS_STYLE=2,identifier='1'
> QHULL,xyz,Vert
> conn=[REPLICATE(3,[1,N_ElEMENTS(Vert)/3]),Vert]
> iPOLYGON,xyz,/DATA,CONNECTIVITY=conn,visualization='1',trans parency=50,/FILL_BACKGROUND,FILL_COLOR='SKY BLUE'
>
> ;;2nd polyhedron
> x=randomu(seed,12)
> y=randomu(seed,12)
> z=randomu(seed,12)
> xyz=[transpose(x),transpose(y),transpose(z)]
> iPLOT,xyz,LINESTYLE=6,/OVERPLOT,identifier='2'
> QHULL,xyz,Vert
> conn=[REPLICATE(3,[1,N_ElEMENTS(Vert)/3]),Vert]
> iPOLYGON,xyz,/DATA,CONNECTIVITY=conn,visualization='2',trans parency=50,/FILL_BACKGROUND,FILL_COLOR='red'
>
> Thanks,
> Guni
|
|
|