This repository was archived by the owner on Sep 5, 2025. It is now read-only.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR adds a planarity/developability prior that encourages each 2×2 quad patch of the reconstructed surface to be locally planar. The loss is implemented as a Ceres cost with two residuals per quad (one per opposite triangle), integrated into both the local and global optimization paths. It is wrapped with a Huber loss.
Weight term
Right now the weight is set to
0.1f. Setting it to0disables the loss. We should wait for the metrics to be ready or do some tests to assess whether this loss helps.Motivation
Formulation
For a quad with vertices:
we define two signed point-to-plane distances:
Plane of triangle (p00,p01,p10), distance of p11 to that plane:
Plane of triangle (p11,p01,p10), distance of p00 to that plane:
Residuals:
Two opposite triangles avoid bias and keep good gradients even when one triangle is nearly degenerate.
Integration points
Local/centered losses:
emptytrace_create_centered_losses(...)now callsadd_quad_planarity_loss_3D(state, loc, p, problem, flags, nullptr, planarity_weight_3D);Global/“missing” losses:
emptytrace_create_missing_centered_losses(...)dedups via a loss_status bit (bit12) using:Surftracking graph:
Local add:
surftrack_add_local(...)includes planarity whenLOSS_3D_INDIRECTis set.Global graph:
surftrack_add_global(...)includes a dedupbed planarity residual with a unique type id20via: