Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Michiel Cottaar
fslpy
Commits
d1bac406
Commit
d1bac406
authored
Jan 17, 2018
by
Paul McCarthy
🚵
Browse files
New TriangleMesh.nearestVertex function.
parent
61ed3b19
Changes
1
Hide whitespace changes
Inline
Side-by-side
fsl/data/mesh.py
View file @
d1bac406
...
...
@@ -303,6 +303,33 @@ class TriangleMesh(object):
return
locs
,
tris
def
nearestVertex
(
self
,
points
):
"""Identifies the nearest vertex to each of the provided points.
:arg points: A ``(n, 3)`` array containing the points to query.
:returns: A tuple containing:
- A ``(n, 3)`` array containing the nearest vertex for
for each of the ``n`` input points.
- A ``(n,)`` array containing the indices of each vertex.
- A ``(n,)`` array containing the distance from each
point to the nearest vertex.
"""
trimesh
=
self
.
trimesh
()
if
trimesh
is
None
:
return
np
.
zeros
((
0
,
3
))
dists
,
idxs
=
trimesh
.
nearest
.
vertex
(
points
)
verts
=
self
.
vertices
[
idxs
,
:]
return
verts
,
idxs
,
dists
def
getBounds
(
self
):
"""Returns a tuple of values which define a minimal bounding box that
will contain all vertices in this ``TriangleMesh`` instance. The
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment