raysearchMulti | R Documentation |
Find all intersections by tracing rays through mesh #
raysearchMulti(x, mesh, maxtol = 1e+15, threads = 1, offset = 0.001)
x |
a triangular mesh of class 'mesh3d' or a list containing vertices and vertex normals (fitting the naming conventions of 'mesh3d'). In the second case x must contain x$vb = 3 x n matrix containing 3D-coordinates and x$normals = 3 x n matrix containing normals associated with x$vb. |
mesh |
triangular mesh to be intersected. |
maxtol |
maximum distance to search along ray |
threads |
number of threads used during search. |
offset |
amount to offset the hit points along the ray to find the next intersection. This is needed to avoid finding the same intersection over and over again. |
This function iteratively uses vcgRaySearch
to find all intersections of rays and a given surface mesh.
list with following items:
intersects |
a list containing the result of |
hits |
Vector containging number of intersections for each ray |
vcgRaySearch
## Not run:
require(Morpho); require(rgl)
data(humface)
humface1 <- scalemesh(humface,size=1.1)
mesh <- mergeMeshes(humface,humface1) #get normals of landmarks
x <- vcgClost(humface.lm, humface)
# offset landmarks along their normals for a negative amount of -5mm
x$vb[1:3,] <- x$vb[1:3,]+x$normals[1:3,]*-5
myint <- raysearchMulti(x,mesh)
wire3d(mesh,col="white")
spheres3d(vert2points(x),radius=0.5,col=3)
plotNormals(x,length=55,lwd=2)
for (i in 1:length(myint$intersects)) {
spheres3d(vert2points(myint$intersects[[i]])[which(as.logical(myint$intersects[[i]]$quality)),]
,col=i)
}
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.