meshlab icon indicating copy to clipboard operation
meshlab copied to clipboard

Feature Request: Quadric Edge Collapse Decimation with "Check Surface Distance"

Open jambus1986 opened this issue 3 years ago • 3 comments

Hi, you do very great work!!

to my question:

i need to simplyfy an very large mesh from a laserscan. but i am not allowed, to differ from original model more then 1 millimeter.

can you stop the "Quadric Edge Collapse Decimation" algorithm when a specific distance is reached instead of a target-triangle-count or procentual number?

thx

jambus1986 avatar May 03 '21 15:05 jambus1986

Controlled simplification that respects hausdorff distance can easily implemented with a very small pymeshlab script :

import numpy as np
import pymeshlab as ml

ms = ml.MeshSet()
ms.load_new_mesh("laurana50k.ply"); # load two copies of the model, one will be simplified, the other used for reference
ms.load_new_mesh("laurana50k.ply"); # laurana model is in mm, 80cm large. 
print("Starting Face Num:",ms.current_mesh().face_number(), "VertNum",ms.current_mesh().vertex_number())
error=0.0
while error < 2.0 :  # target a 2mm error, repeat until you reach the error.
    ms.simplification_quadric_edge_collapse_decimation(targetperc=0.9)
    error = ms.hausdorff_distance(sampledmesh=0,targetmesh=1,samplevert=False,sampleface=True,samplenum=500000)['max']
    print("Current  Face Num:",ms.current_mesh().face_number(), "VertNum",ms.current_mesh().vertex_number(), "Max distance ",error)

cignoni avatar May 04 '21 22:05 cignoni

this is a nice solution, but works always for the whole model, i think about interrupting the algorithm on each vertex, that is simplified, when distance is too large...

jambus1986 avatar May 12 '21 20:05 jambus1986

Sorry, this is a feature that is now not available in meshlab. The implementation of the decimation does not have maximum distance as a stop criteria.

alemuntoni avatar May 18 '21 09:05 alemuntoni