4xn matrix containing n vertices as homolougous coordinates
normals
4xn matrix containing vertex normals
quality
vector: containing distances to target. In case of method=1, this is not the Euclidean distance but the distance of the reference point to the faceplane (orthogonally projected) plus the distance to the closest point on one of the face's edges (the target point). See the literature cited below for details.
it
4xm matrix containing vertex indices forming triangular faces.Only available, when x is a mesh
Arguments
x
k x 3 matrix containing 3D-coordinates or object of class
mesh3d.
mesh
triangular surface mesh stored as object of class mesh3d.
k
neighbourhood of kd-tree to search - the larger, the slower - but
the more likely the absolutely closest point is hit.
sign
logical: if TRUE, signed distances are returned.
barycoords
logical: if TRUE, barycentric coordinates of the
hit points are returned.
cores
integer: how many cores to use for the search algorithm.
method
integer: either 0 or 1, if 0 ordinary Euclidean distance is
used, if 1, the distance suggested by Moshfeghi(1994) is calculated.
...
additional arguments. currently unavailable.
Author
Stefan Schlager
Details
The search for the clostest point is designed as follows: Calculate the
barycenter of each target face. For each coordinate of x, determine the k
closest barycenters and calculate the distances to the closest point on
these faces.
References
Baerentzen, Jakob Andreas. & Aanaes, H., 2002. Generating Signed
Distance Fields From Triangle Meshes. Informatics and Mathematical
Modelling.
Moshfeghi M, Ranganath S, Nawyn K. 1994. Three-dimensional elastic matching
of volumes IEEE Transactions on Image Processing: A Publication of the IEEE
Signal Processing Society 3:128-138.
data(nose)
out <- closemeshKD(longnose.lm,shortnose.mesh,sign=TRUE)
### show distances - they are very small because###longnose.lm is scaled to unit centroid size.hist(out$quality)