rdeits / MeshCat.jl

WebGL-based 3D visualizer in Julia
MIT License
233 stars 42 forks source link

Is it possible to draw curves? #253

Closed davibarreira closed 4 months ago

davibarreira commented 4 months ago

In three.js, I see that it is possible to draw curves, such as Beziers and Nurbs. Moreover, one can even draw curved surfaces. I was wondering if there is a way to do this using meshcat.

ferrolho commented 4 months ago

Hi Davi, you can draw curved lines (see this comment and an example here) and contours as well (see the README example).

davibarreira commented 4 months ago

Thanks for the answer @ferrolho . If I understood, is your solution for curved lines to divide in several line segments? I was looking for Bezier curves and the like.

ferrolho commented 4 months ago

Yes, you understood correctly — I sample a few points along the curved line I want to display, and then display it. It seems three.js supports quadratic bezier curves (see https://threejs.org/docs/#api/en/extras/curves/QuadraticBezierCurve), but I don't think this feature is exposed in MeshCat.jl. If you give it a go, please feel free to open a PR. Thanks!

davibarreira commented 4 months ago

Thanks, I'll try to do so.

davibarreira commented 4 months ago

@ferrolho , the implementation of curves should be done on MeshCat.jl or on the original meshcat library?