[Python] Match a 3D submesh-template in main mesh

Discussão em 'Python' iniciado por Stack, Maio 9, 2025.

  1. Stack

    Stack Membro Participativo

    I am in python loading 3D models as meshes (their data consists of vertices, normals and faces). I want to find their connectable points. These connection points are modeled the same way in every of these models: either a cylindrical pin as male connector or a hole as female connector. However, the model dataset doesn't contain the connection points, so I want to infer them via code.

    This means: I am trying to match and locate all occurences of a template mesh that I specify and create once for every connector type (one male + one female template) in a greater model mesh.

    I am going to illustrate what I mean with LEGO pieces:

    Piece A: hole connection/female Piece B: pin connection/male
    [​IMG] [​IMG]
    find location of these holes find location of these pin halves
    [​IMG] [​IMG]

    I thought this would be a pretty standard task to do and there would be some libraries where I can just proivde a mesh and I get all occurences of this mesh in my main mesh. However, I cant seem to find any. So, I am wondering if my approach to this problem is wrong, and if it's even possible. While researching, I had some other ideas:

    • instead of finding the male connector in male mesh, try to insert the female mesh. This seems to not be a great idea
    • convert to pointcloud and use pointcloud analysis. However, I'm not sure if this helps
    • convert model to graph and try to find a sub-graph. However, I don't know how i should convert the models. Maybe rasterizing/voxelizing beforehand.
    • check every vertex myself and try to complete the sub-mesh from there. However, coding this from scratch would be error prone, and I would like a robust solution that maybe even has some tolerance when matching the sub-meshes.

    So, my questions are:

    1. How is this problem called, so I can research more?
    2. What is the typical/best approach? This is done as data preprocessing, so it doesn't need to run in real-time. I am in python.

    Thank you!

    Continue reading...

Compartilhe esta Página