2 ms·
I use a very simple and exact O(N) algorithm to calculate mass properties of polyhedrons without computing convex hulls or anything: http://www.cs.berkeley.edu
by tlb 18y ago
I use a very simple and exact O(N) algorithm to calculate mass properties of polyhedrons without computing convex hulls or anything:
http://www.cs.berkeley.edu/~jfc/mirtich/massProps.html http://www.cs.berkeley.edu/~jfc/mirtich/massProps.html
Maybe 80 LOC. I'm not sure why anything more complex is needed.
PhysX does seem promising.
- palish 18y agoYeah, that works. I mentioned computing convex hulls because I wasn't sure whether your CAD program exports "manifold" meshes, that is, closed polygonal meshes where each edge is connected to exactly two faces. When a mesh is manifold, it is possible to compute whether a point in space lies within or outside of the mesh, for example. It is also possible to compute the mesh's mass properties. In the video game industry, artists create models with techniques that are much less precise than CAD techniques, and so non-manifold meshes are very common, which makes them difficult to analyze in physical ways. The solution to that problem is to decompose the mesh into a set of convex hulls, then analyze the convex hulls. The other reason I mentioned convex hull computation is because PhysX can only simulate dynamic actors that are composed of boxes, spheres, capsules, and convex hulls, IIRC. Arbitrary polygon meshes aren't supported for dynamic actors, because they are very difficult to simulate in realtime. So if you wanted to use PhysX for dynamics simulations, you would probably need to decompose your model into a set of convex hulls. Good luck -- if you need any assistance with PhysX, feel free to contact me at shawnpresser@gmail.com.