cnr-isti-vclab / PyMeshLab

The open source mesh processing python library

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

How to check if two meshes intersect with each other?

johnnytam100 opened this issue · comments

Hi PyMeshLab!
I want to use generate_boolean_intersection to return a boolean if two meshes intersect with each other.

I followed an example here: https://github.com/jk4011/jhutil/blob/1381fcf30e7ad9660109454eab55d13286c44f3a/jhutil/three_d.py#L269

to load two identical meshes and apply generate_boolean_intersection filter, like this

# Save intersection of two meshes
import pymeshlab
ms = pymeshlab.MeshSet()

# Add the input meshes to the MeshSet
ms.load_new_mesh('1510259A_1-201.ply')
ms.load_new_mesh('1510259A_1-201.ply')

# Apply the boolean intersection filter
ms.apply_filter(
    'generate_boolean_intersection',
    first_mesh=0,
    second_mesh=1,
    transfer_face_color=False,
    transfer_face_quality=False,
    transfer_vert_color=False,
    transfer_vert_quality=False)

image

However, the output is an empty dict {}
May I know how to interpret this result?
Thanks!

The boolean operator doesn't return any value but you can get the new mesh id by calling
ms.current_mesh_id()

after applying the boolean. In the link https://github.com/jk4011/jhutil/blob/1381fcf30e7ad9660109454eab55d13286c44f3a/jhutil/three_d.py#L269

you can see that after boolean, it is saving:
ms.save_current_mesh(file_loc)

where current_mesh has the id that ms.current_mesh_id() would return.

This issue has been automatically marked as stale because it has not had recent activity. The resources of the VCLab team are limited, and so we are asking for your help. If this is a bug and you can still reproduce this error on the last release of PyMeshLab, please reply with all of the information you have about it in order to keep the issue open. If this is a feature request, and you feel that it is still relevant and valuable, please tell us why. This issue will automatically be closed in the near future if no further activity occurs. Thank you for all your contributions.