plotly / plotly.js

Open-source JavaScript charting library behind Plotly and Dash
https://plotly.com/javascript/
MIT License
17.1k stars 1.87k forks source link

Idea: 3d shapes API for solid body modeling #5279

Closed jackparmer closed 3 years ago

jackparmer commented 4 years ago

In the Plotly.py Python library, to make a solid body such as this aircraft or this brain, your best bet is the Mesh 3d API.

image

The mesh3d trace type that @mikolalysenko originally wrote is awesome and has stood the test of time. It's the easiest Python, R, and Julia option for web-based 3d meshes. But it's also confusing to learn for simple shapes and there is no concept for "wall thickness" or completely solid volumes.

Playing with the single page app MakerCase for a personal project, I was imaging an extension of the 2d shapes API for 3d. The 3d shape primitives could include rectangle, cylinder, and sphere, for example. The 3d shapes API would mirror the 2d shapes API, but also include 3d parameters such as wall_thickness (ranging from 0 to infinity for solid volumes), diameter, omitted_sides (for rectangle and cylinder), surface_finish (metallic, matte, etc), and extrusions (a list of sub-objects for placing holes or other extrusions shapes through the 3d volume). Perhaps also an API for mating 3d shapes together (such as a ball and stick model).

This would allow computational researchers, educators, and hobbyists to get something on paper quickly without delving into the full details of mesh3d, but they could always have a backdoor to mesh3d for more realistic shapes and modeling.

A 3d shapes API could help open up Python, R, and Julia open-source to engineering fields that are currently still dominated by proprietary software such as ANSYS, MATLAB, and COMSOL. Here are a few examples:

ANSYS, MATLAB, SolidWorks, COMSOL, Autodesk etc are examples of fantastic software that currently dominate this field, but my sense is open-source and Python will inevitably start taking bites out of these market caps, as its done for other science and engineering fields over the past decade. The Python, R, and Julia computational backends are there, but the front-end 3d visualization is still not sufficiently easy, capable, or beautiful IMO.

Copying a wide range of potentially interested parties, as this could have a nice impact on scientific Python as a whole if done right: @archmoj @fperez @mikolalysenko @emmanuelle @maartenbreddels @mariobuikhuizen @philippjfr @alexcjohnson @empet @cpsievert @peterdsharpe @kig @moorepants @chriddyp @ViralBShah . Any thoughts, suggestions, feedback, random ideas, etc are very welcome. Apologies in advance for the spam if not interested in this! 😬

Other issues potentially related to 3d solid body modeling: https://github.com/plotly/plotly.js/issues/4485, https://github.com/plotly/plotly.js/issues/2221, https://github.com/plotly/plotly.js/issues/2352, https://github.com/plotly/plotly.js/issues/949

jackparmer commented 3 years ago

Instead of reinventing the wheel, putting all funding for this towards our new collaboration with Kitware and Dash VTK: https://github.com/plotly/dash-vtk