Plane intersection to then extrude

Hey again :D,
I want to make the intersection with a plane and the get a polygon that I can extrude. The problem is CSG intersection with a 0 depth mesh doesn’t work. And same for the plane mesh that keeps one side of the initial mesh.
I was using a thin box (0.001 depth) to make the intersection but I am unable to extrude anything from it.
I have looked for plan projection, plan cutting but found nothing…
Does some kind of functions like this exist ?
Thanks :slight_smile:
https://playground.babylonjs.com/#3IV74M#7

The CSG operation produces a number of superfluous vertices that you will need to first get rid of.

Your shape is:

I think you will have to extract the vertices of the hull of your mesh (making sure not to have two vertices too close from one another) and then use them as the extrude shape.

To get you started, you can use the edge renderer that will find the hull for you:

https://playground.babylonjs.com/#F27G9D#3

In this PG, I have extracted the vertices that are on a single side of the mesh by checking the z coordinate of the vertices produced by the edge renderer.

image
The extruded shape is on the right. It’s not ok because the points of the shape are given in a random order: you should apply some processing to the point list (newPositions in the code) to only retain the 8 vertices that are making the hull (currently, there are 264 vertices!).

1 Like

Thanks again :slight_smile:
Ill work on it and post a generic solution here if I manage to do it