Answer the question
In order to leave comments, you need to log in
How to "cut" a piece of a mesh over another mesh?
Hello. Recently there was a need to implement an algorithm that would "cut" / "saw out" an object on another object. For example, there are 2 such meshes (mesh):
Imagine that the white plane is actually a large box, but we see only a small part of its surface. It is necessary to "cut out" a piece from it, which occupies the lower part of the red parallelepiped, i.e. add the corresponding vertices and triangles. As a result, the following object should be obtained (part of this object is marked in red for clarity):
Example No. 2.
Initial data:
A red ellipsoid is "cut out" from a white parallelepiped. In this case, the original mesh is divided into 2 parts. Result:
At the input, the algorithm has for each mesh:
1. Vector3[] (Vector3 is a class that has float x, float y, float z) - an array of mesh vertex coordinates (example: {(0,0,0),(1,0,0),(0, 0,1),(1,0,1)})
2. int[] - array of vertex indices that make up mesh triangles (example: {0, 1, 2, 1, 2, 3} - 2 triangles forming square in the XZ plane)
The output should be an array of vertices Vector3[] and an array of triangles int[].
How can this be implemented? What can be read about this?
Answer the question
In order to leave comments, you need to log in
It's called boolean operations, and it's pretty tricky to implement on your own. It is better to take a ready-made library, for example https://github.com/gilbo/cork
You can start reading from here https://en.wikipedia.org/wiki/Constructive_solid_g...
What can be read about this?
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question