View source: R/lines_interception.R
lines_interception | R Documentation |
Intersection of lines by several Axis-Aligned Bounding Boxs.
lines_interception(orig, end, AABBs, edge_length, threads = 1, progress = TRUE)
orig |
A |
end |
A |
AABBs |
A |
edge_length |
A positive |
threads |
An |
progress |
Logical, if |
It returns a data.table
with nine columns: 1-5 columns with
the counts for the code of intersection (see line_AABB
), and
6-9 columns with sum the path length of intersection. The number of rows match
with nrow(AABBs)
.
J. Antonio Guzmán Q.
line_AABB
, voxels
#Create points with paths n <- 20 orig <- data.table(X = runif(n, min = -5, max = 5), Y = runif(n, min = -5, max = 5), Z = runif(n, min = -5, max = 5)) end <- data.table(X = runif(n, min = -5, max = 5), Y = runif(n, min = -5, max = 5), Z = runif(n, min = -5, max = 5)) #Create a potential AABB AABBs <- data.table(X = 0, Y = 0, Z = 0) edge_length <- c(2, 2, 2) #Plot cube <- rgl::cube3d() cube <- rgl::scale3d(cube, edge_length[1]/2, edge_length[2]/2, edge_length[3]/2) box <- rgl::translate3d(cube, AABBs[[1]], AABBs[[2]], AABBs[[3]]) rgl::shade3d(box, col= "green", alpha = 0.6) rgl::points3d(orig, size = 5, col = "black") rgl::points3d(end, size = 5, col = "red") for(i in 1:nrow(orig)) { rgl::lines3d(c(orig[[1]][i], end[[1]][i]), c(orig[[2]][i], end[[2]][i]), c(orig[[3]][i], end[[3]][i]), col = "grey") } #Estimation lines_interception(orig, end, AABBs, edge_length, progress = FALSE)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.