learned-triangulation icon indicating copy to clipboard operation
learned-triangulation copied to clipboard

WaterTight

Open qpaozixu opened this issue 4 years ago • 2 comments

How could I measure the watertight rate of result mesh ?

qpaozixu avatar Jan 19 '21 08:01 qpaozixu

For the results in the paper, watertightness was measured by counting the number of edges which have != 2 incident triangles. So for instance percent watertightness might be given by:

100 * num_edge_with_2_tris / num_total_edge

Here's a little snippet of Python code that might help compute some of these counts. (I grabbed this from a random codebase and haven't tested recently, be sure to verify it before trusting blindly!)

    verts, faces = #your mesh
    
    halfedges = []
    for i in range(3):
        ind_low = np.minimum(faces[:,i], faces[:,(i+1)%3])
        ind_high = np.maximum(faces[:,i], faces[:,(i+1)%3])
        halfedges.append(np.stack((ind_low, ind_high), axis=-1))
    halfedges = np.concatenate(halfedges, axis=0)

    u_vals, u_inv, u_count = np.unique(halfedges, axis=0, return_inverse=True, return_counts=True)

    n_distinct = u_vals.shape[0]
    n_1 = np.count_nonzero(u_count == 1) # number of edges with 1 face incident
    n_2 = np.count_nonzero(u_count == 2) # number of edges with 2 faces incident
    n_3p = np.count_nonzero(u_count > 2) # number of edges with >=3 faces incident

nmwsharp avatar Jan 19 '21 15:01 nmwsharp

OK, very thanks for your help!

qpaozixu avatar Jan 19 '21 18:01 qpaozixu