Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
colors = [colors for v in vertices]
else:
colors = np.asarray(colors)
if (colors.shape == (sheet.Nv, 3)) or (colors.shape == (sheet.Nv, 4)):
sheet.vert_df["hex_c"] = [mpl_colors.rgb2hex(c) for c in colors]
srce_c = sheet.upcast_srce(sheet.vert_df["hex_c"])
trgt_c = sheet.upcast_trgt(sheet.vert_df["hex_c"])
colors = np.vstack([srce_c.values, trgt_c.values]).T.reshape(
vertices.shape[0]
)
colors = list(colors)
else:
raise ValueError
linesgeom = py3js.PlainGeometry(vertices=[list(v) for v in vertices], colors=colors)
return py3js.Line(
geometry=linesgeom,
material=py3js.LineBasicMaterial(
linewidth=spec["edge"]["width"], vertexColors="VertexColors"
),
type="LinePieces",
)
material = p3js.LineBasicMaterial(color=color, linewidth=4)
scene_children = []
# For each 24 joint
if links is None:
links = [
(0, 1, 2, 3, 4),
(0, 5, 6, 7, 8),
(0, 9, 10, 11, 12),
(0, 13, 14, 15, 16),
(0, 17, 18, 19, 20),
]
for link in links:
for j1, j2 in zip(link[0:-1], link[1:]):
geometry = p3js.Geometry(vertices=joints3D[(j1, j2), :].tolist())
line = p3js.Line(geometry, material)
scene_children.append(line)
return scene_children
w = ray.wavelength
rc, gc, bc = wavelength2RGB(w)
rc=int(255*rc)
gc=int(255*gc)
bc=int(255*bc)
material = py3js.LineBasicMaterial(color = "#{:02X}{:02X}{:02X}".format(rc,gc,bc))
rl = ray2list(ray)
for r in rl:
geometry = py3js.Geometry()
geometry.vertices = r
line = py3js.Line( geometry, material)
rays.add(line)
return rays
def lines_children(origins, targets, color="blue"):
material = p3js.LineBasicMaterial(color=color, linewidth=4)
scene_children = []
# For each 24 joint
for origin, target in zip(origins, targets):
geometry = p3js.Geometry(vertices=np.array([origin, target]).tolist())
line = p3js.Line(geometry, material)
scene_children.append(line)
return scene_children