Skip to content

Commit

Permalink
WIP
Browse files Browse the repository at this point in the history
  • Loading branch information
habedi committed Sep 29, 2024
1 parent 821044e commit bb2c34d
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,18 +1,19 @@
# Morton Encoding in Go
# Morton Code in Go

[![Tests](https://github.com/habedi/morton/actions/workflows/tests.yml/badge.svg)](https://github.com/habedi/morton/actions/workflows/tests.yml)
[![Go Report Card](https://goreportcard.com/badge/github.com/habedi/morton)](https://goreportcard.com/report/github.com/habedi/morton)
[![Go Reference](https://pkg.go.dev/badge/github.com/habedi/morton.svg)](https://pkg.go.dev/github.com/habedi/morton)
[![License](https://img.shields.io/github/license/habedi/morton)](https://github.com/habedi/morton/blob/main/LICENSE)
[![CodeFactor](https://www.codefactor.io/repository/github/habedi/morton/badge)](https://www.codefactor.io/repository/github/habedi/morton)

This is an implementation of [Morton encoding](https://en.wikipedia.org/wiki/Z-order_curve) in Golang. It provides
This is an implementation of [Morton code](https://en.wikipedia.org/wiki/Z-order_curve) in Golang. It provides
functions for encoding 2D and 3D points into 1D and decoding them back to the original points. This package has no
external
dependencies and provides a very simple API.

## What is Morton Encoding?
## What is Morton code?

**Morton encoding** (also called the **Z-order curve**) is a way to convert multi-dimensional data points, like 2D or 3D
**Morton code** (also called the **Z-order curve**) is a way to convert multi-dimensional data points, like 2D or 3D
coordinates into single numbers while keeping nearby points close together. This is useful for things like spatial
indexing in [Quadtrees](https://en.wikipedia.org/wiki/Quadtree) and [Octrees](https://en.wikipedia.org/wiki/Octree), as
well as in computer graphics to make memory access faster.
Expand All @@ -31,7 +32,7 @@ The image below shows how the 2D point `(10, 13)` is turned into a Morton code a
point.

<p style="text-align: center;">
<img src="assets/morton_v2.svg" alt="Morton Encoding" style="width: 60%; height: auto;">
<img src="assets/morton_v2.svg" alt="Morton Code" style="width: 60%; height: auto;">
</p>

## Installation
Expand Down

0 comments on commit bb2c34d

Please sign in to comment.