meshcat-dev / meshcat-python

WebGL-based 3D visualizer for Python
MIT License
258 stars 63 forks source link

Draw line given 3d points #113

Open arjung128 opened 2 years ago

arjung128 commented 2 years ago

Hi, is it possible to draw a line connecting a sequence of 3d points? Thanks!

kielnino commented 1 year ago

I use normally something like this:

import meshcat
import meshcat.geometry as g

points = [List of 3d points]
color = 0xffffff

vis = meshcat.Visualizer()

l = g.Line(
    geometry=g.PointsGeometry(position=np.array(points).astype(np.float32).T),
    material=g.LineBasicMaterial(color=color)
)
vis.set_object(geometry=l)