Package 'vtkr'

Title: Read a Limited Subset of Visualization Toolkit Formats
Description: Read some VTK formats. VTK is the Visualization Toolkit <https://en.wikipedia.org/wiki/VTK>.
Authors: Michael Sumner [aut, cre]
Maintainer: Michael Sumner <[email protected]>
License: GPL-3
Version: 0.0.0.9000
Built: 2024-10-27 05:50:17 UTC
Source: https://github.com/hypertidy/vtkr

Help Index


Read VTK points

Description

Read a VTK (Visualization Toolkit ) STRUCTURED GRID of POINTS.

Usage

read_vtk_points(x, ..., quiet = FALSE)

Arguments

x

VTK file name

...

ignored

quiet

if 'FALSE' (the default), refrain from reporting extra information

Details

Only BINARY supported for now.

Note that we currently do not recreate the matrix of data, just return the points. The header is printed if 'verbose = TRUE' so the dimensions reported there may be used.

Specification of the format found at https://vtk.org/wp-content/uploads/2015/04/file-formats.pdf on 2019-10-09.

Value

matrix of x, y, z coordinates

Examples

f <- system.file("extdata/STRUCTURED_GRID/volcano_points.vtk", package = "vtkr", mustWork = TRUE)
xyz <- read_vtk_points(f)

Read VTK triangles

Description

Read a VTK (Visualization Toolkit ) UNSTRUCTURED GRID of POINTS with triangle CELLS.

Usage

read_vtk_triangles(x, ..., quiet = FALSE)

Arguments

x

VTK file name

...

ignored

quiet

if 'FALSE' (the default), refrain from reporting extra information

Details

Note that we currently do not recreate the matrix of data, just return the points and the triangle. The header is printed if 'verbose = TRUE'.

Specification of the format found at https://people.sc.fsu.edu/~jburkardt/data/vtk/vtk.html on 2019-10-09.

Value

list, with 'xyz' matrix of x, y, z coordinates, and 'tri' matrix of triangle index (1-based)

Examples

f <- system.file("extdata/UNSTRUCTURED_GRID/rbc_001.vtk", package = "vtkr", mustWork = TRUE)
mesh0 <- read_vtk_triangles(f)
#library(rgl)
#tm <- tmesh3d(t(mesh0$xyz), t(mesh0$tri), homogeneous = FALSE)
#shade3d(tm, col = "grey")
#rglwidget()