Contour lines on a closed mesh?

Hi there, i am trying to find a way how to get contour lines from a closed mesh.
i was thinking to use the CSG class, but i just dont really find a way to do that.

so ultimatively i would like to generate contour lines of a 3D object, for example every 1 unit and return a polyline.

how would i do that?

thanks a lot!

A way to go could be:

  1. Define the plane to use to “cut” the meshes with
  2. Step along the plane’s axis, calculating all the plane/mesh intersections for the plane in that position
  3. Join the points generated at each step 2 in a line

Typing this from memory:

mesh.edgesColor = new Babylon.Color4(r, g, b, a);
mesh.edgesWidth = Number;
1 Like

I suppose you could give it a try using greasedLines for mesh with the predicate function.

Hi there, since i am doing some pre-calculation of the mesh i need in an other envorinment, i dont really need the contourlines anymore. i am using cgal (cgal for that task and export all the contourlines i need. Sorry for not solving my problem here in a babylonjs matter :wink:


If it solves your problem then all good :smiley: