Messages from Usenet group comp.lang.idl-pvwave, compiled by Paulo Penteado
Re: How to compute the merged volume of two 3D objects
I think you're going to have to do this the hard way. As you have found, MESH_MERGE in its most basic form simply combines the two vertex and polygon arrays and MESH_VOLUME still computes the volume for the two "solid" polygons. You need to combine the vertices and find the equilibrium surface. If your combined objects are convex, you could possibly use QHULL to create the convex hull of the combined vertices. I have to admit that I haven't done this and after playing around with it briefly I really have no idea *how* to use QHULL to do this. If anyone wants to share... If you need to handle concave objects then you'll need to step outside IDL. If you're lucky you will find a library that contains functions to do this and you would simply need to write a DLM wrapper. (I would think that there has been a lot of work developing algorithms to do this but a couple of quick searches brings up very little of interest). If you come up empty then you're in for a bit of work. In this case I would forget MESH_VOLUME because its requirement of a "solid" polygon makes this task much more difficult. Off the top of my head, I would try a plane sweep approach where you integrate the combined area formed by the intersection of a plane and your two objects as the plane sweeps across them. Calculating the area of the plane+objects would take some thought but (at least for me) it is a far more tractable problem. Look at QHULL first, it may work and save you a lot of time. Otherwise, good luck! -Rick yingjie, Peng wrote: > Dear all, > > If I want to compute the merged volume of two 3D objects, for instance > a overlapped sphere and cube, I first use MESH_MERGE to merge the > polygonal meshes of the two objects and then use MESH_VOLUME to get > the merged volume. > > The problem is that I found the MESH_MERGE, if I am right, just > simply put together the vertices and connectivity of the two objects > and did not do any real mergence of the overlapped vertices. > Therefore, the volume I got after applied MESH_MERGE, still equel to > Volume1 + Volume2 and not the merged volume. > > Is there any good idea how to compute the merged volume, or I have to > "manually" get rid of the overlapped vertices and rewrite the > connectivity array...? > > Any idea or suggestion would be greatly appreciated. > > Cheers, > yingjie