import numpy as np
import matplotlib.pyplot as plt
import s3dlib.surface as s3d
# Surface Elements.
# 2. Setup and map surface .........................................
surface = s3d.SphericalSurface.platonic(0,'dodeca',color='c')
# 3. Construct figure, add surface plot ............................
fig = plt.figure(figsize=plt.figaspect(1))
fig.text(0.025,0.025,str(surface),ha='left', va='bottom',fontsize='smaller')
minmax=(-0.9,0.9)
ax = plt.axes(projection='3d', aspect='equal')
ax.set(xlim=minmax, ylim=minmax, zlim=minmax)
ax.set_axis_off()
ax.view_init(38,-54)
ax.scatter(*surface.vertices,color='m',label='vertices')
ax.scatter(*surface.facecenters,color='y',label='face centers')
ax.scatter(*surface.edges.segmentcenters,color='c',label='edge centers')
ax.add_collection3d(surface.vertexnormals(scale=0.3,color='g'))
ax.add_collection3d(surface.facenormals(scale=0.3,color='r'))
ax.add_collection3d(surface.edges.fade(0,ax=ax))
ax.legend(fontsize='x-small')
ax.add_collection3d(surface.set_surface_alpha(0.1).shade())
fig.tight_layout()
plt.show()