canvas3d: displaying labels on axes and more
Is there a way to show the labels and numbers on the axes when plotting wireframe polygons in canvas3d? (so that the display is more like Jmol) So far I've managed the axes to be shown but there are no labels and there is no benefit from displaying it.
Also, I'm trying to make sage print the coordinates of the vertices of the selected facet... this code displays "'_PolytopeFace' object is not callable" error. I need sage to print the coordinates so that I can use this to plot tiny spheres at the vertices (as canvas3d doesn't allow you to print points...). Is there a more efficient way of going about it?
Thank you
P = LatticePolytope([[1,2,3,4],[5,2,5,6],[2,2,5,2],[-3,-2,-5,-1],[-2,-2,-2,-1]])
from sage.geometry.polyhedron.plot import ProjectionFuncStereographic
r=7
facets = P.faces()[3]
@interact
def _(theta_one = slider(0,2*pi,pi/20, default = pi/4, label="theta_one"),
theta_two = slider(0,2*pi,pi/20, default = pi/4, label="theta_two"),
phi = slider(0,2*pi,pi/20, default = pi/4, label="phi"),
u = slider(0, P.nfacets()-1, step_size=1, default=None, label="Nominate a facet")):
a=r*sin(theta_one)*sin(theta_two)*cos(phi)
b=r*sin(theta_one)*sin(theta_two)*sin(phi)
c=r*sin(theta_one)*cos(theta_two)
d=r*cos(theta_one)
proj = ProjectionFuncStereographic([a,b,c,d])
projected_vertices = [proj(v) for v in P.vertices().columns()]
faces = P.faces()[2]
faces_as_vertex_lists = [[projected_vertices[n] for n in face.traverse_boundary()] for face in faces]
scene = Graphics()
for vert_list in faces_as_vertex_lists:
scene = scene + polygon3d(vert_list, color='blue')
scene.show(viewer='canvas3d', axes=True, )
ff = facets[u]
print ff
selected_v = [ff(i) for i in projected_vertices]
print selected_v
Actually, nevermind- I've solved the error but I still don't know about the axes... is there a way to put labels?
If you figured out how to solve it, please put your solution as an answer so others will be able to benefit from it!
As to the axes, my sense is that there probably is a way to do it but that we haven't wrapped it. You could try placing 3d text objects at specific positions and see if they work.