Skip to content

Decode scaled-integer coordinates of E57 scans - #68

Open
mahach666 wants to merge 1 commit into
feature/issue-16-snappy-windowfrom
feature/issue-17-e57-scaled-integers
Open

mahach666 wants to merge 1 commit into
feature/issue-16-snappy-windowfrom
feature/issue-17-e57-scaled-integers

Conversation

@mahach666

Copy link
Copy Markdown
Contributor

Closes #17

Based on #67 (the branch feature/issue-16-snappy-window); merge the earlier pull requests first.

What changed

  • E57 scans with ScaledInteger Cartesian coordinates are now decoded: the raw integer times the scale plus the offset.
    The binary width (1, 2, 4 or 8 bytes) follows from the minimum/maximum range of the field — unsigned when the minimum
    is not negative, signed otherwise. scale defaults to 1 and offset to 0 when absent.
  • A prototype with scaled-integer fields that has no usable range (bad integers, minimum above maximum, non-finite scale
    or offset) fails with InvalidDataException when the file is opened. Other types for Cartesian fields are still reported
    as unsupported when the points are read.

Files changed

  • src/PclIO/Formats/E57/E57Document.cs: per-axis scaled-integer layout (width, signedness, scale, offset), decoding in
    ReadPoints, updated class documentation.
  • src/PclIO/Internal/Bytes.cs: the new ReadInt64LE helper.
  • tests/PclIO.Tests/FormatTests.cs: the old not-decoded test replaced with decoding tests (mixed scaled/float axes with
    scale and offset, 1/4/8-byte widths with defaults, empty range, non-finite scale, partial record).
  • README.md, CHANGELOG.md: the new behaviour.

Tests

  • dotnet build — 0 warnings, 0 errors.
  • dotnet test — 640 passed, 0 failed, 10 skipped (the tests that need private scan files) on .NET 8 and .NET 10.

Limits

  • Plain Integer Cartesian fields stay unsupported; only ScaledInteger was asked for.
  • The width rule assumes the standard's range sizing (unsigned for a non-negative range, two's complement otherwise); a file
    that packs its integers in another width fails on the record-size check.
  • 8-byte raw values above 2^53 lose integer precision in the double positions, as with every coordinate the library holds.

This branch has not been deployed

No deployments
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