MCPcopy Create free account
hub / github.com/Image-Py/imagepy / build_ball

Function build_ball

imagepy/core/myvi/util.py:66–76  ·  view source on GitHub ↗
(o, r, c=(1,0,0))

Source from the content-addressed store, hash-verified

64 return vts, fs, ns, cs
65
66def build_ball(o, r, c=(1,0,0)):
67 ay, ax = np.mgrid[-pi/2:pi/2:9j, 0:pi*2:17j]
68 zs = np.sin(ay.ravel())
69 xs = np.cos(ax.ravel()) * np.cos(ay.ravel())
70 ys = np.sin(ax.ravel()) * np.cos(ay.ravel())
71 ns = np.vstack((xs, ys, zs)).astype(np.float32).T
72 vts = (ns * r + o).astype(np.float32)
73 fs = build_grididx(9, 17)[2]
74 cs = (np.ones((len(vts), 3))*c).astype(np.float32)
75 #print(ns2)
76 return vts, fs, ns, cs
77
78def build_mesh(xs, ys, zs, c=(1,0,0)):
79 rs, cs, fs = build_grididx(xs.shape[0], xs.shape[1])

Callers 1

build_ballsFunction · 0.85

Calls 1

build_grididxFunction · 0.85

Tested by

no test coverage detected