rdeits / MeshCat.jl

WebGL-based 3D visualizer in Julia
MIT License
234 stars 43 forks source link

Draw PolyLine #87

Closed Affie closed 5 years ago

Affie commented 5 years ago

Is there a PolyLine that draws a continuous line. Like LineSegments, but connecting everything.

rdeits commented 5 years ago

Yes, I think that's supported in threejs, so we'd just need to expose it in MeshCat. Until then, you can still construct one through the basic MeshCat.Object constructor:

using MeshCat, GeometryTypes
coordinates = [Point(0., 0, 0), Point(1., 0, 0), Point(1., 1., 0)]
vis = Visualizer()
setobject!(vis, Object(PointCloud(coordinates), LineBasicMaterial(), "Line"))

Likewise, you should be able to create a line loop by changing "Line" to "LineLoop". That string just needs to match the name of the Three.js class you want to create (like https://threejs.org/docs/index.html#api/en/objects/Line or https://threejs.org/docs/index.html#api/en/objects/LineSegments ).

It should also be easy to add some helper methods to make creating lines less verbose.

Affie commented 5 years ago

thank you