Skip to content

Preserve structure after remeshing #20

Closed

Description

@Nicolaus93

Hi again,

I have the following problem. I have different meshes that I want to read and then merge, remesh using graphite/geogram.
The different meshes have been split from one original single mesh. Think for example of a cube, then I have 6 different faces.
Is there a way to preserve the original (exterior) edges when remeshing? This is roughly what I've been trying:

def gompy_append(nb_points=100):
    scene_graph = gom.create(classname='OGF::SceneGraph', interpreter=gom)
    scene_graph.clear()

    faces = [scene_graph.load_object(f"/tmp/cube_face_{i}.obj") for i in range(6)]

    # merge only some faces of the cube
    for i in range(1, 4):
        f = faces[i]
        f.I.Surface.remesh_smooth(nb_points=nb_points, tri_shape_adapt=2.0, adjust=True)
        remesh = scene_graph.resolve('remesh')
        faces[0].I.Mesh.append(remesh)

    ps.init()
    ps.register_surface_mesh(
        "merge",
        np.asarray(faces[0].I.Editor.find_attribute('vertices.point')),
        np.asarray(faces[0].I.Editor.get_triangles()),
    )
    ps.show()

If you try to increase the number of points, the quality of the final result will improve.
However, I would like to know if there's a way to reproduce the original structure after merging all the faces.
If I skip the remesh step, then just merging the faces gives back the original single mesh.

image

Activity

  1. BrunoLevy commented on Jul 2, 2024

    @BrunoLevy
    Owner

    Hello !
    If the different parts of the mesh are planar, what you need is a constrained Delaunay triangulation, to make sure that the border of each part is preserved.
    It exists in geogram, CDT_2d, unfortunately, there is no Python/gompy binding yet for it (you'll need to deep-dive into the C++).
    You will need also a way of generating the additional points, for instance CVT.
    Another possibility is to use Jonathan Shewchuk's Triangle program. It does both constrained Delaunay triangulation and point insertion. To use it in a Python program, you will need to write the polygonal contour of your part into a file, spawn triangle, then read the result back (but it may be easier than diving into geogram C++ classes).

  2. Nicolaus93 commented on Jul 2, 2024

    @Nicolaus93
    Author

    Thank you for the detailed answer!
    Then I'm looking forward to the python bindings for geogram even more 😄
    But I might try to give a shot to the original geogram in C++

  3. Nicolaus93 commented on Jul 3, 2024

    @Nicolaus93
    Author

    It seems there's a python wrapper also for Triangle https://rufat.be/triangle/
    For constrained Delaunay triangulation, I believe an example is described here https://rufat.be/triangle/delaunay.html

  4. Repository owner locked and limited conversation to collaborators on Oct 14, 2025
  5. converted this issue into a discussion #45 on Oct 14, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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