Options
All
  • Public
  • Public/Protected
  • All
Menu

Class ZCurve<T>

Z-Curve encoder/decoder and optimized bbox range extraction for arbitrary dimensions (>= 2). Supports max. 32bit per-component value range and resulting Morton codes encoded as BigInt.

Type parameters

  • T: Range2_64

Hierarchy

Index

Constructors

constructor

  • new ZCurve<T>(dim: T, bits: Range1_32, order?: ArrayLike<RangeValueMap[T]>): ZCurve<T>
  • Type parameters

    • T: 2 | 16 | 10 | 5 | 31 | 3 | 4 | 6 | 7 | 8 | 9 | 11 | 12 | 13 | 14 | 15 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64

    Parameters

    • dim: T

      dimensions

    • bits: Range1_32

      number of bits per component

    • Optional order: ArrayLike<RangeValueMap[T]>

      component ordering

    Returns ZCurve<T>

Properties

bits

bits: number

dim

dim: T

masks

masks: bigint[]

order

order: ArrayLike<number>

wipeMasks

wipeMasks: bigint[]

Methods

bigMin

  • bigMin(zcurr: bigint, zmin: bigint, zmax: bigint): bigint

decode

  • decode(z: bigint, out?: NumericArray): NumericArray
  • Decodes given Z index into point coordinates.

    Parameters

    • z: bigint

      Z index

    • out: NumericArray = ...

      optional result array

    Returns NumericArray

encode

  • encode(p: ArrayLike<number>): bigint
  • Encodes given nD point as Z index.

    Parameters

    • p: ArrayLike<number>

      point to encode

    Returns bigint

Protected initMasks

  • initMasks(): void

Protected loadBits

  • loadBits(mask: number, bitPos: number, z: bigint): bigint
  • Parameters

    • mask: number
    • bitPos: number
    • z: bigint

    Returns bigint

merge

  • merge(zparts: bigint[]): bigint

pointInBox

  • pointInBox(p: ArrayLike<number>, rmin: ArrayLike<number>, rmax: ArrayLike<number>): boolean
  • Parameters

    • p: ArrayLike<number>
    • rmin: ArrayLike<number>
    • rmax: ArrayLike<number>

    Returns boolean

range

  • range(rmin: ArrayLike<number>, rmax: ArrayLike<number>): Generator<bigint, void, unknown>

split

  • split(z: bigint, out?: bigint[]): bigint[]
  • Decomposes given Z index into individual bit patterns, one per dimension.

    remarks

    Parameters

    • z: bigint

      -

    • out: bigint[] = ...

      -

    Returns bigint[]

Static decodeComponent

  • decodeComponent(z: bigint, bits: number, dims: number, offset: number): number
  • Decodes a single nD component from given Z index.

    Parameters

    • z: bigint

      Z index

    • bits: number

      bits per component

    • dims: number

      number of dimensions

    • offset: number

      bit offset (for curr dimension)

    Returns number

Static encodeComponent

  • encodeComponent(x: number, bits: number, dims: number, offset: number, out?: bigint): bigint
  • Encodes a single nD point component as partial Z index.

    Parameters

    • x: number

      component value

    • bits: number

      bits per component

    • dims: number

      number of dimensions

    • offset: number

      bit offset (for curr dimension)

    • out: bigint = ...

      existing partial Z result

    Returns bigint

Generated using TypeDoc