writeSTL function converts some RGL object
types to triangles.readSTL(con, ascii = FALSE, plot = TRUE, ...)
writeSTL(con, ascii = FALSE,
pointRadius = 0.005,
pointShape = icosahedron3d(),
lineRadius = pointRadius,
lineSides = 20,
ids = NULL)triangles3dpointRadius.rgl.ids) of the
objects to write. If NULL, try to write everything.readSTL invisibly returns the object id if plot = TRUE, or (visibly)
a matrix of vertices of the triangles if not.writeSTL invisibly returns the name of the connection to which the
data was written.
Since the STL format only allows one object per file, all RGL objects are combined into a single object when output.
The output file is readable by Blender and Meshlab; the latter can write in a number of other formats, including U3D, suitable for import into a PDF document.
r2stl function.scene3d saves a copy of a scene to an R variable;
writeWebGL, writePLY, writeOBJ and writeSTL
write the scene to a file in various other formats.filename <- tempfile(fileext = ".stl")
open3d()
shade3d( icosahedron3d(col = "magenta") )
writeSTL(filename)
open3d()
readSTL(filename, col = "red")Run the code above in your browser using DataLab