|
morton-arithmetic 0.1.0
Fast Morton (Z-order) codes with O(1) arithmetic
|
Functions | |
| template<unsigned Dim, unsigned Bits> | |
| void | add (const typename Morton< Dim, Bits >::code_type *in, typename Morton< Dim, Bits >::code_type *out, std::size_t n, unsigned axis, typename Morton< Dim, Bits >::coord_type k) |
Add the same k to axis of every code (wraps). | |
| template<unsigned Dim, unsigned Bits> | |
| void | sub (const typename Morton< Dim, Bits >::code_type *in, typename Morton< Dim, Bits >::code_type *out, std::size_t n, unsigned axis, typename Morton< Dim, Bits >::coord_type k) |
Subtract the same k from axis of every code (wraps). Vectorised. | |
| template<unsigned Dim, unsigned Bits> | |
| void | step (const typename Morton< Dim, Bits >::code_type *in, typename Morton< Dim, Bits >::code_type *out, std::size_t n, unsigned axis, int dir) |
Step every code one cell along ±axis (dir>=0 -> +1, else -1). Vectorised. | |
| template<unsigned Bits> | |
| void | encode2 (const typename Morton< 2, Bits >::coord_type *x, const typename Morton< 2, Bits >::coord_type *y, typename Morton< 2, Bits >::code_type *out, std::size_t n) |
| Encode arrays of coordinates (2D) into codes. | |
| template<unsigned Bits> | |
| void | encode3 (const typename Morton< 3, Bits >::coord_type *x, const typename Morton< 3, Bits >::coord_type *y, const typename Morton< 3, Bits >::coord_type *z, typename Morton< 3, Bits >::code_type *out, std::size_t n) |
| Encode arrays of coordinates (3D) into codes. | |
| template<unsigned Bits> | |
| void | decode2 (const typename Morton< 2, Bits >::code_type *in, typename Morton< 2, Bits >::coord_type *x, typename Morton< 2, Bits >::coord_type *y, std::size_t n) |
| Decode an array of codes back to coordinate arrays (2D). | |
| template<unsigned Bits> | |
| void | decode3 (const typename Morton< 3, Bits >::code_type *in, typename Morton< 3, Bits >::coord_type *x, typename Morton< 3, Bits >::coord_type *y, typename Morton< 3, Bits >::coord_type *z, std::size_t n) |
| Decode an array of codes back to coordinate arrays (3D). | |
| void morton::batch::add | ( | const typename Morton< Dim, Bits >::code_type * | in, |
| typename Morton< Dim, Bits >::code_type * | out, | ||
| std::size_t | n, | ||
| unsigned | axis, | ||
| typename Morton< Dim, Bits >::coord_type | k | ||
| ) |
Add the same k to axis of every code (wraps).
Vectorised. in and out may alias.
| void morton::batch::sub | ( | const typename Morton< Dim, Bits >::code_type * | in, |
| typename Morton< Dim, Bits >::code_type * | out, | ||
| std::size_t | n, | ||
| unsigned | axis, | ||
| typename Morton< Dim, Bits >::coord_type | k | ||
| ) |
Subtract the same k from axis of every code (wraps). Vectorised.
| void morton::batch::step | ( | const typename Morton< Dim, Bits >::code_type * | in, |
| typename Morton< Dim, Bits >::code_type * | out, | ||
| std::size_t | n, | ||
| unsigned | axis, | ||
| int | dir | ||
| ) |
Step every code one cell along ±axis (dir>=0 -> +1, else -1). Vectorised.
| void morton::batch::encode2 | ( | const typename Morton< 2, Bits >::coord_type * | x, |
| const typename Morton< 2, Bits >::coord_type * | y, | ||
| typename Morton< 2, Bits >::code_type * | out, | ||
| std::size_t | n | ||
| ) |
Encode arrays of coordinates (2D) into codes.
| void morton::batch::encode3 | ( | const typename Morton< 3, Bits >::coord_type * | x, |
| const typename Morton< 3, Bits >::coord_type * | y, | ||
| const typename Morton< 3, Bits >::coord_type * | z, | ||
| typename Morton< 3, Bits >::code_type * | out, | ||
| std::size_t | n | ||
| ) |
Encode arrays of coordinates (3D) into codes.
| void morton::batch::decode2 | ( | const typename Morton< 2, Bits >::code_type * | in, |
| typename Morton< 2, Bits >::coord_type * | x, | ||
| typename Morton< 2, Bits >::coord_type * | y, | ||
| std::size_t | n | ||
| ) |
Decode an array of codes back to coordinate arrays (2D).
| void morton::batch::decode3 | ( | const typename Morton< 3, Bits >::code_type * | in, |
| typename Morton< 3, Bits >::coord_type * | x, | ||
| typename Morton< 3, Bits >::coord_type * | y, | ||
| typename Morton< 3, Bits >::coord_type * | z, | ||
| std::size_t | n | ||
| ) |
Decode an array of codes back to coordinate arrays (3D).