tpaviot / pythonocc-core

Python package for 3D geometry CAD/BIM/CAM
GNU Lesser General Public License v3.0
1.27k stars 365 forks source link

WebGl pointcloud #798

Open matthijsramlab opened 4 years ago

matthijsramlab commented 4 years ago

Would it be possible to view a point cloud with the WebGL renderer? At the moment it only takes a TopoDS_Shape as an argument

jf--- commented 4 years ago

hi @matthijsramlab

There are some relevant examples here for the Qt viewer and here for the jupyter renderer. What you could try, but is a bit of a hack is to aggregate your vertices in a TopoDS_Compound shape.

tpaviot commented 4 years ago

@matthijsramlab It's already possible in the JupyterRenderer, see https://github.com/tpaviot/pythonocc-demos/blob/master/jupyter_notebooks/point_cloud.ipynb but I didnot implement this feature into the w3dom or threejs renderer. Isn't the jupyter renderer enough for your needs ?

matthijsramlab commented 4 years ago

@tpaviot and @jf--- thanks for the answers. The Jupyter notebook example is very nice. However I would like to render it in my Flask app. So if that would be possible, it would be awesome.

jf--- commented 4 years ago

So if that would be possible, it would be awesome

Sure it is, but it'll be a part of your app, not pythonocc... What's missing from the core_webgl_* examples that keeps you from taking the leap?

Wrt flask, its straightfwd these days to make an app of a notebook via voilà, highly recommended

tpaviot commented 4 years ago

@matthijsramlab the "point cloud" feature implemented in the jupyter renderer is missing from the Webgl renderer, right. It has to be added, not a big effort though.

RobinCPC commented 4 years ago

Hi @tpaviot and @jf---, I add the "point cloud" feature in Webgl renderer of my fork. Actually, I add a flask server for the WebGL renderer. Here is the commit. If you think it's ok, I could make a PR. https://github.com/RobinCPC/pythonocc-core/commit/dc367c9483c1987a7995fb52962046d3cb9390ea

Hi @matthijsramlab,

Here is the result of rendering point cloud.

pythonocc-threejs-pcl

This is the sample code I used: https://gist.github.com/RobinCPC/cdbb40001fb5817625cf4e91d87ab4ea

tpaviot commented 4 years ago

@RobinCPC great, using jinja results in a much cleaner code, I will include this work in the pythonocc codebase if you agree

tpaviot commented 4 years ago

@RobinCPC yes, please open a PR, this is a cool addition

matthijsramlab commented 4 years ago

@RobinCPC Thanks allot, I will try it out this afternoon

RobinCPC commented 4 years ago

Hi @tpaviot, Thank you, I'm glad to contribute to the pythonocc codebase.
I have made a PR. Please let me know if anything needs to update.

Hi @matthijsramlab you are welcome.