r2stl: Save R data to an STL file

Description Usage Arguments Details Value Author(s) Examples

View source: R/r2stl.r

Description

r2stl takes numeric input exactly as with R's normal persp() function. The output is a STL (stereolithography) file.

Usage

1
r2stl(x, y, z, filename = "3d-R-object.stl", object.name = "r2stl-object", z.expand = FALSE, min.height = 0.008, show.persp = FALSE, strict.stl = FALSE)

Arguments

x

x is a numeric vector with the x-coordinates to plot

y

y is a numeric vector with the y-coordinates to plot

z

z is a numeric vector with the z-coordinates to plot

filename

x is the STL filename

object.name

object.name - the object that is being described must have a name specified inside the file. There's probably no point changing it from the default

z.expand

z.expand - to force the 3D plot to touch all six faces of the imaginary cube that surrounds it, set this parameter to TRUE

min.height

min.height is the minimum height for the printed material.

show.persp

show.persp if set to TRUE then a persp() plot of this object is shown on the screen

strict.stl

strict.stl is set to TRUE it makes files smaller but isn't strictly proper STL format.

Details

To view and test the STL files before printing them can be done with many programs, for example an open-source option is Meshlab http://meshlab.sourceforge.net/.

Value

none

Author(s)

Ian Walker

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
# Let's do the classic persp() demo plot
x <- seq(-10, 10, length= 100)
y <- x
f <- function(x,y) { r <- sqrt(x^2+y^2); 10 * sin(r)/r }
z <- outer(x, y, f)
z[is.na(z)] <- 1
r2stl(x, y, z, filename="lovelyfunction.stl", show.persp=TRUE)

# Now let's look at R's Volcano data
z <- volcano
x <- 1:dim(volcano)[1]
y <- 1:dim(volcano)[2]
r2stl(x, y, z, filename="volcano.stl", show.persp=TRUE)

Example output



r2stl documentation built on May 2, 2019, 9:23 a.m.

Related to r2stl in r2stl...