Skip to content

LSCM: rescale flattening result to preserve surface area instead of relying on auto-pin edge length #98

Description

@csparker247

Summary

LSCM fixes the global scale of its output entirely from the two auto-selected pins: AutoPlacePair places pin1 at signed distance |p1 - p0| (the original 3D length of that single boundary edge) along the dominant world axis. Because LSCM is conformal — it recovers the parameterization only up to a global similarity — this one edge length is the sole determinant of the result's overall scale.

If that auto-selected boundary edge happens to be significantly stretched (or compressed) relative to the rest of the surface, the entire flattening is globally mis-scaled. This works against the goal of preserving the original surface area as closely as possible: a single anomalous pin edge propagates a scale error across every other edge and face.

Affected code

  • include/OpenABF/detail/LSCMSystem.hpp:70AutoPlacePair() sets pin1 UV to |p1 - p0|, baking the raw 3D pin-edge length into the global scale.
  • include/OpenABF/detail/LSCMSystem.hpp:105AutoSelectPins() picks the first boundary vertex and a boundary-adjacent neighbor with no regard for that edge's representativeness.
  • include/OpenABF/AngleBasedLSCM.hpp and include/OpenABF/HierarchicalLSCM.hpp both consume this pin path, so both are affected.

Note this is distinct from the closed #2, which addressed which vertices to pin and where to place them. This issue is about correcting the global scale of the result after flattening, independent of pin choice.

Proposed fix

After flattening, perform a post-hoc uniform rescale of the UVs that better preserves the original surface area:

  1. Identify a low-distortion reference — an edge or face whose flattened length/area best matches its original 3D length/area (i.e. minimal stretch), rather than relying on the arbitrary pin edge.
  2. Compute the scale factor from that reference's 3D length/area vs. its UV length/area.
  3. Uniformly scale all UVs by that factor.

A more robust variant: compute the per-face (or per-edge) stretch ratio across the whole mesh and choose a global scale that minimizes total area distortion (e.g. the ratio that sets the median/area-weighted stretch to 1), so the result isn't sensitive to any single edge — pin or otherwise.

Acceptance criteria

  • A post-flattening rescale option that selects a low-stretch reference (or an area-distortion-minimizing global factor) and rescales the UVs accordingly.
  • Total UV surface area is closer to the original 3D surface area than the current pin-edge-driven scaling, especially when the auto-selected pin edge is anomalously stretched.
  • Applies to both AngleBasedLSCM and HierarchicalLSCM.
  • Tests cover a mesh with a deliberately stretched boundary edge, asserting the rescaled output preserves area better than the unscaled result.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingenhancementNew feature or request

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions