How to use the meshcat.geometry.LineSegments function in meshcat

To help you get started, we’ve selected a few meshcat examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github RobotLocomotion / spartan / modules / spartan / perception / tabletop_segmenter.py View on Github external
colors = plt.cm.rainbow(curv)
    elif color is not None:
        colors = np.tile(color[0:3], [points.shape[1], 1]).T
    else:
        colors = np.zeros(points.shape) + 1.
    vis["perception"]["tabletopsegmenter"][name].set_object(
        meshcat_g.PointCloud(position=points, color=colors, size=size))
    if with_normals:
        normals = vtkNumpy.getNumpyFromVtk(polyData, "Normals").T
        colors = np.tile([1., 0., 0.], [points.shape[1], 1]).T
        segments = np.zeros((3, normals.shape[1]*2))
        for k in range(normals.shape[1]):
            segments[:, 2*k] = points[:, k]
            segments[:, 2*k+1] = points[:, k] + normals[:, k]*0.05
        vis["perception"]["tabletopsegmenter"][name]["normals"].set_object(
            meshcat_g.LineSegments(position=segments,
                                   color=colors, linewidth=size/2.))