Learn R Programming

AMAPVox (version 2.2.1)

getPosition: 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 VoxelSpace,vector getPosition(vxsp, vx)

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

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

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

Value

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

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.

Examples

Run this code
# 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)

Run the code above in your browser using DataLab