Mesh Intersection #189
-
Hi, Is it possible to calculate the intersection points (lines) between two meshes? To obtain a line-of-intersection. I looked at MeshSurfaceIntersection. It only has one input, so I (ugly) combined the input meshes into one mesh. Also the object returned by set_build_skeleton() is not what I need. It returns the triangle edges near the intersection-line, not the intersection-line itself. Thank you for your help, the lib is awesome. |
Beta Was this translation helpful? Give feedback.
Replies: 7 comments 2 replies
-
Normally the skeleton should be the intersection line itself, would you share your input mesh and code snippet ? I'll take a look. You can find an example in the Graphite modeler, here Here is an image of an example (computing the intersection between two brains) |
Beta Was this translation helpful? Give feedback.
-
The brains are not booleaned/unioned or whatever, I'm just calling the code referenced. In your code:
|
Beta Was this translation helpful? Give feedback.
-
Yes, "dry run" is what you mean, but for the skeleton to be computed, the triangles need to be re-triangulated, so skeleton output is incompatible with "dry run" (I have updated the documentation accordingly and added an assertion check). So if you need to leave your input mesh unmodified, you will need to copy it to another mesh (use |
Beta Was this translation helpful? Give feedback.
-
The skeleton return values with dry_run(true) might still be useful to some. As it returns all vertices involved in the intersection. A documentation update might be enough (perhaps not an assert?). Yeah, well I just didn't copy the result back to my input (because I have to convert the shape anyways). But when I do, I get face/normal issues. Not yet sure if this problem is on our end though. Maybe face ordering / indexing? For me, it does not matter, since I'm not using that output. |
Beta Was this translation helpful? Give feedback.
-
That's weird !
About using the skeleton to return the intersected triangles, I'd rather not expose this functionality, because
|
Beta Was this translation helpful? Give feedback.
-
I understand, side effect behavior is probably undesired :). I see, and that function is (of course) the first step in intersect(). I also looked at intersect_get_intersections() (sound like get the points of intersection, like the skeleton, but a bit more complex because of the IsectInfo structure), but that one is a protected function. Sorry, I wasn't clear. I meant when I copy the data to/from geogram meshes to/from our own datastructures. It should just copy over vertices and faces and normals (they don't exist in geogram?) in order right? Example to create a geogram mesh from our Med_SurfaceKit:
And to go from a geogram mesh (e.g. the result of MeshSurfaceIntersection) to our Med_SurfaceKit:
|
Beta Was this translation helpful? Give feedback.
-
This looks correct to me (provided that the facet orientation is correct). Note: since you already know the number of facets and vertices to create, you may use About the normals, if they are stored in your representation, maybe you need to recompute them ? (then it would explain what we see, that comes from the random values stored in your mesh). |
Beta Was this translation helpful? Give feedback.
The brains are not booleaned/unioned or whatever, I'm just calling the code referenced.
Here is what I obtain with your data
In your code: