export mesh objects to disk
export mesh objects to disk.
mesh2obj(x, filename = dataname, writeNormals = TRUE) mesh2ply(x, filename = dataname, col = NULL, writeNormals = FALSE)
x |
object of class |
filename |
character: Path/name of the requested output - extension will be added atuomatically. If not specified, the file will be named as the exported object. |
writeNormals |
logical: if TRUE, existing normals of a mesh are written to file - can slow things down for very large meshes. |
col |
Writes color information to ply file. Can be either a single color value or a vector containing a color value for each vertex of the mesh. |
export an object of class mesh3d
or a set of coordinates to a common
mesh file.
meshes containing quadrangular faces will be converted to triangular meshes by splitting the faces.
Additionally, mesh2obj is now simply a wrapper of Rvcg::vcgObjWrite
.
Stefan Schlager
require(rgl) vb <- c(-1.8,-1.8,-1.8,1.0,1.8,-1.8,-1.8,1.0,-1.8,1.8,-1.8,1.0,1.8, 1.8,-1.8,1.0,-1.8,-1.8,1.8,1.0,1.8, -1.8,1.8,1.0,-1.8,1.8,1.8,1.0,1.8,1.8,1.8,1.0) it <- c(2,1,3,3,4,2,3,1,5,5,7,3,5,1,2,2,6,5,6,8,7,7,5,6,7,8,4,4,3,7,4,8,6,6,2,4) vb <- matrix(vb,4,8) ##create vertex matrix it <- matrix(it,3,12) ## create face matrix cube<-list(vb=vb,it=it) class(cube) <- "mesh3d" ## Not run: shade3d(cube,col=3) ## view the green cube ## End(Not run) mesh2ply(cube,filename="cube") # write cube to a file called cube.ply unlink("cube.ply")
Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.