Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
F
fslpy
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Deploy
Releases
Container Registry
Model registry
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Michiel Cottaar
fslpy
Commits
d1bac406
Commit
d1bac406
authored
7 years ago
by
Paul McCarthy
Browse files
Options
Downloads
Patches
Plain Diff
New TriangleMesh.nearestVertex function.
parent
61ed3b19
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
fsl/data/mesh.py
+27
-0
27 additions, 0 deletions
fsl/data/mesh.py
with
27 additions
and
0 deletions
fsl/data/mesh.py
+
27
−
0
View file @
d1bac406
...
@@ -303,6 +303,33 @@ class TriangleMesh(object):
...
@@ -303,6 +303,33 @@ class TriangleMesh(object):
return
locs
,
tris
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
):
def
getBounds
(
self
):
"""
Returns a tuple of values which define a minimal bounding box that
"""
Returns a tuple of values which define a minimal bounding box that
will contain all vertices in this ``TriangleMesh`` instance. The
will contain all vertices in this ``TriangleMesh`` instance. The
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment