morton

package
v0.34.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 27, 2025 License: MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CompactBits21 added in v0.30.0

func CompactBits21(v uint64) uint64

CompactBits21 is the inverse of expandBits

func ExpandBits21 added in v0.30.0

func ExpandBits21(v uint64) uint64

ExpandBits21 spreads the bits of a number so they can be interleaved Input: 00000000000000000000001011010010 Output: 001000001000001000000001000000010

Types

type Encoder3D

type Encoder3D struct {
	// Bounds define the space that will be mapped to Morton codes
	Bounds geometry.AABB

	// Resolution determines the precision of the encoding (number of bits per dimension)
	Resolution uint
}

Encoder3D provides 3D Morton encoding/decoding functionality for float64 coordinates

func (*Encoder3D) Decode

func (m *Encoder3D) Decode(morton uint64) vector3.Float64

Decode converts a Morton code back to a 3D float64 point

func (*Encoder3D) DecodeArray

func (m *Encoder3D) DecodeArray(mortons []uint64) []vector3.Float64

Decode converts a Morton code back to a 3D float64 point

func (*Encoder3D) Encode

func (m *Encoder3D) Encode(point vector3.Float64) uint64

Encode converts a 3D float64 point to a Morton code

func (*Encoder3D) EncodeArray

func (m *Encoder3D) EncodeArray(points []vector3.Float64) []uint64

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL