5
|
5505 Views
|
4 Replies
|
9 Total Likes
View groups...
Share
GROUPS:

# Using Convex Hulls in 3D

Posted 10 years ago
 A few Demonstrations using ConvexHull3D no longer work. It was an undocumented feature of previous versions, and isn't in Version 10. So, how to do the same thing in version 10? initpts = Union[N[Flatten[{Table[{Sin[x],Cos[x],0}, {x,0,2 Pi,2 Pi/50}], Table[{Sin[x],0,Cos[x]} + {2,0,0}, {x,0, 2 Pi, 2 Pi/50}]}, 1]]]; meshobject = ConvexHullMesh[initpts]; pts = MeshCoordinates[meshobject]; polys = MeshCells[meshobject, 2]; Graphics3D[{EdgeForm[], GraphicsComplex[pts, polys]}, Boxed -> False, SphericalRegion -> True, ImageSize -> {400, 400}]  The variables pts and polys are the vital items for GraphicsComplex. Attachments:
4 Replies
Sort By:
Posted 10 years ago
 It is in the documentation on ConvexHullMesh. Applying to your case: initpts = Union[N[Flatten[{Table[{Sin[x], Cos[x], 0}, {x, 0, 2 Pi, 2 Pi/50}], Table[{Sin[x], 0, Cos[x]} + {2, 0, 0}, {x, 0, 2 Pi, 2 Pi/50}]}, 1]]]; ConvexHullMesh[initpts] 
Posted 10 years ago
 Sam, yes, you can get that picture -- but you can't put Graphics3D options on it. You can't use SphericalRegion -> True, for example. I wrote up this note for people that want to extract the polygons from ConvexHullMesh.
Posted 10 years ago
 Ahh, I misunderstood. Well thanks for that code - I see now that it is very useful.
Posted 10 years ago
 You can get a GraphicsComplex with ConvexHullMesh[initpts]["GraphicsComplex"] or get graphics with  ConvexHullMesh[initpts]["Graphics3D"] (You can get many such things. See ConvexHullMesh[initpts]["Properties"].)