Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Vertex list of a surface not readily accessible

While preparing my answer to this question, I have been searching how to retrieve faces and vertices from a explicit surface plotted with plot3d. There is a fact that confuses me. Consider this code:

sage: surf = plot3d(lambda x,y: sin(x*y), (-pi,pi), (-pi,pi))
sage: len(surf.vertex_list())
0

This means that surf.vertex_list() is an empty list. However:

sage: surf = plot3d(lambda x,y: sin(x*y), (-pi,pi), (-pi,pi))
sage: show(surf)
Launched html viewer for Graphics3d Object
sage: len(surf.vertex_list())
1600

Now surf.vertex_list() is not an empty list and the vertices can be retrieved. So I wonder what show(surf) internally does so that the vertices list becomes accessible. To avoid plotting the surface, I have found that I can replace show(surf) by surf.triangulate(), but I also wonder if there is a best option.