Skip to content

feat(SnapResolver): support half AND full precision#752

Open
Kurtil wants to merge 1 commit into
ThatOpen:mainfrom
Kurtil:patch-7
Open

feat(SnapResolver): support half AND full precision#752
Kurtil wants to merge 1 commit into
ThatOpen:mainfrom
Kurtil:patch-7

Conversation

@Kurtil
Copy link
Copy Markdown
Contributor

@Kurtil Kurtil commented May 26, 2026

Description

Snap resolver only support Float32Array for geometry data payloads like facePoints, edges... If Model has geometries that need full precision, this behavior leads to precision loss.

Additional context

I created a face hoverer that create a new face geometry using snap resolver facePoints.

    const casters = this.components.get(OBC.Raycasters);
    const caster = casters.get(this.world);

    const result = await caster.castRay({
      position,
      snappingClasses: [FRAGS.SnappingClass.FACE],
    });
    
    const myNewGeometryPoints = result.facePoints;

Without full precision:

Screenshot 2026-05-26 at 10 18 57

With full precision:

Screenshot 2026-05-26 at 10 18 21

Without full precision, the face is not aligned to the original snapped geometry.

To enabled full precision:

  // Full precision snap
  const SnapResolvers = components.get(OBC.SnapResolvers);
  const snapResolver = SnapResolvers.get();
  snapResolver.precision = "full";

What is the purpose of this pull request?

  • Bug fix
  • New Feature
  • Documentation update
  • Other

Before submitting the PR, please make sure you do the following:

  • Check that there isn't already a PR that solves the problem the same way to avoid creating a duplicate.
  • Follow the Conventional Commits v1.0.0 standard for PR naming (e.g. feat(examples): add hello-world example).
  • Provide a description in this PR that addresses what the PR is solving, or reference the issue that it solves (e.g. fixes #123).
  • Ideally, include relevant tests that fail without this PR but pass with it.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant