Skip to content
This repository was archived by the owner on Sep 5, 2025. It is now read-only.

Conversation

@giorgioangel
Copy link
Member

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 to 0 disables the loss. We should wait for the metrics to be ready or do some tests to assess whether this loss helps.

Motivation

  • Reduce local twisting (possibly leading to fewer sheet jumps?)
  • Complement existing distance and straightness terms with a rotation-invariant planarity prior.

Formulation

For a quad with vertices:

(p00) -- (p01)
  |        |
(p10) -- (p11)

we define two signed point-to-plane distances:

  • Plane of triangle (p00,p01,p10), distance of p11 to that plane:

    • n0 = (p01−p00) × (p10−p00)
    • d0 = n0 · (p11−p00) / ‖n0‖
  • Plane of triangle (p11,p01,p10), distance of p00 to that plane:

    • n1 = (p01−p11) × (p10−p11)
    • d1 = n1 · (p00−p11) / ‖n1‖

Residuals:

r = sqrt(w) * [ d0, d1 ]

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 calls
      add_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 (bit 12) using:

      int conditional_planarity_loss(int bit=12, ...);
  • Surftracking graph:

    • Local add: surftrack_add_local(...) includes planarity when LOSS_3D_INDIRECT is set.

    • Global graph: surftrack_add_global(...) includes a dedupbed planarity residual with a unique type id 20 via:

      int cond_surftrack_planarity_3D(int type=20, ...);

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant