Skip to main content

Module scale_offset

Module scale_offset 

Source
Expand description

Profile-level Scale/Offset transformation.

Per protocol §3.2:

  physical = raw_value / scale - offset
  raw_value = round((physical + offset) * scale)

scale and offset come from the field’s Profile metadata. None everywhere is treated as the identity.

Functions§

apply
Apply scale/offset to a raw numeric value, producing a physical (f64) quantity. None for either parameter is the identity.
is_identity
True when scale/offset are both the identity (and so applying would be a no-op). Useful for hot-path skip checks.
unapply
Inverse of apply — used by the encoder (M8) to round-trip user-space physical values back to wire-space integers.