dima634 / baby_shark

Geometry processing library in pure rust
MIT License
67 stars 7 forks source link

Fairness criterion for `EdgeDecimator`: Keep certain triangle shape or enforce certain triangle shape #35

Open Nevsden opened 5 months ago

Nevsden commented 5 months ago

Could we add fairness criteria to the EdgeDecimator module? An idea would be to only allow removal of edges, which do not lead to degenerate triangle shapes.

https://graphics.stanford.edu/courses/cs468-10-fall/LectureSlides/08_Simplification.pdf Slide 54

dima634 commented 5 months ago

This should be straightforward to implement. However, are you certain that you need it for IncrementalRemesher and not for EdgeDecimator? The slides discuss incremental decimation, which aligns more closely with what EdgeDecimator implements.

Nevsden commented 5 months ago

@dima634 You are right. This should better be implemented as a feature to the EdgeDecimator as a plug-in criterion. E.g.

    // Quality taken from 
    let quality = radius / edge_length;
    let mut decimator = EdgeDecimator::new()
        .decimation_criteria(decimation_criteria)
        .keep_boundary(true)
        .enforce_triangle_shape(quality);
    decimator.decimate(&mut mesh);
Nevsden commented 5 months ago

After doing some research, I came across this algorithm from the RWTH Aachen, which seems to do a good job improving mesh quality after the decimation of edges.

Would this feature be something, you would like to see in your library?

https://www.graphics.rwth-aachen.de/media/papers/slicing1.pdf

dima634 commented 5 months ago

@dima634 You are right. This should better be implemented as a feature to the EdgeDecimator as a plug-in criterion. E.g.

    // Quality taken from 
    let quality = radius / edge_length;
    let mut decimator = EdgeDecimator::new()
        .decimation_criteria(decimation_criteria)
        .keep_boundary(true)
        .enforce_triangle_shape(quality);
    decimator.decimate(&mut mesh);

I think the easiest way to implement it is to create a new EdgeDecimationCriteria that would check triangle quality after collapse. And if it drops below a certain value ban such edge collapse.

dima634 commented 5 months ago

After doing some research, I came across this algorithm from the RWTH Aachen, which seems to do a good job improving mesh quality after the decimation of edges.

Would this feature be something, you would like to see in your library?

https://www.graphics.rwth-aachen.de/media/papers/slicing1.pdf

I find it quite similar to what IncrementalRemesher currently offers (however sharp feature may be smoothed a bit, not sure).

Nevsden commented 5 months ago

You are right, it's very similar. But in one point I would contradict: the algorithm described in the paper still tries to keep the number of edges minimal.

Out of curiosity: would this minimum edges feature be something that I could already achieve with the Remesher pipeline?

dima634 commented 5 months ago

Out of curiosity: would this minimum edges feature be something that I could already achieve with the Remesher pipeline?

I guess no, mb with a combination of remeshing + decimation.