View source: R/mesh_intersect_rays.R
mesh_intersect_rays | R Documentation |
Computes the intersection points between a mesh and a set of non-directional rays
mesh_intersect_rays(rays, mesh, parExec = FALSE, maxCores = NA)
rays |
A non-empty matrix-like object (N x 6, where N is the number of rays) containing (x,y,z) coordinates for the origin of the rays in the first three columns and those for a second point along the ray in the last three columns. |
mesh |
A triangular mesh object ( |
parExec |
boolean indicating whether parallel processing is to be used. Set to FALSE by default. |
maxCores |
integer specifying the maximum number of cores to use if parExec is set to TRUE. Requesting more cores than are physically available will simply result in all cores being used. The parameter is set to NA by default; if parExec is set to FALSE, this parameter will be ignored. |
A list of matrices (N' x 3, where N' is the number of intersections) containing the coordinates for the intersection points for each ray. Each list element corresponds to a ray, in input order.
Parallel processing only starts making sense with 20 or more rays; otherwise, it's faster to run with parallel processing disabled.
data(demoFlake1)
alignedMesh <- Morpho::pcAlign(demoFlake1$mesh)
# Construct and cast some rays:
rays <- data.frame(x1 = c(-41.65845, -41.82012, -41.87693),
y1 = c(-1.22681434, -0.91828322, -0.41378155),
z1 = c(100, 100, 100))
rays$x2 <- rays$x1
rays$y2 <- rays$y1
rays$z2 <- rays$z1 - 1
mesh_intersect_rays(rays[1:3,], alignedMesh, parExec = FALSE)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.