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(voxelSpace, voxel)

## S4 method for signature 'VoxelSpace,vector'
getPosition(voxelSpace, voxel)

## S4 method for signature 'VoxelSpace,list'
getPosition(voxelSpace, voxel)

## S4 method for signature 'VoxelSpace,missing'
getPosition(voxelSpace, voxel)

Arguments

voxelSpace

the VoxelSpace-class object.

voxel

either the voxel index as a c(i, j, k) vector or a voxel from the VoxelSpace data.table.

Value

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

Examples

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

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

# get position of 1st voxel in the data.table
getPosition(vox, vox@voxels[1,])

# get positions of every voxel
getPosition(vox)

[Package AMAPVox version 0.1.0 Index]