getPosition {AMAPVox}R Documentation

Gets the x, y, z coordinates of a given voxel.

Description

Gets the x, y, z coordinates of the voxel center. If the voxel parameter is missing, it returns the positions of all the voxels in the voxel space.

Usage

getPosition(vxsp, vx)

## S4 method for signature 'VoxelSpace,vector'
getPosition(vxsp, vx)

## S4 method for signature 'VoxelSpace,matrix'
getPosition(vxsp, vx)

## S4 method for signature 'VoxelSpace,data.table'
getPosition(vxsp, vx)

## S4 method for signature 'VoxelSpace,missing'
getPosition(vxsp, vx)

Arguments

vxsp

a VoxelSpace object.

vx

(i, j, k) voxel coordinates as a data.table::data.table with i, j, k columns, a vector (i, j, k) or a matrix with i, j, k columns.

Value

the x, y, z coordinates of the voxel center.

Examples

# load a voxel file
vxsp <- readVoxelSpace(system.file("extdata", "tls_sample.vox", package = "AMAPVox"))

# get position of voxel(i=0, j=0, k=0)
getPosition(vxsp, c(0, 0, 0))

# get position of voxels 1 to 10 in the data.table
getPosition(vxsp, vxsp@data[1:10,])

# get positions of every voxel
getPosition(vxsp)

[Package AMAPVox version 2.2.1 Index]