unibas-gravis / scalismo

Scalable Image Analysis and Shape Modelling
https://scalismo.org
Apache License 2.0
247 stars 65 forks source link

Slow triangular mesh boundary calculation for large meshes #413

Closed madsendennis closed 10 months ago

madsendennis commented 10 months ago

For large meshes (+100K vertices), the current calculation TriangularMeshBoundaryPredicates is slow. E.g. a 400K vertice mesh can end up taking +30 seconds.

From debugging, it seems that the slow computation is from a continuous update of a CSCMatrix[Boolean]:

    triangles.foreach { triangle =>
      edgesOfATriangle.foreach { edge =>
        val v1 = triangle.pointIds(edge._1).id
        val v2 = triangle.pointIds(edge._2).id
        edgeOnBorderTmp(v1, v2) = !edgeOnBorderTmp(v1, v2)
        edgeOnBorderTmp(v2, v1) = !edgeOnBorderTmp(v2, v1)
      }
    }
marcelluethi commented 10 months ago

This issue has been resolve (PR #414 ) and published as v0.92.1