Dodecahedron StarΒΆ

../../_images/star1.png

One of the platonic solids with the surface depressions accentuated using a monotonically increasing Lab colormap.

../../_images/star_cmap.png

The overall geometric shape was further intensified by shading and highlighting the surface.

import numpy as np
import matplotlib.pyplot as plt
import s3dlib.surface as s3d
from s3dlib.cmap_xtra import Lab_cmap_gradient

#.. Dodecahedron star burst

# 1. Define functions to examine ....................................

def burst(rtp) :
    r,t,p = rtp
    return np.power(r,10)+0.25, t,p

# 2. Setup and map surfaces .........................................
rez,illum = 7, [1,-0.25,0.25]
cmap = Lab_cmap_gradient('magenta','crimson',name='mag_crim')

surface = s3d.SphericalSurface.platonic(rez,'dodeca',cmap=cmap)
surface.map_cmap_from_op(lambda rtp : rtp[0])
surface.map_geom_from_op(burst)

# 3. Construct figure, add surfaces, and plot ......................
minmax=(-.8,0.8)
fig = plt.figure(figsize=plt.figaspect(1))
fig.text(0.975,0.975, str(surface), ha='right', va='top', fontsize='small')
ax = plt.axes(projection='3d', aspect='equal')
ax.set(xlim=minmax, ylim=minmax, zlim=minmax)
ax.view_init(elev=-5, azim=-50)
ax.set_axis_off()

ax.add_collection3d(surface.shade(0.3,direction=illum).hilite(.5,direction=illum))

fig.tight_layout()
plt.show()