Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Edges overlapping issue #2292

Open
m-fabregue opened this issue Sep 24, 2024 · 0 comments
Open

Edges overlapping issue #2292

m-fabregue opened this issue Sep 24, 2024 · 0 comments

Comments

@m-fabregue
Copy link

m-fabregue commented Sep 24, 2024

Hello !

I am currently playing with trimesh in the context of a CAD project.
I started to implement an algorithm able to chamfer mesh vertices given a list of vertex indices.

In order to construct a chamfer for a vertex, I need to know outgoing edges (excluding edges shared by two co-planar faces) from this vertex and then compute a new vertex in the direction of the edge at a specific distance (the chamfer size)

Now I am facing an issue I didn't anticipated. Some edges are overlaping and I dont know how to get rid of that. Meshes are generated by applying boolean operations on some basic shapes, using "manifold" engine.

The following code & image highlight the issue on the vertex 7 and the edges [[3, 11], [7 12]]. I would expect, instead, [[3, 7], [7 11], [11, 12]]. Cubes are currently not considered adjacent by some edges. Is there an option for the manifold engine or another trimesh function that is able to solve this ?

Regards

image

import trimesh
import vedo

make_cuboid = lambda extents: trimesh.creation.box(extents=extents)

# create two cubes that overlap on the border
bottom_cube = make_cuboid([20, 10, 10])
top_cube = make_cuboid([10, 10, 10])
top_cube.apply_translation([10, 10, 10])

# merge cubes together to create a single mesh
merged = trimesh.boolean.union([bottom_cube, top_cube])

# display mesh skeleton & vertex indices
vedo_mesh = vedo.Mesh([merged.vertices, merged.faces])
points = vedo_mesh.vertices
labels = [vedo.Text3D(str(i), pos=points[i], s=1, c="red") for i in range(len(points))]
vedo.show(vedo_mesh.wireframe(), *labels, axes=1)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant