Title: | Coordinate Indexing on Hilbert Curves |
Version: | 0.2.1 |
Description: | Provides utilities for encoding and decoding coordinates to/from Hilbert curves based on the iterative encoding implementation described in Chen et al. (2006) <doi:10.1002/spe.793>. |
URL: | https://hilbert.justinsingh.me, https://github.com/program--/hilbert |
BugReports: | https://github.com/program--/hilbert/issues |
License: | MIT + file LICENSE |
Encoding: | UTF-8 |
RoxygenNote: | 7.1.2 |
SystemRequirements: | C++11 |
Suggests: | bit64 (≥ 4.0.0), testthat (≥ 3.0.0), covr, knitr, rmarkdown |
LinkingTo: | cpp11 |
Config/testthat/edition: | 3 |
VignetteBuilder: | knitr |
NeedsCompilation: | yes |
Packaged: | 2022-04-06 17:51:25 UTC; jsinghm |
Author: | Justin Singh-Mohudpur
|
Maintainer: | Justin Singh-Mohudpur <justin@justinsingh.me> |
Repository: | CRAN |
Date/Publication: | 2022-04-08 08:42:30 UTC |
Convert Coordinates to Grid Positions
Description
Convert Coordinates to Grid Positions
Usage
coords_to_position(x, ..., n = 10L, extent = NULL)
## S3 method for class 'data.frame'
coords_to_position(x, ..., n, extent, coords = c(1, 2), attach = TRUE)
## S3 method for class 'matrix'
coords_to_position(x, ..., n, extent, coords = c(1, 2), attach = TRUE)
## S3 method for class 'numeric'
coords_to_position(x, y, ..., n, extent)
## S3 method for class 'double'
coords_to_position(x, y, ..., n, extent)
## S3 method for class 'integer'
coords_to_position(x, y, ..., n, extent)
coords_to_position64(x, ..., n = 10L, extent = NULL)
## S3 method for class 'data.frame'
coords_to_position64(x, ..., n, extent, coords = c(1, 2), attach = TRUE)
## S3 method for class 'matrix'
coords_to_position64(x, ..., n, extent, coords = c(1, 2), attach = TRUE)
## S3 method for class 'numeric'
coords_to_position64(x, y, ..., n, extent)
## S3 method for class 'double'
coords_to_position64(x, y, ..., n, extent)
## S3 method for class 'integer'
coords_to_position64(x, y, ..., n, extent)
Arguments
x |
One of: Numeric vector, |
... |
Unused. |
n |
Exponent to the dimensions of the underlying grid. The Hilbert
Curve indices are based on a |
extent |
Named vector with names |
coords |
Column names or indices of a |
attach |
If |
y |
Numeric vector corresponding to Y coordinates. |
Value
A data.frame
containing the positions as integer
columns x
and y
, or the original object
(data.frame
or matrix
) with the coordinates
replaced with the grid positions. When n
is greater than 15,
the positions are of type bit64::integer64
.
Index positions to a Hilbert Curve
Description
Index positions to a Hilbert Curve
Usage
index(x, ..., n = 10L)
## S3 method for class 'data.frame'
index(x, ..., n, coords = c(1, 2), attach = TRUE)
## S3 method for class 'matrix'
index(x, ..., n, coords = c(1, 2), attach = TRUE)
## S3 method for class 'double'
index(x, y, ..., n)
## S3 method for class 'numeric'
index(x, y, ..., n)
## S3 method for class 'integer'
index(x, y, ..., n)
index64(x, ..., n = 10L)
## S3 method for class 'data.frame'
index64(x, ..., n, coords = c(1, 2), attach = TRUE)
## S3 method for class 'matrix'
index64(x, ..., n, coords = c(1, 2), attach = TRUE)
## S3 method for class 'double'
index64(x, y, ..., n)
## S3 method for class 'integer'
index64(x, y, ..., n)
## S3 method for class 'numeric'
index64(x, y, ..., n)
## S3 method for class 'integer64'
index64(x, y, ..., n)
## S3 method for class 'character'
index64(x, y, ..., n)
## S3 method for class 'bitstring'
index64(x, y, ..., n)
Arguments
x |
One of: Numeric vector, |
... |
Unused. |
n |
Exponent to the dimensions of the underlying grid. The Hilbert
Curve indices are based on a |
coords |
Column names or indices of a |
attach |
If |
y |
Numeric vector. Corresponds to the columns of a position. |
Value
An integer
vector of Hilbert indices, or when attach
is TRUE
,
the original object (data.frame
or matrix
) with a new integer
column (h
for data.frame
) containing the Hilbert indices. When
n
is greater than 15, the vector is of type bit64::integer64
.
Get index positions from a Hilbert Curve
Description
Get index positions from a Hilbert Curve
Usage
position(h, ..., n = 10L)
## S3 method for class 'data.frame'
position(h, ..., n, idx = 1, attach = TRUE)
## S3 method for class 'matrix'
position(h, ..., n, idx = 1, attach = TRUE)
## S3 method for class 'numeric'
position(h, ..., n)
## S3 method for class 'integer'
position(h, ..., n)
position64(h, ..., n = 10L)
## S3 method for class 'data.frame'
position64(h, ..., n, idx = 1, attach = TRUE)
## S3 method for class 'matrix'
position64(h, ..., n, idx = 1, attach = TRUE)
## S3 method for class 'double'
position64(h, ..., n)
## S3 method for class 'integer'
position64(h, ..., n)
## S3 method for class 'numeric'
position64(h, ..., n)
## S3 method for class 'integer64'
position64(h, ..., n)
## S3 method for class 'character'
position64(h, ..., n)
## S3 method for class 'bitstring'
position64(h, ..., n)
Arguments
h |
One of: Integer vector, |
... |
Unused. |
n |
Exponent to the dimensions of the underlying grid. The Hilbert
Curve indices are based on a |
idx |
Column name or index containing the Hilbert Curve indices. |
attach |
If |
Value
A data.frame
containing the positions as integer
columns x
and y
, or the original object
(data.frame
or matrix
) with the columns attached.
When n
is greater than 15, the positions are of
type bit64::integer64
.
Convert Grid Positions to Coordinates
Description
Convert Grid Positions to Coordinates
Usage
position_to_coords(x, ..., n = 10L, extent = NULL)
## S3 method for class 'data.frame'
position_to_coords(x, ..., n, extent, coords = c(1, 2), attach = TRUE)
## S3 method for class 'matrix'
position_to_coords(x, ..., n, extent, coords = c(1, 2), attach = TRUE)
## S3 method for class 'numeric'
position_to_coords(x, y, ..., n, extent)
## S3 method for class 'double'
position_to_coords(x, y, ..., n, extent)
## S3 method for class 'integer'
position_to_coords(x, y, ..., n, extent)
position_to_coords64(x, ..., n = 10L, extent = NULL)
## S3 method for class 'data.frame'
position_to_coords64(x, ..., n, extent, coords = c(1, 2), attach = TRUE)
## S3 method for class 'matrix'
position_to_coords64(x, ..., n, extent, coords = c(1, 2), attach = TRUE)
## S3 method for class 'numeric'
position_to_coords64(x, y, ..., n, extent)
## S3 method for class 'double'
position_to_coords64(x, y, ..., n, extent)
## S3 method for class 'integer64'
position_to_coords64(x, y, ..., n, extent)
## S3 method for class 'bitstring'
position_to_coords64(x, y, ..., n, extent)
Arguments
x |
One of: Integer vector, |
... |
Unused. |
n |
Exponent to the dimensions of the underlying grid. The Hilbert
Curve indices are based on a |
extent |
Named vector with names |
coords |
Column names or indices of a |
attach |
If |
y |
Integer vector corresponding to Column positions. |
Value
A data.frame
containing the coordinates as numeric
columns x
and y
, or the original object
(data.frame
or matrix
) with the positions
replaced with the coordinates.