I'd like to generate triangular meshes or a cylinder and sphere primitives as part of a lattice meshing program I am writing to experiment with Mathematica. Consider the following snippet:
{p1, p2, r} = {{-1, 0, 0}, {1, 2, 1}, 0.5};
BoundaryDiscretizeGraphics[Cylinder[{p1, p2}, r]]
FullForm[%]
BoundaryDiscretizeGraphics[Sphere[p1, r], MaxCellMeasure -> 0.01]
FullForm[%]
I have 2 questions
For the sphere: How can I extract the coordinates and connectivities I can see in the output of the second
FullFormcall into separate list of vertices and connectivities. I guess I need to do some magic to extract correct parts of the expression.For the cylinder: How can I convert the polygons defining the caps and the quadrilaterals around the body into triangles and then extract the triangles into vertices and connectivity lists as for the cylinder






MaxCellMeasure, the cylinder remains untriangulated... – J. M.'s missing motivation Nov 09 '15 at 23:09BoundaryDiscretizeGraphicsdoesn't triangulate flat surfaces (in contrast toDiscretizeGraphics). It is simply unnecessary for boundary approximation. – ybeltukov Nov 09 '15 at 23:28MeshCoordinates[]andMeshCells[]. – J. M.'s missing motivation Nov 10 '15 at 01:55Position[...,Heads->True]andPart[...], this is much easier though, thanks! – mkm Nov 10 '15 at 07:32