Skip to content

Mesh.remove_duplicate_vertices() possible hash collision #1453

Open

Description

@2twenity

Describe the bug
Given: The mesh is received from Speckle as a list of vertices and faces, but some of the vertices are duplicated.
The mesh was constructed and the following checks were performed:

mesh.is_manifold() -> True
mesh.is_connected() -> False # because some of the vertices are duplicated
mesh.is_valid() -> True
mesh.is_trimesh() -> True

After the usage of a method, the results are following

mesh.remove_duplicate_vertices()

mesh.is_manifold() -> True
mesh.is_connected() -> True # The connectivity was fixed
mesh.is_valid() -> False 
mesh.is_trimesh() -> False # Probably because of the TOL.geometric_key some collision happens

Instead, if a comparison of equality of vertices is done in way when we compare sets of coordinates directly, doesn't cause this collision

def validate_mesh(input_mesh: Mesh) -> Mesh:
    input_coordinates = [tuple(input_mesh.vertex_coordinates(vertex)) for vertex in input_mesh.vertices()]
    no_duplicates_coordinates = list(set([tuple(input_mesh.vertex_coordinates(vertex)) for vertex in input_mesh.vertices()]))
 
    
    all_updated_faces = []
    
    for face in sorted(list(input_mesh.faces())):
        vertices_lst = input_mesh.face_vertices(face) # vertices list like [12, 13, 14]
    
       
        vertex0 = input_coordinates[vertices_lst[0]]
        vertex1 = input_coordinates[vertices_lst[1]]
        vertex2 = input_coordinates[vertices_lst[2]]

        new_index0 = no_duplicates_coordinates.index(vertex0)
        new_index1 = no_duplicates_coordinates.index(vertex1)
        new_index2 = no_duplicates_coordinates.index(vertex2)

        updated_faces = [new_index0, new_index1, new_index2]
        # print(updated_faces)

        all_updated_faces.append(updated_faces)

  
    new_mesh = Mesh.from_vertices_and_faces(vertices = no_duplicates_coordinates,
                                           faces = all_updated_faces)

    return new_mesh

The result

new_mesh = validate_mesh(mesh)

new_mesh.is_manifold() -> True
new_mesh.is_connected() -> True 
new_mesh.is_valid() -> True
new_mesh.is_trimesh() -> True

Since there are no specific tests for a mesh.remove_duplicate_vertices() function, I'd assume that it's reasonable to modify it a bit. If needed, I'd be happy to contribute.

To Reproduce
Steps to reproduce the behavior:

  1. Context [Jupyter Notebook, latest compas installed]
  2. Sample data

Mesh itself

[(1.624855, 4.584075, 3.408143), (1.624855, 4.470224, 3.4), (1.624855, 4.470224, 3.4)]
[(1.624855, 4.470224, 3.4), (1.624855, 4.470224, 3.8), (1.624855, 4.52715, 3.804071)]
[(1.624855, 4.866152, 4.143074), (1.624855, 4.870224, 4.2), (1.624855, 5.270224, 4.2)]
[(1.624855, 5.270224, 4.2), (1.624855, 5.262081, 4.086148), (1.624855, 5.237818, 3.974614)]
[(1.624855, 5.237818, 3.974614), (1.624855, 5.197929, 3.867668), (1.624855, 5.143226, 3.767487)]
[(1.624855, 5.143226, 3.767487), (1.624855, 5.074823, 3.676111), (1.624855, 4.994112, 3.5954)]
[(1.624855, 4.994112, 3.5954), (1.624855, 4.902736, 3.526997), (1.624855, 4.802556, 3.472294)]
[(1.624855, 4.802556, 3.472294), (1.624855, 4.69561, 3.432406), (1.624855, 4.584075, 3.408143)]
[(1.624855, 4.584075, 3.408143), (1.624855, 4.470224, 3.4), (1.624855, 4.52715, 3.804071)]
[(1.624855, 4.854021, 4.087307), (1.624855, 4.866152, 4.143074), (1.624855, 5.270224, 4.2)]
[(1.624855, 5.270224, 4.2), (1.624855, 5.237818, 3.974614), (1.624855, 5.143226, 3.767487)]
[(1.624855, 5.143226, 3.767487), (1.624855, 4.994112, 3.5954), (1.624855, 4.802556, 3.472294)]
[(1.624855, 4.802556, 3.472294), (1.624855, 4.584075, 3.408143), (1.624855, 4.52715, 3.804071)]
[(1.624855, 4.834076, 4.033834), (1.624855, 4.854021, 4.087307), (1.624855, 5.270224, 4.2)]
[(1.624855, 5.270224, 4.2), (1.624855, 5.143226, 3.767487), (1.624855, 4.802556, 3.472294)]
[(1.624855, 4.802556, 3.472294), (1.624855, 4.52715, 3.804071), (1.624855, 4.582917, 3.816203)]
[(1.624855, 4.806725, 3.983744), (1.624855, 4.834076, 4.033834), (1.624855, 5.270224, 4.2)]
[(1.624855, 4.802556, 3.472294), (1.624855, 4.582917, 3.816203), (1.624855, 4.63639, 3.836147)]
[(1.624855, 4.772523, 3.938056), (1.624855, 4.806725, 3.983744), (1.624855, 5.270224, 4.2)]
[(1.624855, 4.802556, 3.472294), (1.624855, 4.63639, 3.836147), (1.624855, 4.68648, 3.863499)]
[(1.624855, 4.732168, 3.8977), (1.624855, 4.772523, 3.938056), (1.624855, 5.270224, 4.2)]
[(1.624855, 5.270224, 4.2), (1.624855, 4.802556, 3.472294), (1.624855, 4.68648, 3.863499)]
[(1.624855, 4.68648, 3.863499), (1.624855, 4.732168, 3.8977), (1.624855, 5.270224, 4.2)]
[(2.024855, 4.584075, 3.408143), (2.024855, 4.470224, 3.4), (2.024855, 4.470224, 3.4)]
[(2.024855, 4.470224, 3.4), (2.024855, 4.52715, 3.804071), (2.024855, 4.470224, 3.8)]
[(2.024855, 4.866152, 4.143074), (2.024855, 5.270224, 4.2), (2.024855, 4.870224, 4.2)]
[(2.024855, 5.270224, 4.2), (2.024855, 5.237818, 3.974614), (2.024855, 5.262081, 4.086148)]
[(2.024855, 5.237818, 3.974614), (2.024855, 5.143226, 3.767487), (2.024855, 5.197929, 3.867668)]
[(2.024855, 5.143226, 3.767487), (2.024855, 4.994112, 3.5954), (2.024855, 5.074823, 3.676111)]
[(2.024855, 4.994112, 3.5954), (2.024855, 4.802556, 3.472294), (2.024855, 4.902736, 3.526997)]
[(2.024855, 4.802556, 3.472294), (2.024855, 4.584075, 3.408143), (2.024855, 4.69561, 3.432406)]
[(2.024855, 4.584075, 3.408143), (2.024855, 4.52715, 3.804071), (2.024855, 4.470224, 3.4)]
[(2.024855, 4.854021, 4.087307), (2.024855, 5.270224, 4.2), (2.024855, 4.866152, 4.143074)]
[(2.024855, 5.270224, 4.2), (2.024855, 5.143226, 3.767487), (2.024855, 5.237818, 3.974614)]
[(2.024855, 5.143226, 3.767487), (2.024855, 4.802556, 3.472294), (2.024855, 4.994112, 3.5954)]
[(2.024855, 4.802556, 3.472294), (2.024855, 4.52715, 3.804071), (2.024855, 4.584075, 3.408143)]
[(2.024855, 4.834076, 4.033834), (2.024855, 5.270224, 4.2), (2.024855, 4.854021, 4.087307)]
[(2.024855, 5.270224, 4.2), (2.024855, 4.802556, 3.472294), (2.024855, 5.143226, 3.767487)]
[(2.024855, 4.802556, 3.472294), (2.024855, 4.582917, 3.816203), (2.024855, 4.52715, 3.804071)]
[(2.024855, 4.806725, 3.983744), (2.024855, 5.270224, 4.2), (2.024855, 4.834076, 4.033834)]
[(2.024855, 4.802556, 3.472294), (2.024855, 4.63639, 3.836147), (2.024855, 4.582917, 3.816203)]
[(2.024855, 4.772523, 3.938056), (2.024855, 5.270224, 4.2), (2.024855, 4.806725, 3.983744)]
[(2.024855, 4.802556, 3.472294), (2.024855, 4.68648, 3.863499), (2.024855, 4.63639, 3.836147)]
[(2.024855, 4.732168, 3.8977), (2.024855, 5.270224, 4.2), (2.024855, 4.772523, 3.938056)]
[(2.024855, 5.270224, 4.2), (2.024855, 4.68648, 3.863499), (2.024855, 4.802556, 3.472294)]
[(2.024855, 4.68648, 3.863499), (2.024855, 5.270224, 4.2), (2.024855, 4.732168, 3.8977)]
[(2.024855, 4.470224, 3.4), (1.624855, 4.470224, 3.8), (1.624855, 4.470224, 3.4)]
[(2.024855, 4.470224, 3.4), (2.024855, 4.470224, 3.8), (1.624855, 4.470224, 3.8)]
[(2.024855, 4.470224, 3.8), (1.624855, 4.52715, 3.804071), (1.624855, 4.470224, 3.8)]
[(2.024855, 4.470224, 3.8), (2.024855, 4.52715, 3.804071), (1.624855, 4.52715, 3.804071)]
[(2.024855, 4.52715, 3.804071), (1.624855, 4.582917, 3.816203), (1.624855, 4.52715, 3.804071)]
[(2.024855, 4.52715, 3.804071), (2.024855, 4.582917, 3.816203), (1.624855, 4.582917, 3.816203)]
[(2.024855, 4.582917, 3.816203), (1.624855, 4.63639, 3.836147), (1.624855, 4.582917, 3.816203)]
[(2.024855, 4.582917, 3.816203), (2.024855, 4.63639, 3.836147), (1.624855, 4.63639, 3.836147)]
[(2.024855, 4.63639, 3.836147), (1.624855, 4.68648, 3.863499), (1.624855, 4.63639, 3.836147)]
[(2.024855, 4.63639, 3.836147), (2.024855, 4.68648, 3.863499), (1.624855, 4.68648, 3.863499)]
[(2.024855, 4.68648, 3.863499), (1.624855, 4.732168, 3.8977), (1.624855, 4.68648, 3.863499)]
[(2.024855, 4.68648, 3.863499), (2.024855, 4.732168, 3.8977), (1.624855, 4.732168, 3.8977)]
[(2.024855, 4.732168, 3.8977), (1.624855, 4.772523, 3.938056), (1.624855, 4.732168, 3.8977)]
[(2.024855, 4.732168, 3.8977), (2.024855, 4.772523, 3.938056), (1.624855, 4.772523, 3.938056)]
[(2.024855, 4.772523, 3.938056), (1.624855, 4.806725, 3.983744), (1.624855, 4.772523, 3.938056)]
[(2.024855, 4.772523, 3.938056), (2.024855, 4.806725, 3.983744), (1.624855, 4.806725, 3.983744)]
[(2.024855, 4.806725, 3.983744), (1.624855, 4.834076, 4.033834), (1.624855, 4.806725, 3.983744)]
[(2.024855, 4.806725, 3.983744), (2.024855, 4.834076, 4.033834), (1.624855, 4.834076, 4.033834)]
[(2.024855, 4.834076, 4.033834), (1.624855, 4.854021, 4.087307), (1.624855, 4.834076, 4.033834)]
[(2.024855, 4.834076, 4.033834), (2.024855, 4.854021, 4.087307), (1.624855, 4.854021, 4.087307)]
[(2.024855, 4.854021, 4.087307), (1.624855, 4.866152, 4.143074), (1.624855, 4.854021, 4.087307)]
[(2.024855, 4.854021, 4.087307), (2.024855, 4.866152, 4.143074), (1.624855, 4.866152, 4.143074)]
[(2.024855, 4.866152, 4.143074), (1.624855, 4.870224, 4.2), (1.624855, 4.866152, 4.143074)]
[(2.024855, 4.866152, 4.143074), (2.024855, 4.870224, 4.2), (1.624855, 4.870224, 4.2)]
[(2.024855, 4.870224, 4.2), (1.624855, 5.270224, 4.2), (1.624855, 4.870224, 4.2)]
[(2.024855, 4.870224, 4.2), (2.024855, 5.270224, 4.2), (1.624855, 5.270224, 4.2)]
[(2.024855, 5.270224, 4.2), (1.624855, 5.262081, 4.086148), (1.624855, 5.270224, 4.2)]
[(2.024855, 5.270224, 4.2), (2.024855, 5.262081, 4.086148), (1.624855, 5.262081, 4.086148)]
[(2.024855, 5.262081, 4.086148), (1.624855, 5.237818, 3.974614), (1.624855, 5.262081, 4.086148)]
[(2.024855, 5.262081, 4.086148), (2.024855, 5.237818, 3.974614), (1.624855, 5.237818, 3.974614)]
[(2.024855, 5.237818, 3.974614), (1.624855, 5.197929, 3.867668), (1.624855, 5.237818, 3.974614)]
[(2.024855, 5.237818, 3.974614), (2.024855, 5.197929, 3.867668), (1.624855, 5.197929, 3.867668)]
[(2.024855, 5.197929, 3.867668), (1.624855, 5.143226, 3.767487), (1.624855, 5.197929, 3.867668)]
[(2.024855, 5.197929, 3.867668), (2.024855, 5.143226, 3.767487), (1.624855, 5.143226, 3.767487)]
[(2.024855, 5.143226, 3.767487), (1.624855, 5.074823, 3.676111), (1.624855, 5.143226, 3.767487)]
[(2.024855, 5.143226, 3.767487), (2.024855, 5.074823, 3.676111), (1.624855, 5.074823, 3.676111)]
[(2.024855, 5.074823, 3.676111), (1.624855, 4.994112, 3.5954), (1.624855, 5.074823, 3.676111)]
[(2.024855, 5.074823, 3.676111), (2.024855, 4.994112, 3.5954), (1.624855, 4.994112, 3.5954)]
[(2.024855, 4.994112, 3.5954), (1.624855, 4.902736, 3.526997), (1.624855, 4.994112, 3.5954)]
[(2.024855, 4.994112, 3.5954), (2.024855, 4.902736, 3.526997), (1.624855, 4.902736, 3.526997)]
[(2.024855, 4.902736, 3.526997), (1.624855, 4.802556, 3.472294), (1.624855, 4.902736, 3.526997)]
[(2.024855, 4.902736, 3.526997), (2.024855, 4.802556, 3.472294), (1.624855, 4.802556, 3.472294)]
[(2.024855, 4.802556, 3.472294), (1.624855, 4.69561, 3.432406), (1.624855, 4.802556, 3.472294)]
[(2.024855, 4.802556, 3.472294), (2.024855, 4.69561, 3.432406), (1.624855, 4.69561, 3.432406)]
[(2.024855, 4.69561, 3.432406), (1.624855, 4.584075, 3.408143), (1.624855, 4.69561, 3.432406)]
[(2.024855, 4.69561, 3.432406), (2.024855, 4.584075, 3.408143), (1.624855, 4.584075, 3.408143)]
[(2.024855, 4.584075, 3.408143), (1.624855, 4.470224, 3.4), (1.624855, 4.584075, 3.408143)]
[(2.024855, 4.584075, 3.408143), (2.024855, 4.470224, 3.4), (1.624855, 4.470224, 3.4)]
Image
  1. See error
    Viewer fails to visualize because trimesh structure is broken
    Screenshots
Image

Desktop (please complete the following information):

  • iOS M4
  • Python version 3.12
  • Python package manager Conda

Activity

  1. tomvanmele commented on Mar 28, 2025

    @tomvanmele
    Member

    hi,

    thanks for posting this!
    have you tried changing the precision setting?

    for example

    mesh.remove_duplicate_vertices(precision=6)
  2. tomvanmele commented on Mar 28, 2025

    @tomvanmele
    Member

    perhaps we could also add a flag regrading the method of comparison: hash (default) v. coordinates

    or something like that

  3. 2twenity commented on Mar 28, 2025

    @2twenity
    Author

    As for the precision parameter, sure. I just double-checked it and the result was the same.

    mesh.remove_duplicate_vertices(precision=6)
    
    mesh.is_manifold() -> True
    mesh.is_connected() -> True 
    mesh.is_valid() -> False 
    mesh.is_trimesh() -> False 
  4. tomvanmele commented on Mar 28, 2025

    @tomvanmele
    Member

    the mesh is defined with the triplets of vertices above?

  5. tomvanmele commented on Mar 28, 2025

    @tomvanmele
    Member
    from compas.datastructures import Mesh
    from compas_viewer import Viewer
    
    triangles = [
        [(1.624855, 4.584075, 3.408143), (1.624855, 4.470224, 3.4), (1.624855, 4.470224, 3.4)],
        [(1.624855, 4.470224, 3.4), (1.624855, 4.470224, 3.8), (1.624855, 4.52715, 3.804071)],
        [(1.624855, 4.866152, 4.143074), (1.624855, 4.870224, 4.2), (1.624855, 5.270224, 4.2)],
        [(1.624855, 5.270224, 4.2), (1.624855, 5.262081, 4.086148), (1.624855, 5.237818, 3.974614)],
        [(1.624855, 5.237818, 3.974614), (1.624855, 5.197929, 3.867668), (1.624855, 5.143226, 3.767487)],
        [(1.624855, 5.143226, 3.767487), (1.624855, 5.074823, 3.676111), (1.624855, 4.994112, 3.5954)],
        [(1.624855, 4.994112, 3.5954), (1.624855, 4.902736, 3.526997), (1.624855, 4.802556, 3.472294)],
        [(1.624855, 4.802556, 3.472294), (1.624855, 4.69561, 3.432406), (1.624855, 4.584075, 3.408143)],
        [(1.624855, 4.584075, 3.408143), (1.624855, 4.470224, 3.4), (1.624855, 4.52715, 3.804071)],
        [(1.624855, 4.854021, 4.087307), (1.624855, 4.866152, 4.143074), (1.624855, 5.270224, 4.2)],
        [(1.624855, 5.270224, 4.2), (1.624855, 5.237818, 3.974614), (1.624855, 5.143226, 3.767487)],
        [(1.624855, 5.143226, 3.767487), (1.624855, 4.994112, 3.5954), (1.624855, 4.802556, 3.472294)],
        [(1.624855, 4.802556, 3.472294), (1.624855, 4.584075, 3.408143), (1.624855, 4.52715, 3.804071)],
        [(1.624855, 4.834076, 4.033834), (1.624855, 4.854021, 4.087307), (1.624855, 5.270224, 4.2)],
        [(1.624855, 5.270224, 4.2), (1.624855, 5.143226, 3.767487), (1.624855, 4.802556, 3.472294)],
        [(1.624855, 4.802556, 3.472294), (1.624855, 4.52715, 3.804071), (1.624855, 4.582917, 3.816203)],
        [(1.624855, 4.806725, 3.983744), (1.624855, 4.834076, 4.033834), (1.624855, 5.270224, 4.2)],
        [(1.624855, 4.802556, 3.472294), (1.624855, 4.582917, 3.816203), (1.624855, 4.63639, 3.836147)],
        [(1.624855, 4.772523, 3.938056), (1.624855, 4.806725, 3.983744), (1.624855, 5.270224, 4.2)],
        [(1.624855, 4.802556, 3.472294), (1.624855, 4.63639, 3.836147), (1.624855, 4.68648, 3.863499)],
        [(1.624855, 4.732168, 3.8977), (1.624855, 4.772523, 3.938056), (1.624855, 5.270224, 4.2)],
        [(1.624855, 5.270224, 4.2), (1.624855, 4.802556, 3.472294), (1.624855, 4.68648, 3.863499)],
        [(1.624855, 4.68648, 3.863499), (1.624855, 4.732168, 3.8977), (1.624855, 5.270224, 4.2)],
        [(2.024855, 4.584075, 3.408143), (2.024855, 4.470224, 3.4), (2.024855, 4.470224, 3.4)],
        [(2.024855, 4.470224, 3.4), (2.024855, 4.52715, 3.804071), (2.024855, 4.470224, 3.8)],
        [(2.024855, 4.866152, 4.143074), (2.024855, 5.270224, 4.2), (2.024855, 4.870224, 4.2)],
        [(2.024855, 5.270224, 4.2), (2.024855, 5.237818, 3.974614), (2.024855, 5.262081, 4.086148)],
        [(2.024855, 5.237818, 3.974614), (2.024855, 5.143226, 3.767487), (2.024855, 5.197929, 3.867668)],
        [(2.024855, 5.143226, 3.767487), (2.024855, 4.994112, 3.5954), (2.024855, 5.074823, 3.676111)],
        [(2.024855, 4.994112, 3.5954), (2.024855, 4.802556, 3.472294), (2.024855, 4.902736, 3.526997)],
        [(2.024855, 4.802556, 3.472294), (2.024855, 4.584075, 3.408143), (2.024855, 4.69561, 3.432406)],
        [(2.024855, 4.584075, 3.408143), (2.024855, 4.52715, 3.804071), (2.024855, 4.470224, 3.4)],
        [(2.024855, 4.854021, 4.087307), (2.024855, 5.270224, 4.2), (2.024855, 4.866152, 4.143074)],
        [(2.024855, 5.270224, 4.2), (2.024855, 5.143226, 3.767487), (2.024855, 5.237818, 3.974614)],
        [(2.024855, 5.143226, 3.767487), (2.024855, 4.802556, 3.472294), (2.024855, 4.994112, 3.5954)],
        [(2.024855, 4.802556, 3.472294), (2.024855, 4.52715, 3.804071), (2.024855, 4.584075, 3.408143)],
        [(2.024855, 4.834076, 4.033834), (2.024855, 5.270224, 4.2), (2.024855, 4.854021, 4.087307)],
        [(2.024855, 5.270224, 4.2), (2.024855, 4.802556, 3.472294), (2.024855, 5.143226, 3.767487)],
        [(2.024855, 4.802556, 3.472294), (2.024855, 4.582917, 3.816203), (2.024855, 4.52715, 3.804071)],
        [(2.024855, 4.806725, 3.983744), (2.024855, 5.270224, 4.2), (2.024855, 4.834076, 4.033834)],
        [(2.024855, 4.802556, 3.472294), (2.024855, 4.63639, 3.836147), (2.024855, 4.582917, 3.816203)],
        [(2.024855, 4.772523, 3.938056), (2.024855, 5.270224, 4.2), (2.024855, 4.806725, 3.983744)],
        [(2.024855, 4.802556, 3.472294), (2.024855, 4.68648, 3.863499), (2.024855, 4.63639, 3.836147)],
        [(2.024855, 4.732168, 3.8977), (2.024855, 5.270224, 4.2), (2.024855, 4.772523, 3.938056)],
        [(2.024855, 5.270224, 4.2), (2.024855, 4.68648, 3.863499), (2.024855, 4.802556, 3.472294)],
        [(2.024855, 4.68648, 3.863499), (2.024855, 5.270224, 4.2), (2.024855, 4.732168, 3.8977)],
        [(2.024855, 4.470224, 3.4), (1.624855, 4.470224, 3.8), (1.624855, 4.470224, 3.4)],
        [(2.024855, 4.470224, 3.4), (2.024855, 4.470224, 3.8), (1.624855, 4.470224, 3.8)],
        [(2.024855, 4.470224, 3.8), (1.624855, 4.52715, 3.804071), (1.624855, 4.470224, 3.8)],
        [(2.024855, 4.470224, 3.8), (2.024855, 4.52715, 3.804071), (1.624855, 4.52715, 3.804071)],
        [(2.024855, 4.52715, 3.804071), (1.624855, 4.582917, 3.816203), (1.624855, 4.52715, 3.804071)],
        [(2.024855, 4.52715, 3.804071), (2.024855, 4.582917, 3.816203), (1.624855, 4.582917, 3.816203)],
        [(2.024855, 4.582917, 3.816203), (1.624855, 4.63639, 3.836147), (1.624855, 4.582917, 3.816203)],
        [(2.024855, 4.582917, 3.816203), (2.024855, 4.63639, 3.836147), (1.624855, 4.63639, 3.836147)],
        [(2.024855, 4.63639, 3.836147), (1.624855, 4.68648, 3.863499), (1.624855, 4.63639, 3.836147)],
        [(2.024855, 4.63639, 3.836147), (2.024855, 4.68648, 3.863499), (1.624855, 4.68648, 3.863499)],
        [(2.024855, 4.68648, 3.863499), (1.624855, 4.732168, 3.8977), (1.624855, 4.68648, 3.863499)],
        [(2.024855, 4.68648, 3.863499), (2.024855, 4.732168, 3.8977), (1.624855, 4.732168, 3.8977)],
        [(2.024855, 4.732168, 3.8977), (1.624855, 4.772523, 3.938056), (1.624855, 4.732168, 3.8977)],
        [(2.024855, 4.732168, 3.8977), (2.024855, 4.772523, 3.938056), (1.624855, 4.772523, 3.938056)],
        [(2.024855, 4.772523, 3.938056), (1.624855, 4.806725, 3.983744), (1.624855, 4.772523, 3.938056)],
        [(2.024855, 4.772523, 3.938056), (2.024855, 4.806725, 3.983744), (1.624855, 4.806725, 3.983744)],
        [(2.024855, 4.806725, 3.983744), (1.624855, 4.834076, 4.033834), (1.624855, 4.806725, 3.983744)],
        [(2.024855, 4.806725, 3.983744), (2.024855, 4.834076, 4.033834), (1.624855, 4.834076, 4.033834)],
        [(2.024855, 4.834076, 4.033834), (1.624855, 4.854021, 4.087307), (1.624855, 4.834076, 4.033834)],
        [(2.024855, 4.834076, 4.033834), (2.024855, 4.854021, 4.087307), (1.624855, 4.854021, 4.087307)],
        [(2.024855, 4.854021, 4.087307), (1.624855, 4.866152, 4.143074), (1.624855, 4.854021, 4.087307)],
        [(2.024855, 4.854021, 4.087307), (2.024855, 4.866152, 4.143074), (1.624855, 4.866152, 4.143074)],
        [(2.024855, 4.866152, 4.143074), (1.624855, 4.870224, 4.2), (1.624855, 4.866152, 4.143074)],
        [(2.024855, 4.866152, 4.143074), (2.024855, 4.870224, 4.2), (1.624855, 4.870224, 4.2)],
        [(2.024855, 4.870224, 4.2), (1.624855, 5.270224, 4.2), (1.624855, 4.870224, 4.2)],
        [(2.024855, 4.870224, 4.2), (2.024855, 5.270224, 4.2), (1.624855, 5.270224, 4.2)],
        [(2.024855, 5.270224, 4.2), (1.624855, 5.262081, 4.086148), (1.624855, 5.270224, 4.2)],
        [(2.024855, 5.270224, 4.2), (2.024855, 5.262081, 4.086148), (1.624855, 5.262081, 4.086148)],
        [(2.024855, 5.262081, 4.086148), (1.624855, 5.237818, 3.974614), (1.624855, 5.262081, 4.086148)],
        [(2.024855, 5.262081, 4.086148), (2.024855, 5.237818, 3.974614), (1.624855, 5.237818, 3.974614)],
        [(2.024855, 5.237818, 3.974614), (1.624855, 5.197929, 3.867668), (1.624855, 5.237818, 3.974614)],
        [(2.024855, 5.237818, 3.974614), (2.024855, 5.197929, 3.867668), (1.624855, 5.197929, 3.867668)],
        [(2.024855, 5.197929, 3.867668), (1.624855, 5.143226, 3.767487), (1.624855, 5.197929, 3.867668)],
        [(2.024855, 5.197929, 3.867668), (2.024855, 5.143226, 3.767487), (1.624855, 5.143226, 3.767487)],
        [(2.024855, 5.143226, 3.767487), (1.624855, 5.074823, 3.676111), (1.624855, 5.143226, 3.767487)],
        [(2.024855, 5.143226, 3.767487), (2.024855, 5.074823, 3.676111), (1.624855, 5.074823, 3.676111)],
        [(2.024855, 5.074823, 3.676111), (1.624855, 4.994112, 3.5954), (1.624855, 5.074823, 3.676111)],
        [(2.024855, 5.074823, 3.676111), (2.024855, 4.994112, 3.5954), (1.624855, 4.994112, 3.5954)],
        [(2.024855, 4.994112, 3.5954), (1.624855, 4.902736, 3.526997), (1.624855, 4.994112, 3.5954)],
        [(2.024855, 4.994112, 3.5954), (2.024855, 4.902736, 3.526997), (1.624855, 4.902736, 3.526997)],
        [(2.024855, 4.902736, 3.526997), (1.624855, 4.802556, 3.472294), (1.624855, 4.902736, 3.526997)],
        [(2.024855, 4.902736, 3.526997), (2.024855, 4.802556, 3.472294), (1.624855, 4.802556, 3.472294)],
        [(2.024855, 4.802556, 3.472294), (1.624855, 4.69561, 3.432406), (1.624855, 4.802556, 3.472294)],
        [(2.024855, 4.802556, 3.472294), (2.024855, 4.69561, 3.432406), (1.624855, 4.69561, 3.432406)],
        [(2.024855, 4.69561, 3.432406), (1.624855, 4.584075, 3.408143), (1.624855, 4.69561, 3.432406)],
        [(2.024855, 4.69561, 3.432406), (2.024855, 4.584075, 3.408143), (1.624855, 4.584075, 3.408143)],
        [(2.024855, 4.584075, 3.408143), (1.624855, 4.470224, 3.4), (1.624855, 4.584075, 3.408143)],
        [(2.024855, 4.584075, 3.408143), (2.024855, 4.470224, 3.4), (1.624855, 4.470224, 3.4)],
    ]
    
    mesh = Mesh.from_polygons(triangles)
    mesh.remove_duplicate_vertices()
    
    print(mesh.is_manifold())
    print(mesh.is_connected())
    print(mesh.is_valid())
    print(mesh.is_trimesh())
    
    viewer = Viewer()
    viewer.scene.add(mesh)
    viewer.show()
  6. tomvanmele commented on Mar 28, 2025

    @tomvanmele
    Member
    Image
  7. tomvanmele commented on Mar 28, 2025

    @tomvanmele
    Member

    i get True for all print statements.

  8. tomvanmele commented on Mar 28, 2025

    @tomvanmele
    Member

    this is not what you're looking for?

  9. 2twenity commented on Mar 28, 2025

    @2twenity
    Author

    Maybe I've pasted already cleaned mesh, let me double check

  10. 2twenity commented on Mar 28, 2025

    @2twenity
    Author

    Interesting that rebuilding Mesh from coordinates only automatically removes duplicates.

    Image Image

    from 194 to 48 vertices

    Here's a list of faces, hope it helps to reproduce the initial mesh

    faces = [
    [23, 24, 0],
    [0, 1, 2],
    [11, 12, 13],
    [13, 14, 15],
    [15, 16, 17],
    [17, 18, 19],
    [19, 20, 21],
    [21, 22, 23],
    [23, 0, 2],
    [10, 11, 13],
    [13, 15, 17],
    [17, 19, 21],
    [21, 23, 2],
    [9, 10, 13],
    [13, 17, 21],
    [21, 2, 3],
    [8, 9, 13],
    [21, 3, 4],
    [7, 8, 13],
    [21, 4, 5],
    [6, 7, 13],
    [13, 21, 5],
    [5, 6, 13],
    [48, 25, 49],
    [25, 27, 26],
    [36, 38, 37],
    [38, 40, 39],
    [40, 42, 41],
    [42, 44, 43],
    [44, 46, 45],
    [46, 48, 47],
    [48, 27, 25],
    [35, 38, 36],
    [38, 42, 40],
    [42, 46, 44],
    [46, 27, 48],
    [34, 38, 35],
    [38, 46, 42],
    [46, 28, 27],
    [33, 38, 34],
    [46, 29, 28],
    [32, 38, 33],
    [46, 30, 29],
    [31, 38, 32],
    [38, 30, 46],
    [30, 38, 31],
    [50, 51, 52],
    [53, 54, 55],
    [56, 57, 58],
    [59, 60, 61],
    [62, 63, 64],
    [65, 66, 67],
    [68, 69, 70],
    [71, 72, 73],
    [74, 75, 76],
    [77, 78, 79],
    [80, 81, 82],
    [83, 84, 85],
    [86, 87, 88],
    [89, 90, 91],
    [92, 93, 94],
    [95, 96, 97],
    [98, 99, 100],
    [101, 102, 103],
    [104, 105, 106],
    [107, 108, 109],
    [110, 111, 112],
    [113, 114, 115],
    [116, 117, 118],
    [119, 120, 121],
    [122, 123, 124],
    [125, 126, 127],
    [128, 129, 130],
    [131, 132, 133],
    [134, 135, 136],
    [137, 138, 139],
    [140, 141, 142],
    [143, 144, 145],
    [146, 147, 148],
    [149, 150, 151],
    [152, 153, 154],
    [155, 156, 157],
    [158, 159, 160],
    [161, 162, 163],
    [164, 165, 166],
    [167, 168, 169],
    [170, 171, 172],
    [173, 174, 175],
    [176, 177, 178],
    [179, 180, 181],
    [182, 183, 184],
    [185, 186, 187],
    [188, 189, 190],
    [191, 192, 193]]

    Double checked vertices as well

    vertices = [
    [(1.624855, 4.584075, 3.408143), (1.624855, 4.470224, 3.4), (1.624855, 4.470224, 3.4)],
    [(1.624855, 4.470224, 3.4), (1.624855, 4.470224, 3.8), (1.624855, 4.52715, 3.804071)],
    [(1.624855, 4.866152, 4.143074), (1.624855, 4.870224, 4.2), (1.624855, 5.270224, 4.2)],
    [(1.624855, 5.270224, 4.2), (1.624855, 5.262081, 4.086148), (1.624855, 5.237818, 3.974614)],
    [(1.624855, 5.237818, 3.974614), (1.624855, 5.197929, 3.867668), (1.624855, 5.143226, 3.767487)],
    [(1.624855, 5.143226, 3.767487), (1.624855, 5.074823, 3.676111), (1.624855, 4.994112, 3.5954)],
    [(1.624855, 4.994112, 3.5954), (1.624855, 4.902736, 3.526997), (1.624855, 4.802556, 3.472294)],
    [(1.624855, 4.802556, 3.472294), (1.624855, 4.69561, 3.432406), (1.624855, 4.584075, 3.408143)],
    [(1.624855, 4.584075, 3.408143), (1.624855, 4.470224, 3.4), (1.624855, 4.52715, 3.804071)],
    [(1.624855, 4.854021, 4.087307), (1.624855, 4.866152, 4.143074), (1.624855, 5.270224, 4.2)],
    [(1.624855, 5.270224, 4.2), (1.624855, 5.237818, 3.974614), (1.624855, 5.143226, 3.767487)],
    [(1.624855, 5.143226, 3.767487), (1.624855, 4.994112, 3.5954), (1.624855, 4.802556, 3.472294)],
    [(1.624855, 4.802556, 3.472294), (1.624855, 4.584075, 3.408143), (1.624855, 4.52715, 3.804071)],
    [(1.624855, 4.834076, 4.033834), (1.624855, 4.854021, 4.087307), (1.624855, 5.270224, 4.2)],
    [(1.624855, 5.270224, 4.2), (1.624855, 5.143226, 3.767487), (1.624855, 4.802556, 3.472294)],
    [(1.624855, 4.802556, 3.472294), (1.624855, 4.52715, 3.804071), (1.624855, 4.582917, 3.816203)],
    [(1.624855, 4.806725, 3.983744), (1.624855, 4.834076, 4.033834), (1.624855, 5.270224, 4.2)],
    [(1.624855, 4.802556, 3.472294), (1.624855, 4.582917, 3.816203), (1.624855, 4.63639, 3.836147)],
    [(1.624855, 4.772523, 3.938056), (1.624855, 4.806725, 3.983744), (1.624855, 5.270224, 4.2)],
    [(1.624855, 4.802556, 3.472294), (1.624855, 4.63639, 3.836147), (1.624855, 4.68648, 3.863499)],
    [(1.624855, 4.732168, 3.8977), (1.624855, 4.772523, 3.938056), (1.624855, 5.270224, 4.2)],
    [(1.624855, 5.270224, 4.2), (1.624855, 4.802556, 3.472294), (1.624855, 4.68648, 3.863499)],
    [(1.624855, 4.68648, 3.863499), (1.624855, 4.732168, 3.8977), (1.624855, 5.270224, 4.2)],
    [(2.024855, 4.584075, 3.408143), (2.024855, 4.470224, 3.4), (2.024855, 4.470224, 3.4)],
    [(2.024855, 4.470224, 3.4), (2.024855, 4.52715, 3.804071), (2.024855, 4.470224, 3.8)],
    [(2.024855, 4.866152, 4.143074), (2.024855, 5.270224, 4.2), (2.024855, 4.870224, 4.2)],
    [(2.024855, 5.270224, 4.2), (2.024855, 5.237818, 3.974614), (2.024855, 5.262081, 4.086148)],
    [(2.024855, 5.237818, 3.974614), (2.024855, 5.143226, 3.767487), (2.024855, 5.197929, 3.867668)],
    [(2.024855, 5.143226, 3.767487), (2.024855, 4.994112, 3.5954), (2.024855, 5.074823, 3.676111)],
    [(2.024855, 4.994112, 3.5954), (2.024855, 4.802556, 3.472294), (2.024855, 4.902736, 3.526997)],
    [(2.024855, 4.802556, 3.472294), (2.024855, 4.584075, 3.408143), (2.024855, 4.69561, 3.432406)],
    [(2.024855, 4.584075, 3.408143), (2.024855, 4.52715, 3.804071), (2.024855, 4.470224, 3.4)],
    [(2.024855, 4.854021, 4.087307), (2.024855, 5.270224, 4.2), (2.024855, 4.866152, 4.143074)],
    [(2.024855, 5.270224, 4.2), (2.024855, 5.143226, 3.767487), (2.024855, 5.237818, 3.974614)],
    [(2.024855, 5.143226, 3.767487), (2.024855, 4.802556, 3.472294), (2.024855, 4.994112, 3.5954)],
    [(2.024855, 4.802556, 3.472294), (2.024855, 4.52715, 3.804071), (2.024855, 4.584075, 3.408143)],
    [(2.024855, 4.834076, 4.033834), (2.024855, 5.270224, 4.2), (2.024855, 4.854021, 4.087307)],
    [(2.024855, 5.270224, 4.2), (2.024855, 4.802556, 3.472294), (2.024855, 5.143226, 3.767487)],
    [(2.024855, 4.802556, 3.472294), (2.024855, 4.582917, 3.816203), (2.024855, 4.52715, 3.804071)],
    [(2.024855, 4.806725, 3.983744), (2.024855, 5.270224, 4.2), (2.024855, 4.834076, 4.033834)],
    [(2.024855, 4.802556, 3.472294), (2.024855, 4.63639, 3.836147), (2.024855, 4.582917, 3.816203)],
    [(2.024855, 4.772523, 3.938056), (2.024855, 5.270224, 4.2), (2.024855, 4.806725, 3.983744)],
    [(2.024855, 4.802556, 3.472294), (2.024855, 4.68648, 3.863499), (2.024855, 4.63639, 3.836147)],
    [(2.024855, 4.732168, 3.8977), (2.024855, 5.270224, 4.2), (2.024855, 4.772523, 3.938056)],
    [(2.024855, 5.270224, 4.2), (2.024855, 4.68648, 3.863499), (2.024855, 4.802556, 3.472294)],
    [(2.024855, 4.68648, 3.863499), (2.024855, 5.270224, 4.2), (2.024855, 4.732168, 3.8977)],
    [(2.024855, 4.470224, 3.4), (1.624855, 4.470224, 3.8), (1.624855, 4.470224, 3.4)],
    [(2.024855, 4.470224, 3.4), (2.024855, 4.470224, 3.8), (1.624855, 4.470224, 3.8)],
    [(2.024855, 4.470224, 3.8), (1.624855, 4.52715, 3.804071), (1.624855, 4.470224, 3.8)],
    [(2.024855, 4.470224, 3.8), (2.024855, 4.52715, 3.804071), (1.624855, 4.52715, 3.804071)],
    [(2.024855, 4.52715, 3.804071), (1.624855, 4.582917, 3.816203), (1.624855, 4.52715, 3.804071)],
    [(2.024855, 4.52715, 3.804071), (2.024855, 4.582917, 3.816203), (1.624855, 4.582917, 3.816203)],
    [(2.024855, 4.582917, 3.816203), (1.624855, 4.63639, 3.836147), (1.624855, 4.582917, 3.816203)],
    [(2.024855, 4.582917, 3.816203), (2.024855, 4.63639, 3.836147), (1.624855, 4.63639, 3.836147)],
    [(2.024855, 4.63639, 3.836147), (1.624855, 4.68648, 3.863499), (1.624855, 4.63639, 3.836147)],
    [(2.024855, 4.63639, 3.836147), (2.024855, 4.68648, 3.863499), (1.624855, 4.68648, 3.863499)],
    [(2.024855, 4.68648, 3.863499), (1.624855, 4.732168, 3.8977), (1.624855, 4.68648, 3.863499)],
    [(2.024855, 4.68648, 3.863499), (2.024855, 4.732168, 3.8977), (1.624855, 4.732168, 3.8977)],
    [(2.024855, 4.732168, 3.8977), (1.624855, 4.772523, 3.938056), (1.624855, 4.732168, 3.8977)],
    [(2.024855, 4.732168, 3.8977), (2.024855, 4.772523, 3.938056), (1.624855, 4.772523, 3.938056)],
    [(2.024855, 4.772523, 3.938056), (1.624855, 4.806725, 3.983744), (1.624855, 4.772523, 3.938056)],
    [(2.024855, 4.772523, 3.938056), (2.024855, 4.806725, 3.983744), (1.624855, 4.806725, 3.983744)],
    [(2.024855, 4.806725, 3.983744), (1.624855, 4.834076, 4.033834), (1.624855, 4.806725, 3.983744)],
    [(2.024855, 4.806725, 3.983744), (2.024855, 4.834076, 4.033834), (1.624855, 4.834076, 4.033834)],
    [(2.024855, 4.834076, 4.033834), (1.624855, 4.854021, 4.087307), (1.624855, 4.834076, 4.033834)],
    [(2.024855, 4.834076, 4.033834), (2.024855, 4.854021, 4.087307), (1.624855, 4.854021, 4.087307)],
    [(2.024855, 4.854021, 4.087307), (1.624855, 4.866152, 4.143074), (1.624855, 4.854021, 4.087307)],
    [(2.024855, 4.854021, 4.087307), (2.024855, 4.866152, 4.143074), (1.624855, 4.866152, 4.143074)],
    [(2.024855, 4.866152, 4.143074), (1.624855, 4.870224, 4.2), (1.624855, 4.866152, 4.143074)],
    [(2.024855, 4.866152, 4.143074), (2.024855, 4.870224, 4.2), (1.624855, 4.870224, 4.2)],
    [(2.024855, 4.870224, 4.2), (1.624855, 5.270224, 4.2), (1.624855, 4.870224, 4.2)],
    [(2.024855, 4.870224, 4.2), (2.024855, 5.270224, 4.2), (1.624855, 5.270224, 4.2)],
    [(2.024855, 5.270224, 4.2), (1.624855, 5.262081, 4.086148), (1.624855, 5.270224, 4.2)],
    [(2.024855, 5.270224, 4.2), (2.024855, 5.262081, 4.086148), (1.624855, 5.262081, 4.086148)],
    [(2.024855, 5.262081, 4.086148), (1.624855, 5.237818, 3.974614), (1.624855, 5.262081, 4.086148)],
    [(2.024855, 5.262081, 4.086148), (2.024855, 5.237818, 3.974614), (1.624855, 5.237818, 3.974614)],
    [(2.024855, 5.237818, 3.974614), (1.624855, 5.197929, 3.867668), (1.624855, 5.237818, 3.974614)],
    [(2.024855, 5.237818, 3.974614), (2.024855, 5.197929, 3.867668), (1.624855, 5.197929, 3.867668)],
    [(2.024855, 5.197929, 3.867668), (1.624855, 5.143226, 3.767487), (1.624855, 5.197929, 3.867668)],
    [(2.024855, 5.197929, 3.867668), (2.024855, 5.143226, 3.767487), (1.624855, 5.143226, 3.767487)],
    [(2.024855, 5.143226, 3.767487), (1.624855, 5.074823, 3.676111), (1.624855, 5.143226, 3.767487)],
    [(2.024855, 5.143226, 3.767487), (2.024855, 5.074823, 3.676111), (1.624855, 5.074823, 3.676111)],
    [(2.024855, 5.074823, 3.676111), (1.624855, 4.994112, 3.5954), (1.624855, 5.074823, 3.676111)],
    [(2.024855, 5.074823, 3.676111), (2.024855, 4.994112, 3.5954), (1.624855, 4.994112, 3.5954)],
    [(2.024855, 4.994112, 3.5954), (1.624855, 4.902736, 3.526997), (1.624855, 4.994112, 3.5954)],
    [(2.024855, 4.994112, 3.5954), (2.024855, 4.902736, 3.526997), (1.624855, 4.902736, 3.526997)],
    [(2.024855, 4.902736, 3.526997), (1.624855, 4.802556, 3.472294), (1.624855, 4.902736, 3.526997)],
    [(2.024855, 4.902736, 3.526997), (2.024855, 4.802556, 3.472294), (1.624855, 4.802556, 3.472294)],
    [(2.024855, 4.802556, 3.472294), (1.624855, 4.69561, 3.432406), (1.624855, 4.802556, 3.472294)],
    [(2.024855, 4.802556, 3.472294), (2.024855, 4.69561, 3.432406), (1.624855, 4.69561, 3.432406)],
    [(2.024855, 4.69561, 3.432406), (1.624855, 4.584075, 3.408143), (1.624855, 4.69561, 3.432406)],
    [(2.024855, 4.69561, 3.432406), (2.024855, 4.584075, 3.408143), (1.624855, 4.584075, 3.408143)],
    [(2.024855, 4.584075, 3.408143), (1.624855, 4.470224, 3.4), (1.624855, 4.584075, 3.408143)],
    [(2.024855, 4.584075, 3.408143), (2.024855, 4.470224, 3.4), (1.624855, 4.470224, 3.4)]]
  11. 2twenity commented on Mar 28, 2025

    @2twenity
    Author

    Vertices as a 1d list

    vertices = [
    [1.624855, 4.470224, 3.4],
    [1.624855, 4.470224, 3.8],
    [1.624855, 4.52715, 3.804071],
    [1.624855, 4.582917, 3.816203],
    [1.624855, 4.63639, 3.836147],
    [1.624855, 4.68648, 3.863499],
    [1.624855, 4.732168, 3.8977],
    [1.624855, 4.772523, 3.938056],
    [1.624855, 4.806725, 3.983744],
    [1.624855, 4.834076, 4.033834],
    [1.624855, 4.854021, 4.087307],
    [1.624855, 4.866152, 4.143074],
    [1.624855, 4.870224, 4.2],
    [1.624855, 5.270224, 4.2],
    [1.624855, 5.262081, 4.086148],
    [1.624855, 5.237818, 3.974614],
    [1.624855, 5.197929, 3.867668],
    [1.624855, 5.143226, 3.767487],
    [1.624855, 5.074823, 3.676111],
    [1.624855, 4.994112, 3.5954],
    [1.624855, 4.902736, 3.526997],
    [1.624855, 4.802556, 3.472294],
    [1.624855, 4.69561, 3.432406],
    [1.624855, 4.584075, 3.408143],
    [1.624855, 4.470224, 3.4],
    [2.024855, 4.470224, 3.4],
    [2.024855, 4.470224, 3.8],
    [2.024855, 4.52715, 3.804071],
    [2.024855, 4.582917, 3.816203],
    [2.024855, 4.63639, 3.836147],
    [2.024855, 4.68648, 3.863499],
    [2.024855, 4.732168, 3.8977],
    [2.024855, 4.772523, 3.938056],
    [2.024855, 4.806725, 3.983744],
    [2.024855, 4.834076, 4.033834],
    [2.024855, 4.854021, 4.087307],
    [2.024855, 4.866152, 4.143074],
    [2.024855, 4.870224, 4.2],
    [2.024855, 5.270224, 4.2],
    [2.024855, 5.262081, 4.086148],
    [2.024855, 5.237818, 3.974614],
    [2.024855, 5.197929, 3.867668],
    [2.024855, 5.143226, 3.767487],
    [2.024855, 5.074823, 3.676111],
    [2.024855, 4.994112, 3.5954],
    [2.024855, 4.902736, 3.526997],
    [2.024855, 4.802556, 3.472294],
    [2.024855, 4.69561, 3.432406],
    [2.024855, 4.584075, 3.408143],
    [2.024855, 4.470224, 3.4],
    [2.024855, 4.470224, 3.4],
    [1.624855, 4.470224, 3.8],
    [1.624855, 4.470224, 3.4],
    [2.024855, 4.470224, 3.4],
    [2.024855, 4.470224, 3.8],
    [1.624855, 4.470224, 3.8],
    [2.024855, 4.470224, 3.8],
    [1.624855, 4.52715, 3.804071],
    [1.624855, 4.470224, 3.8],
    [2.024855, 4.470224, 3.8],
    [2.024855, 4.52715, 3.804071],
    [1.624855, 4.52715, 3.804071],
    [2.024855, 4.52715, 3.804071],
    [1.624855, 4.582917, 3.816203],
    [1.624855, 4.52715, 3.804071],
    [2.024855, 4.52715, 3.804071],
    [2.024855, 4.582917, 3.816203],
    [1.624855, 4.582917, 3.816203],
    [2.024855, 4.582917, 3.816203],
    [1.624855, 4.63639, 3.836147],
    [1.624855, 4.582917, 3.816203],
    [2.024855, 4.582917, 3.816203],
    [2.024855, 4.63639, 3.836147],
    [1.624855, 4.63639, 3.836147],
    [2.024855, 4.63639, 3.836147],
    [1.624855, 4.68648, 3.863499],
    [1.624855, 4.63639, 3.836147],
    [2.024855, 4.63639, 3.836147],
    [2.024855, 4.68648, 3.863499],
    [1.624855, 4.68648, 3.863499],
    [2.024855, 4.68648, 3.863499],
    [1.624855, 4.732168, 3.8977],
    [1.624855, 4.68648, 3.863499],
    [2.024855, 4.68648, 3.863499],
    [2.024855, 4.732168, 3.8977],
    [1.624855, 4.732168, 3.8977],
    [2.024855, 4.732168, 3.8977],
    [1.624855, 4.772523, 3.938056],
    [1.624855, 4.732168, 3.8977],
    [2.024855, 4.732168, 3.8977],
    [2.024855, 4.772523, 3.938056],
    [1.624855, 4.772523, 3.938056],
    [2.024855, 4.772523, 3.938056],
    [1.624855, 4.806725, 3.983744],
    [1.624855, 4.772523, 3.938056],
    [2.024855, 4.772523, 3.938056],
    [2.024855, 4.806725, 3.983744],
    [1.624855, 4.806725, 3.983744],
    [2.024855, 4.806725, 3.983744],
    [1.624855, 4.834076, 4.033834],
    [1.624855, 4.806725, 3.983744],
    [2.024855, 4.806725, 3.983744],
    [2.024855, 4.834076, 4.033834],
    [1.624855, 4.834076, 4.033834],
    [2.024855, 4.834076, 4.033834],
    [1.624855, 4.854021, 4.087307],
    [1.624855, 4.834076, 4.033834],
    [2.024855, 4.834076, 4.033834],
    [2.024855, 4.854021, 4.087307],
    [1.624855, 4.854021, 4.087307],
    [2.024855, 4.854021, 4.087307],
    [1.624855, 4.866152, 4.143074],
    [1.624855, 4.854021, 4.087307],
    [2.024855, 4.854021, 4.087307],
    [2.024855, 4.866152, 4.143074],
    [1.624855, 4.866152, 4.143074],
    [2.024855, 4.866152, 4.143074],
    [1.624855, 4.870224, 4.2],
    [1.624855, 4.866152, 4.143074],
    [2.024855, 4.866152, 4.143074],
    [2.024855, 4.870224, 4.2],
    [1.624855, 4.870224, 4.2],
    [2.024855, 4.870224, 4.2],
    [1.624855, 5.270224, 4.2],
    [1.624855, 4.870224, 4.2],
    [2.024855, 4.870224, 4.2],
    [2.024855, 5.270224, 4.2],
    [1.624855, 5.270224, 4.2],
    [2.024855, 5.270224, 4.2],
    [1.624855, 5.262081, 4.086148],
    [1.624855, 5.270224, 4.2],
    [2.024855, 5.270224, 4.2],
    [2.024855, 5.262081, 4.086148],
    [1.624855, 5.262081, 4.086148],
    [2.024855, 5.262081, 4.086148],
    [1.624855, 5.237818, 3.974614],
    [1.624855, 5.262081, 4.086148],
    [2.024855, 5.262081, 4.086148],
    [2.024855, 5.237818, 3.974614],
    [1.624855, 5.237818, 3.974614],
    [2.024855, 5.237818, 3.974614],
    [1.624855, 5.197929, 3.867668],
    [1.624855, 5.237818, 3.974614],
    [2.024855, 5.237818, 3.974614],
    [2.024855, 5.197929, 3.867668],
    [1.624855, 5.197929, 3.867668],
    [2.024855, 5.197929, 3.867668],
    [1.624855, 5.143226, 3.767487],
    [1.624855, 5.197929, 3.867668],
    [2.024855, 5.197929, 3.867668],
    [2.024855, 5.143226, 3.767487],
    [1.624855, 5.143226, 3.767487],
    [2.024855, 5.143226, 3.767487],
    [1.624855, 5.074823, 3.676111],
    [1.624855, 5.143226, 3.767487],
    [2.024855, 5.143226, 3.767487],
    [2.024855, 5.074823, 3.676111],
    [1.624855, 5.074823, 3.676111],
    [2.024855, 5.074823, 3.676111],
    [1.624855, 4.994112, 3.5954],
    [1.624855, 5.074823, 3.676111],
    [2.024855, 5.074823, 3.676111],
    [2.024855, 4.994112, 3.5954],
    [1.624855, 4.994112, 3.5954],
    [2.024855, 4.994112, 3.5954],
    [1.624855, 4.902736, 3.526997],
    [1.624855, 4.994112, 3.5954],
    [2.024855, 4.994112, 3.5954],
    [2.024855, 4.902736, 3.526997],
    [1.624855, 4.902736, 3.526997],
    [2.024855, 4.902736, 3.526997],
    [1.624855, 4.802556, 3.472294],
    [1.624855, 4.902736, 3.526997],
    [2.024855, 4.902736, 3.526997],
    [2.024855, 4.802556, 3.472294],
    [1.624855, 4.802556, 3.472294],
    [2.024855, 4.802556, 3.472294],
    [1.624855, 4.69561, 3.432406],
    [1.624855, 4.802556, 3.472294],
    [2.024855, 4.802556, 3.472294],
    [2.024855, 4.69561, 3.432406],
    [1.624855, 4.69561, 3.432406],
    [2.024855, 4.69561, 3.432406],
    [1.624855, 4.584075, 3.408143],
    [1.624855, 4.69561, 3.432406],
    [2.024855, 4.69561, 3.432406],
    [2.024855, 4.584075, 3.408143],
    [1.624855, 4.584075, 3.408143],
    [2.024855, 4.584075, 3.408143],
    [1.624855, 4.470224, 3.4],
    [1.624855, 4.584075, 3.408143],
    [2.024855, 4.584075, 3.408143],
    [2.024855, 4.470224, 3.4],
    [1.624855, 4.470224, 3.4],
    ]
  12. tomvanmele commented on Mar 28, 2025

    @tomvanmele
    Member

    thanks, will have a look. tomorrow though :)

  13. tomvanmele commented on Mar 28, 2025

    @tomvanmele
    Member
    from compas.datastructures import Mesh
    from compas_viewer import Viewer
    
    faces = [
        [23, 24, 0],
        [0, 1, 2],
        [11, 12, 13],
        [13, 14, 15],
        [15, 16, 17],
        [17, 18, 19],
        [19, 20, 21],
        [21, 22, 23],
        [23, 0, 2],
        [10, 11, 13],
        [13, 15, 17],
        [17, 19, 21],
        [21, 23, 2],
        [9, 10, 13],
        [13, 17, 21],
        [21, 2, 3],
        [8, 9, 13],
        [21, 3, 4],
        [7, 8, 13],
        [21, 4, 5],
        [6, 7, 13],
        [13, 21, 5],
        [5, 6, 13],
        [48, 25, 49],
        [25, 27, 26],
        [36, 38, 37],
        [38, 40, 39],
        [40, 42, 41],
        [42, 44, 43],
        [44, 46, 45],
        [46, 48, 47],
        [48, 27, 25],
        [35, 38, 36],
        [38, 42, 40],
        [42, 46, 44],
        [46, 27, 48],
        [34, 38, 35],
        [38, 46, 42],
        [46, 28, 27],
        [33, 38, 34],
        [46, 29, 28],
        [32, 38, 33],
        [46, 30, 29],
        [31, 38, 32],
        [38, 30, 46],
        [30, 38, 31],
        [50, 51, 52],
        [53, 54, 55],
        [56, 57, 58],
        [59, 60, 61],
        [62, 63, 64],
        [65, 66, 67],
        [68, 69, 70],
        [71, 72, 73],
        [74, 75, 76],
        [77, 78, 79],
        [80, 81, 82],
        [83, 84, 85],
        [86, 87, 88],
        [89, 90, 91],
        [92, 93, 94],
        [95, 96, 97],
        [98, 99, 100],
        [101, 102, 103],
        [104, 105, 106],
        [107, 108, 109],
        [110, 111, 112],
        [113, 114, 115],
        [116, 117, 118],
        [119, 120, 121],
        [122, 123, 124],
        [125, 126, 127],
        [128, 129, 130],
        [131, 132, 133],
        [134, 135, 136],
        [137, 138, 139],
        [140, 141, 142],
        [143, 144, 145],
        [146, 147, 148],
        [149, 150, 151],
        [152, 153, 154],
        [155, 156, 157],
        [158, 159, 160],
        [161, 162, 163],
        [164, 165, 166],
        [167, 168, 169],
        [170, 171, 172],
        [173, 174, 175],
        [176, 177, 178],
        [179, 180, 181],
        [182, 183, 184],
        [185, 186, 187],
        [188, 189, 190],
        [191, 192, 193],
    ]
    
    vertices = [
        [1.624855, 4.470224, 3.4],
        [1.624855, 4.470224, 3.8],
        [1.624855, 4.52715, 3.804071],
        [1.624855, 4.582917, 3.816203],
        [1.624855, 4.63639, 3.836147],
        [1.624855, 4.68648, 3.863499],
        [1.624855, 4.732168, 3.8977],
        [1.624855, 4.772523, 3.938056],
        [1.624855, 4.806725, 3.983744],
        [1.624855, 4.834076, 4.033834],
        [1.624855, 4.854021, 4.087307],
        [1.624855, 4.866152, 4.143074],
        [1.624855, 4.870224, 4.2],
        [1.624855, 5.270224, 4.2],
        [1.624855, 5.262081, 4.086148],
        [1.624855, 5.237818, 3.974614],
        [1.624855, 5.197929, 3.867668],
        [1.624855, 5.143226, 3.767487],
        [1.624855, 5.074823, 3.676111],
        [1.624855, 4.994112, 3.5954],
        [1.624855, 4.902736, 3.526997],
        [1.624855, 4.802556, 3.472294],
        [1.624855, 4.69561, 3.432406],
        [1.624855, 4.584075, 3.408143],
        [1.624855, 4.470224, 3.4],
        [2.024855, 4.470224, 3.4],
        [2.024855, 4.470224, 3.8],
        [2.024855, 4.52715, 3.804071],
        [2.024855, 4.582917, 3.816203],
        [2.024855, 4.63639, 3.836147],
        [2.024855, 4.68648, 3.863499],
        [2.024855, 4.732168, 3.8977],
        [2.024855, 4.772523, 3.938056],
        [2.024855, 4.806725, 3.983744],
        [2.024855, 4.834076, 4.033834],
        [2.024855, 4.854021, 4.087307],
        [2.024855, 4.866152, 4.143074],
        [2.024855, 4.870224, 4.2],
        [2.024855, 5.270224, 4.2],
        [2.024855, 5.262081, 4.086148],
        [2.024855, 5.237818, 3.974614],
        [2.024855, 5.197929, 3.867668],
        [2.024855, 5.143226, 3.767487],
        [2.024855, 5.074823, 3.676111],
        [2.024855, 4.994112, 3.5954],
        [2.024855, 4.902736, 3.526997],
        [2.024855, 4.802556, 3.472294],
        [2.024855, 4.69561, 3.432406],
        [2.024855, 4.584075, 3.408143],
        [2.024855, 4.470224, 3.4],
        [2.024855, 4.470224, 3.4],
        [1.624855, 4.470224, 3.8],
        [1.624855, 4.470224, 3.4],
        [2.024855, 4.470224, 3.4],
        [2.024855, 4.470224, 3.8],
        [1.624855, 4.470224, 3.8],
        [2.024855, 4.470224, 3.8],
        [1.624855, 4.52715, 3.804071],
        [1.624855, 4.470224, 3.8],
        [2.024855, 4.470224, 3.8],
        [2.024855, 4.52715, 3.804071],
        [1.624855, 4.52715, 3.804071],
        [2.024855, 4.52715, 3.804071],
        [1.624855, 4.582917, 3.816203],
        [1.624855, 4.52715, 3.804071],
        [2.024855, 4.52715, 3.804071],
        [2.024855, 4.582917, 3.816203],
        [1.624855, 4.582917, 3.816203],
        [2.024855, 4.582917, 3.816203],
        [1.624855, 4.63639, 3.836147],
        [1.624855, 4.582917, 3.816203],
        [2.024855, 4.582917, 3.816203],
        [2.024855, 4.63639, 3.836147],
        [1.624855, 4.63639, 3.836147],
        [2.024855, 4.63639, 3.836147],
        [1.624855, 4.68648, 3.863499],
        [1.624855, 4.63639, 3.836147],
        [2.024855, 4.63639, 3.836147],
        [2.024855, 4.68648, 3.863499],
        [1.624855, 4.68648, 3.863499],
        [2.024855, 4.68648, 3.863499],
        [1.624855, 4.732168, 3.8977],
        [1.624855, 4.68648, 3.863499],
        [2.024855, 4.68648, 3.863499],
        [2.024855, 4.732168, 3.8977],
        [1.624855, 4.732168, 3.8977],
        [2.024855, 4.732168, 3.8977],
        [1.624855, 4.772523, 3.938056],
        [1.624855, 4.732168, 3.8977],
        [2.024855, 4.732168, 3.8977],
        [2.024855, 4.772523, 3.938056],
        [1.624855, 4.772523, 3.938056],
        [2.024855, 4.772523, 3.938056],
        [1.624855, 4.806725, 3.983744],
        [1.624855, 4.772523, 3.938056],
        [2.024855, 4.772523, 3.938056],
        [2.024855, 4.806725, 3.983744],
        [1.624855, 4.806725, 3.983744],
        [2.024855, 4.806725, 3.983744],
        [1.624855, 4.834076, 4.033834],
        [1.624855, 4.806725, 3.983744],
        [2.024855, 4.806725, 3.983744],
        [2.024855, 4.834076, 4.033834],
        [1.624855, 4.834076, 4.033834],
        [2.024855, 4.834076, 4.033834],
        [1.624855, 4.854021, 4.087307],
        [1.624855, 4.834076, 4.033834],
        [2.024855, 4.834076, 4.033834],
        [2.024855, 4.854021, 4.087307],
        [1.624855, 4.854021, 4.087307],
        [2.024855, 4.854021, 4.087307],
        [1.624855, 4.866152, 4.143074],
        [1.624855, 4.854021, 4.087307],
        [2.024855, 4.854021, 4.087307],
        [2.024855, 4.866152, 4.143074],
        [1.624855, 4.866152, 4.143074],
        [2.024855, 4.866152, 4.143074],
        [1.624855, 4.870224, 4.2],
        [1.624855, 4.866152, 4.143074],
        [2.024855, 4.866152, 4.143074],
        [2.024855, 4.870224, 4.2],
        [1.624855, 4.870224, 4.2],
        [2.024855, 4.870224, 4.2],
        [1.624855, 5.270224, 4.2],
        [1.624855, 4.870224, 4.2],
        [2.024855, 4.870224, 4.2],
        [2.024855, 5.270224, 4.2],
        [1.624855, 5.270224, 4.2],
        [2.024855, 5.270224, 4.2],
        [1.624855, 5.262081, 4.086148],
        [1.624855, 5.270224, 4.2],
        [2.024855, 5.270224, 4.2],
        [2.024855, 5.262081, 4.086148],
        [1.624855, 5.262081, 4.086148],
        [2.024855, 5.262081, 4.086148],
        [1.624855, 5.237818, 3.974614],
        [1.624855, 5.262081, 4.086148],
        [2.024855, 5.262081, 4.086148],
        [2.024855, 5.237818, 3.974614],
        [1.624855, 5.237818, 3.974614],
        [2.024855, 5.237818, 3.974614],
        [1.624855, 5.197929, 3.867668],
        [1.624855, 5.237818, 3.974614],
        [2.024855, 5.237818, 3.974614],
        [2.024855, 5.197929, 3.867668],
        [1.624855, 5.197929, 3.867668],
        [2.024855, 5.197929, 3.867668],
        [1.624855, 5.143226, 3.767487],
        [1.624855, 5.197929, 3.867668],
        [2.024855, 5.197929, 3.867668],
        [2.024855, 5.143226, 3.767487],
        [1.624855, 5.143226, 3.767487],
        [2.024855, 5.143226, 3.767487],
        [1.624855, 5.074823, 3.676111],
        [1.624855, 5.143226, 3.767487],
        [2.024855, 5.143226, 3.767487],
        [2.024855, 5.074823, 3.676111],
        [1.624855, 5.074823, 3.676111],
        [2.024855, 5.074823, 3.676111],
        [1.624855, 4.994112, 3.5954],
        [1.624855, 5.074823, 3.676111],
        [2.024855, 5.074823, 3.676111],
        [2.024855, 4.994112, 3.5954],
        [1.624855, 4.994112, 3.5954],
        [2.024855, 4.994112, 3.5954],
        [1.624855, 4.902736, 3.526997],
        [1.624855, 4.994112, 3.5954],
        [2.024855, 4.994112, 3.5954],
        [2.024855, 4.902736, 3.526997],
        [1.624855, 4.902736, 3.526997],
        [2.024855, 4.902736, 3.526997],
        [1.624855, 4.802556, 3.472294],
        [1.624855, 4.902736, 3.526997],
        [2.024855, 4.902736, 3.526997],
        [2.024855, 4.802556, 3.472294],
        [1.624855, 4.802556, 3.472294],
        [2.024855, 4.802556, 3.472294],
        [1.624855, 4.69561, 3.432406],
        [1.624855, 4.802556, 3.472294],
        [2.024855, 4.802556, 3.472294],
        [2.024855, 4.69561, 3.432406],
        [1.624855, 4.69561, 3.432406],
        [2.024855, 4.69561, 3.432406],
        [1.624855, 4.584075, 3.408143],
        [1.624855, 4.69561, 3.432406],
        [2.024855, 4.69561, 3.432406],
        [2.024855, 4.584075, 3.408143],
        [1.624855, 4.584075, 3.408143],
        [2.024855, 4.584075, 3.408143],
        [1.624855, 4.470224, 3.4],
        [1.624855, 4.584075, 3.408143],
        [2.024855, 4.584075, 3.408143],
        [2.024855, 4.470224, 3.4],
        [1.624855, 4.470224, 3.4],
    ]
    
    triangles = [
        [(1.624855, 4.584075, 3.408143), (1.624855, 4.470224, 3.4), (1.624855, 4.470224, 3.4)],
        [(1.624855, 4.470224, 3.4), (1.624855, 4.470224, 3.8), (1.624855, 4.52715, 3.804071)],
        [(1.624855, 4.866152, 4.143074), (1.624855, 4.870224, 4.2), (1.624855, 5.270224, 4.2)],
        [(1.624855, 5.270224, 4.2), (1.624855, 5.262081, 4.086148), (1.624855, 5.237818, 3.974614)],
        [(1.624855, 5.237818, 3.974614), (1.624855, 5.197929, 3.867668), (1.624855, 5.143226, 3.767487)],
        [(1.624855, 5.143226, 3.767487), (1.624855, 5.074823, 3.676111), (1.624855, 4.994112, 3.5954)],
        [(1.624855, 4.994112, 3.5954), (1.624855, 4.902736, 3.526997), (1.624855, 4.802556, 3.472294)],
        [(1.624855, 4.802556, 3.472294), (1.624855, 4.69561, 3.432406), (1.624855, 4.584075, 3.408143)],
        [(1.624855, 4.584075, 3.408143), (1.624855, 4.470224, 3.4), (1.624855, 4.52715, 3.804071)],
        [(1.624855, 4.854021, 4.087307), (1.624855, 4.866152, 4.143074), (1.624855, 5.270224, 4.2)],
        [(1.624855, 5.270224, 4.2), (1.624855, 5.237818, 3.974614), (1.624855, 5.143226, 3.767487)],
        [(1.624855, 5.143226, 3.767487), (1.624855, 4.994112, 3.5954), (1.624855, 4.802556, 3.472294)],
        [(1.624855, 4.802556, 3.472294), (1.624855, 4.584075, 3.408143), (1.624855, 4.52715, 3.804071)],
        [(1.624855, 4.834076, 4.033834), (1.624855, 4.854021, 4.087307), (1.624855, 5.270224, 4.2)],
        [(1.624855, 5.270224, 4.2), (1.624855, 5.143226, 3.767487), (1.624855, 4.802556, 3.472294)],
        [(1.624855, 4.802556, 3.472294), (1.624855, 4.52715, 3.804071), (1.624855, 4.582917, 3.816203)],
        [(1.624855, 4.806725, 3.983744), (1.624855, 4.834076, 4.033834), (1.624855, 5.270224, 4.2)],
        [(1.624855, 4.802556, 3.472294), (1.624855, 4.582917, 3.816203), (1.624855, 4.63639, 3.836147)],
        [(1.624855, 4.772523, 3.938056), (1.624855, 4.806725, 3.983744), (1.624855, 5.270224, 4.2)],
        [(1.624855, 4.802556, 3.472294), (1.624855, 4.63639, 3.836147), (1.624855, 4.68648, 3.863499)],
        [(1.624855, 4.732168, 3.8977), (1.624855, 4.772523, 3.938056), (1.624855, 5.270224, 4.2)],
        [(1.624855, 5.270224, 4.2), (1.624855, 4.802556, 3.472294), (1.624855, 4.68648, 3.863499)],
        [(1.624855, 4.68648, 3.863499), (1.624855, 4.732168, 3.8977), (1.624855, 5.270224, 4.2)],
        [(2.024855, 4.584075, 3.408143), (2.024855, 4.470224, 3.4), (2.024855, 4.470224, 3.4)],
        [(2.024855, 4.470224, 3.4), (2.024855, 4.52715, 3.804071), (2.024855, 4.470224, 3.8)],
        [(2.024855, 4.866152, 4.143074), (2.024855, 5.270224, 4.2), (2.024855, 4.870224, 4.2)],
        [(2.024855, 5.270224, 4.2), (2.024855, 5.237818, 3.974614), (2.024855, 5.262081, 4.086148)],
        [(2.024855, 5.237818, 3.974614), (2.024855, 5.143226, 3.767487), (2.024855, 5.197929, 3.867668)],
        [(2.024855, 5.143226, 3.767487), (2.024855, 4.994112, 3.5954), (2.024855, 5.074823, 3.676111)],
        [(2.024855, 4.994112, 3.5954), (2.024855, 4.802556, 3.472294), (2.024855, 4.902736, 3.526997)],
        [(2.024855, 4.802556, 3.472294), (2.024855, 4.584075, 3.408143), (2.024855, 4.69561, 3.432406)],
        [(2.024855, 4.584075, 3.408143), (2.024855, 4.52715, 3.804071), (2.024855, 4.470224, 3.4)],
        [(2.024855, 4.854021, 4.087307), (2.024855, 5.270224, 4.2), (2.024855, 4.866152, 4.143074)],
        [(2.024855, 5.270224, 4.2), (2.024855, 5.143226, 3.767487), (2.024855, 5.237818, 3.974614)],
        [(2.024855, 5.143226, 3.767487), (2.024855, 4.802556, 3.472294), (2.024855, 4.994112, 3.5954)],
        [(2.024855, 4.802556, 3.472294), (2.024855, 4.52715, 3.804071), (2.024855, 4.584075, 3.408143)],
        [(2.024855, 4.834076, 4.033834), (2.024855, 5.270224, 4.2), (2.024855, 4.854021, 4.087307)],
        [(2.024855, 5.270224, 4.2), (2.024855, 4.802556, 3.472294), (2.024855, 5.143226, 3.767487)],
        [(2.024855, 4.802556, 3.472294), (2.024855, 4.582917, 3.816203), (2.024855, 4.52715, 3.804071)],
        [(2.024855, 4.806725, 3.983744), (2.024855, 5.270224, 4.2), (2.024855, 4.834076, 4.033834)],
        [(2.024855, 4.802556, 3.472294), (2.024855, 4.63639, 3.836147), (2.024855, 4.582917, 3.816203)],
        [(2.024855, 4.772523, 3.938056), (2.024855, 5.270224, 4.2), (2.024855, 4.806725, 3.983744)],
        [(2.024855, 4.802556, 3.472294), (2.024855, 4.68648, 3.863499), (2.024855, 4.63639, 3.836147)],
        [(2.024855, 4.732168, 3.8977), (2.024855, 5.270224, 4.2), (2.024855, 4.772523, 3.938056)],
        [(2.024855, 5.270224, 4.2), (2.024855, 4.68648, 3.863499), (2.024855, 4.802556, 3.472294)],
        [(2.024855, 4.68648, 3.863499), (2.024855, 5.270224, 4.2), (2.024855, 4.732168, 3.8977)],
        [(2.024855, 4.470224, 3.4), (1.624855, 4.470224, 3.8), (1.624855, 4.470224, 3.4)],
        [(2.024855, 4.470224, 3.4), (2.024855, 4.470224, 3.8), (1.624855, 4.470224, 3.8)],
        [(2.024855, 4.470224, 3.8), (1.624855, 4.52715, 3.804071), (1.624855, 4.470224, 3.8)],
        [(2.024855, 4.470224, 3.8), (2.024855, 4.52715, 3.804071), (1.624855, 4.52715, 3.804071)],
        [(2.024855, 4.52715, 3.804071), (1.624855, 4.582917, 3.816203), (1.624855, 4.52715, 3.804071)],
        [(2.024855, 4.52715, 3.804071), (2.024855, 4.582917, 3.816203), (1.624855, 4.582917, 3.816203)],
        [(2.024855, 4.582917, 3.816203), (1.624855, 4.63639, 3.836147), (1.624855, 4.582917, 3.816203)],
        [(2.024855, 4.582917, 3.816203), (2.024855, 4.63639, 3.836147), (1.624855, 4.63639, 3.836147)],
        [(2.024855, 4.63639, 3.836147), (1.624855, 4.68648, 3.863499), (1.624855, 4.63639, 3.836147)],
        [(2.024855, 4.63639, 3.836147), (2.024855, 4.68648, 3.863499), (1.624855, 4.68648, 3.863499)],
        [(2.024855, 4.68648, 3.863499), (1.624855, 4.732168, 3.8977), (1.624855, 4.68648, 3.863499)],
        [(2.024855, 4.68648, 3.863499), (2.024855, 4.732168, 3.8977), (1.624855, 4.732168, 3.8977)],
        [(2.024855, 4.732168, 3.8977), (1.624855, 4.772523, 3.938056), (1.624855, 4.732168, 3.8977)],
        [(2.024855, 4.732168, 3.8977), (2.024855, 4.772523, 3.938056), (1.624855, 4.772523, 3.938056)],
        [(2.024855, 4.772523, 3.938056), (1.624855, 4.806725, 3.983744), (1.624855, 4.772523, 3.938056)],
        [(2.024855, 4.772523, 3.938056), (2.024855, 4.806725, 3.983744), (1.624855, 4.806725, 3.983744)],
        [(2.024855, 4.806725, 3.983744), (1.624855, 4.834076, 4.033834), (1.624855, 4.806725, 3.983744)],
        [(2.024855, 4.806725, 3.983744), (2.024855, 4.834076, 4.033834), (1.624855, 4.834076, 4.033834)],
        [(2.024855, 4.834076, 4.033834), (1.624855, 4.854021, 4.087307), (1.624855, 4.834076, 4.033834)],
        [(2.024855, 4.834076, 4.033834), (2.024855, 4.854021, 4.087307), (1.624855, 4.854021, 4.087307)],
        [(2.024855, 4.854021, 4.087307), (1.624855, 4.866152, 4.143074), (1.624855, 4.854021, 4.087307)],
        [(2.024855, 4.854021, 4.087307), (2.024855, 4.866152, 4.143074), (1.624855, 4.866152, 4.143074)],
        [(2.024855, 4.866152, 4.143074), (1.624855, 4.870224, 4.2), (1.624855, 4.866152, 4.143074)],
        [(2.024855, 4.866152, 4.143074), (2.024855, 4.870224, 4.2), (1.624855, 4.870224, 4.2)],
        [(2.024855, 4.870224, 4.2), (1.624855, 5.270224, 4.2), (1.624855, 4.870224, 4.2)],
        [(2.024855, 4.870224, 4.2), (2.024855, 5.270224, 4.2), (1.624855, 5.270224, 4.2)],
        [(2.024855, 5.270224, 4.2), (1.624855, 5.262081, 4.086148), (1.624855, 5.270224, 4.2)],
        [(2.024855, 5.270224, 4.2), (2.024855, 5.262081, 4.086148), (1.624855, 5.262081, 4.086148)],
        [(2.024855, 5.262081, 4.086148), (1.624855, 5.237818, 3.974614), (1.624855, 5.262081, 4.086148)],
        [(2.024855, 5.262081, 4.086148), (2.024855, 5.237818, 3.974614), (1.624855, 5.237818, 3.974614)],
        [(2.024855, 5.237818, 3.974614), (1.624855, 5.197929, 3.867668), (1.624855, 5.237818, 3.974614)],
        [(2.024855, 5.237818, 3.974614), (2.024855, 5.197929, 3.867668), (1.624855, 5.197929, 3.867668)],
        [(2.024855, 5.197929, 3.867668), (1.624855, 5.143226, 3.767487), (1.624855, 5.197929, 3.867668)],
        [(2.024855, 5.197929, 3.867668), (2.024855, 5.143226, 3.767487), (1.624855, 5.143226, 3.767487)],
        [(2.024855, 5.143226, 3.767487), (1.624855, 5.074823, 3.676111), (1.624855, 5.143226, 3.767487)],
        [(2.024855, 5.143226, 3.767487), (2.024855, 5.074823, 3.676111), (1.624855, 5.074823, 3.676111)],
        [(2.024855, 5.074823, 3.676111), (1.624855, 4.994112, 3.5954), (1.624855, 5.074823, 3.676111)],
        [(2.024855, 5.074823, 3.676111), (2.024855, 4.994112, 3.5954), (1.624855, 4.994112, 3.5954)],
        [(2.024855, 4.994112, 3.5954), (1.624855, 4.902736, 3.526997), (1.624855, 4.994112, 3.5954)],
        [(2.024855, 4.994112, 3.5954), (2.024855, 4.902736, 3.526997), (1.624855, 4.902736, 3.526997)],
        [(2.024855, 4.902736, 3.526997), (1.624855, 4.802556, 3.472294), (1.624855, 4.902736, 3.526997)],
        [(2.024855, 4.902736, 3.526997), (2.024855, 4.802556, 3.472294), (1.624855, 4.802556, 3.472294)],
        [(2.024855, 4.802556, 3.472294), (1.624855, 4.69561, 3.432406), (1.624855, 4.802556, 3.472294)],
        [(2.024855, 4.802556, 3.472294), (2.024855, 4.69561, 3.432406), (1.624855, 4.69561, 3.432406)],
        [(2.024855, 4.69561, 3.432406), (1.624855, 4.584075, 3.408143), (1.624855, 4.69561, 3.432406)],
        [(2.024855, 4.69561, 3.432406), (2.024855, 4.584075, 3.408143), (1.624855, 4.584075, 3.408143)],
        [(2.024855, 4.584075, 3.408143), (1.624855, 4.470224, 3.4), (1.624855, 4.584075, 3.408143)],
        [(2.024855, 4.584075, 3.408143), (2.024855, 4.470224, 3.4), (1.624855, 4.470224, 3.4)],
    ]
    
    # mesh = Mesh.from_polygons(triangles)
    mesh = Mesh.from_vertices_and_faces(vertices, faces)
    
    for face in list(mesh.faces()):
        if mesh.face_area(face) == 0:
            mesh.delete_face(face)
    
    mesh.remove_duplicate_vertices()
    mesh.remove_unused_vertices()
    
    print(mesh.number_of_vertices())
    print(mesh.number_of_edges())
    print(mesh.number_of_faces())
    print(mesh.euler())
    print(mesh.is_manifold())
    print(mesh.is_connected())
    print(mesh.is_valid())
    print(mesh.is_trimesh())
    
    viewer = Viewer()
    viewer.scene.add(mesh)
    viewer.show()
  14. tomvanmele commented on Mar 28, 2025

    @tomvanmele
    Member

    the problem is not with the removal of duplicates. it is just that there are two invalid faces. removing the faces with zero area results in a valid mesh...

  15. tomvanmele commented on Mar 28, 2025

    @tomvanmele
    Member

    from_triangles => number of faces = 92
    from_vertices_and_faces => number of faces = 94
    from_vertices_and_faces + remove zero area faces => number of faces = 92

  16. tomvanmele commented on Mar 28, 2025

    @tomvanmele
    Member
    [23, 24, 0]
    [[1.624855, 4.584075, 3.408143], [1.624855, 4.470224, 3.4], [1.624855, 4.470224, 3.4]]
    [48, 25, 49]
    [[2.024855, 4.584075, 3.408143], [2.024855, 4.470224, 3.4], [2.024855, 4.470224, 3.4]]
  17. tomvanmele commented on Mar 28, 2025

    @tomvanmele
    Member

    remove_duplicate_vertices only welds vertices. it doesn't collapse edges and/or faces. perhaps this is a bit misleading. will see if i can reformulate this...

  18. 2twenity commented on Mar 29, 2025

    @2twenity
    Author

    the problem is not with the removal of duplicates. it is just that there are two invalid faces. removing the faces with zero area results in a valid mesh...

    Should we consider development of some mesh validation functionality? Let's say automated rebuilding of mesh from triangles, so we get rid of duplicated vertices and zero area faces

  19. jf--- commented on Jun 26, 2025

    @jf---
    Contributor

    @2twenity compas_cgal has strong cards for doing so

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