Ask Your Question
1

Vertex list of a surface not readily accessible

asked 2020-05-28 15:58:33 +0100

Juanjo gravatar image

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.

edit retag flag offensive close merge delete

1 Answer

Sort by » oldest newest most voted
1

answered 2020-05-28 20:53:27 +0100

FrédéricC gravatar image

The ".triangulate" method does the real job of creating the triangulation. Before it is called, there is no vertex and no triangle.

edit flag offensive delete link more

Comments

So show calls the .triangulate method while rendering the surface. I have not been able to track down how that happens exactly. Anyway, I see that the code in the other question is essentially correct. @FrédéricC, many thanks for your comment.

Juanjo gravatar imageJuanjo ( 2020-05-28 22:16:00 +0100 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower

Stats

Asked: 2020-05-28 15:58:33 +0100

Seen: 237 times

Last updated: May 28 '20