jared-hughes / DesThree

Desmos bindings for three.js
4 stars 0 forks source link

Remove the need for `Show` #16

Open jared-hughes opened 3 years ago

jared-hughes commented 3 years ago

Automatically Show geometries, meshes, and lights that are not assigned to a variable, e.g. treat AmbientLight(0.2) (which seems like it would add a light, but doesn't) as Show(AmbientLight(0.2)). Leave the behavior of light1 = AmbientLight(0.2) unchanged.

Sample changes:

Before → After
Show(AmbientLight(0.2)) → AmbientLight(0.2)
Show(Mesh(Sphere(0.5))) → Sphere(0.5)
Show(Mesh(Sphere(0.5), MeshLambertMaterial())) → Mesh(Sphere(0.5), MeshLambertMaterial())
jared-hughes commented 3 years ago

Idea: implement different function arguments like Show(Mesh | Geometry | Any), so something like Show(Sphere(0.5)) works. Then wrap Show around every line that isn't assigned to a variable — branching based on the different types will handle the rest.

Though it's probably simpler to just special-case different options for an outer wrap function.

jared-hughes commented 3 years ago

Better idea: consider behavior of expression normaldist(), which has a checkbox for "find cumulative probably." Would be good to have a checkbox for "show."

Or -- even better -- treat objects like the expression y=x^2 and toggle display with the circle in the tab to the left. Instead of using the 2d graph icon, change it based on the type of material (requires same type of material -- #12 would complicate this).