For a set of 3D-coordinates/triangular mesh, the closest matches on a target surface are determined (by using KD-tree search) and normals at as well as distances to that point are calculated.
vcgClostKD(
x,
mesh,
sign = TRUE,
barycentric = FALSE,
smoothNormals = FALSE,
borderchk = FALSE,
k = 50,
nofPoints = 16,
maxDepth = 64,
angdev = NULL,
weightnorm = FALSE,
facenormals = FALSE,
threads = 1,
...
)
returns an object of class "mesh3d" with:
4 x n matrix containing n vertices as homolougous coordinates.
4 x n matrix containing vertex normals.
numeric vector containing distances to target.
3 x m integer matrix containing vertex indices forming triangular faces.Only available, when x is a mesh.
integer vector of length n: if borderchk = TRUE, for each clostest point the value will be 1 if the hit face is at the border of the target mesh and 0 otherwise.
3 x m Matrix containing barycentric coordinates of closest points; only available if barycentric=TRUE.
k x 3 matrix containing 3D-coordinates or object of class "mesh3d".
triangular surface mesh stored as object of class "mesh3d".
logical: if TRUE, signed distances are returned.
logical: if TRUE, barycentric coordinates of the hit points are returned.
logical: if TRUE, laplacian smoothed normals are used.
logical: request checking if the hit face is at the border of the mesh.
integer: check the kdtree for thek
closest faces (using faces' barycenters.
integer: number of points per cell in the kd-tree (don't change unless you know what you are doing!)
integer: depth of the kd-tree (don't change unless you know what you are doing!)
maximum deviation between reference and target normals. If the none of the k closest triangles match this criterion, the closest point on the closest triangle is returned but the corresponding distance in $quality is set to 1e5.
logical if angdev is set, this requests the normal of the closest points to be estimated by weighting the surrounding vertex normals. Otherwise, simply the hit face's normal is used (faster but slightly less accurate)
logical: if TRUE only the facenormal of the face the closest point has hit is returned, the weighted average of the surrounding vertex normals otherwise.
integer: threads to use in closest point search.
additional parameters, currently unused.
Stefan Schlager
Baerentzen, Jakob Andreas. & Aanaes, H., 2002. Generating Signed Distance Fields From Triangle Meshes. Informatics and Mathematical Modelling.
vcgPlyRead