inst/examples/show3D.R

# display
library(Dmri3d)
library(rgl)
filename = system.file("extdata", "OneStruct.mat", package = "Dmri3d")  
mri = readMri3d(filename)
open3d()
wire3d(with(mri,tmesh3d(vertices, indices, homogeneous=FALSE)))

# This writes a copy into temporary directory 'webGL', and then displays it
browseURL(paste("file://", writeWebGL(dir=file.path(tempdir(), "webGL"), 
                                      width=500), sep=""))

library(Rvcg)
open3d()
mesh3d = list(vb=rbind(mri$vertices,rep(1,ncol(mri$vertices))),  
           it=mri$indices)
class(mesh3d) = "mesh3d"
#mesh3dA = vcgQEdecim(mesh3d, percent = 0.1, normcheck = TRUE)
mesh3dB = vcgSmooth(mesh3d, iteration=2,lambda=0.90,mu=0.9)
mesh3dB = vcgQEdecim(mesh3dB, percent = 0.2, normcheck = TRUE)
wire3d(mesh3dB)

# This writes a copy into temporary directory 'webGL', and then displays it
browseURL(paste("file://", writeWebGL(dir=file.path(tempdir(), "webGL"), 
                                      width=500), sep=""))
dmenne/dmri3d documentation built on May 15, 2019, 9:32 a.m.