Skip to content

Unexpected tunnel face detection on torus mesh using detectTunnelFaces #5204

@osmaoui

Description

@osmaoui

I am trying to detect tunnels in a mesh using detectTunnelFaces. To test the function, I generated a torus mesh with the following code:

import meshlib.mrmeshpy as mm
import meshlib.mrmeshnumpy as mn
import polyscope as ps
import numpy as np

# Generate torus mesh
torus = mm.makeTorus(2, 1, 100, 100, None)

# Detect tunnels
settings = mm.DetectTunnelSettings()
tunnels = mm.detectTunnelFaces(torus, settings)

# Extract incident vertices
verts_for_move = mm.getIncidentVerts(torus.topology, tunnels)
verts_for_move = mn.getNumpyBitSet(verts_for_move)

# Visualize in Polyscope
ps.init()
verts = mn.getNumpyVerts(torus)
faces = mn.getNumpyFaces(torus.topology)
ps_mesh = ps.register_surface_mesh("mesh", verts, faces)

colors = np.zeros((len(verts), 3), dtype=np.uint8)
colors[verts_for_move] = [1, 0, 0]
ps_mesh.add_color_quantity("colors", colors)

ps.show()

Observed Behavior:
The highlighted tunnel faces (see attached screenshot) don’t seem to correspond to the expected tunnel region on the torus. It looks like the detection is not working as intended.

Expected Behavior:
I expected detectTunnelFaces to highlight the faces corresponding to the actual tunnel of the torus.

Question:

Is my usage of detectTunnelFaces correct for this case?

Should I be using a different function (e.g., detectBasisTunnels) or additional settings for detecting tunnels on a torus?

Image

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions