Learn R Programming

simLife (version 0.3)

getCylinderProjection: Fiber defect projections

Description

The function draws the defect projections after cylinders3d has been called and returns the points for the convex hull with its points of each projected fiber (spherocylinder).

Usage

getCylinderProjection(S, B = rep(1, length(S)), draw = TRUE, conv = TRUE,
  np = 20)

Arguments

S

fibers to be projected

B

integer vector of length equal to S of defect types, B=0 for crack and B=1 for delamination.

draw

logical, draw=TRUE (default) draw the projected fibers

conv

logical, conv=TRUE (default) draw the convex hull of projected fibers

np

number of points used for sampling the convex hull of projections

Value

draw defect projections and the convex hull (if enabled) in a 3d plot returning its polygonal area and points of the convex hull

Examples

Run this code
# NOT RUN {
## Not on MS-Windows	
#library("parallel")
#options(mc.cores=detectCores())
#options(parallel.option="mclapply")

lam <- 35
box <- list("xrange"=c(0,3),"yrange"=c(0,3),"zrange"=c(0,9))

## Spheroids of constant sizes
theta <- list("size"=list(.5),
		"shape"=list("radius"=0.1),
		"orientation"=list("kappa"=0.1))

S <- simCylinderSystem(theta,lam,size="const",
		orientation="rbetaiso",box=box,pl=101,label="P")

## secondary phase: particles as spheres
F <- simSphereSystem(list(0.075),5, rdist="const", box=box, pl=101, label="F")

## apply RSA
S2 <- rsa(S,box,F,pl=101,verbose=TRUE)

## draw some projection
#require("rgl")
#id <- c(1,5,9,32,10)
#cols <- c("#0000FF","#00FF00","#FF0000","#FF00FF","#FFFF00","#00FFFF")
#cylinders3d(S2[id], box, col=cols)	
#P <- getCylinderProjection(S2[id], B=c(0,1,0,1,1), draw=TRUE, conv = TRUE, np=20)

## construct clusters
param <- list("r"=0.35)
CLUST <- simCluster(S2, param, 0.1, box,verbose=TRUE)
	
## densify
ctrl <- list(threshold.stop=0.01,max.call=5000,verbose=FALSE)
RET <- densifyCluster(S2, CLUST, box, ctrl, weight=100, cl = NULL)	
G <- RET$cluster

## draw original cluster
#open3d()
#lapply(CLUST,function(x) cylinders3d(S2[x$id],box=box,col=cols))	
#X <- do.call(rbind,lapply(CLUST, function(x) c(x$center,x$r)))
#invisible(lapply(CLUST, function(x) rgl::spheres3d(X[,1:3],radius=X[,4],col="gray",alpha=0.2)))

## draw densified cluster
#open3d()
#invisible(lapply(G,function(x) { cylinders3d(x,box=box,col=cols) }))
#invisible(lapply(CLUST, function(x) rgl::spheres3d(X[,1:3],radius=X[,4],col="gray",alpha=0.2)))

# }

Run the code above in your browser using DataLab