MeshCat.jl
MeshCat.jl copied to clipboard
Plotting curves
First of all, MeshCat.jl is awesome! Great job! Second, if possible, I would like some tip to build a curve in R^3. For example, considering the equation (x-1)^2+(y-1)^2+z^2-4+5x-3y-z-2 x=0 (I know, it is the intersection of a sphere with a plan) or any other implicit curve, how can I plot this curve?
I am not sure how to go about converting an implicit curve (like the one you wrote) into a set of points that you can then use for rendering the curve in MeshCat.
But here's an example of how to render an explicit function, e.g., f(x) = x^2:
using Colors
using MeshCat
vis = Visualizer()
open(vis)
f(x) = x^2
points = [[x, 0, f(x)] for x = -1:0.1:1]
pointcloud = PointCloud(points)
material = LineBasicMaterial(color=colorant"yellow", linewidth=2)
setobject!(vis["line"], Object(pointcloud, material, "Line"))