Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
M
Multi-agent interaction planning
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Larkin Heintzman
Multi-agent interaction planning
Commits
282a6440
Commit
282a6440
authored
Dec 10, 2019
by
Larkin Heintzman
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Upload New File
parent
852e9434
Pipeline
#27
canceled with stages
Changes
1
Pipelines
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
18 additions
and
0 deletions
+18
-0
getNearestVertex.m
Matlab Code/getNearestVertex.m
+18
-0
No files found.
Matlab Code/getNearestVertex.m
0 → 100644
View file @
282a6440
function
nearest_vertex
=
getNearestVertex
(
q_point
,
vertex_coords
,
search_radius
)
empty_entry
=
zeros
(
size
(
vertex_coords
(
1
,:)));
vertex_coords_trimmed
=
vertex_coords
([
1
,
3
:
length
(
vertex_coords
)],:);
% ignore entry 2
% vertex_coords_trimmed = vertex_coords;
vertex_coords_trimmed
=
vertex_coords_trimmed
(
any
(
vertex_coords_trimmed
~=
empty_entry
,
2
),:);
% get rid of zero zero entries
q_dist
=
sqrt
((
q_point
(
1
)
-
vertex_coords_trimmed
(:,
1
))
.^
2
+
(
q_point
(
2
)
-
vertex_coords_trimmed
(:,
2
))
.^
2
);
if
search_radius
==
-
1
% only want the nearest point, not list
[
~
,
nearest_index
]
=
min
(
q_dist
);
nearest_vertex
=
vertex_coords_trimmed
(
nearest_index
,:);
else
% looking for a list of vertices that are within the search radius
nearest_vertex
=
vertex_coords_trimmed
(
q_dist
<=
search_radius
,:);
end
end
\ No newline at end of file
Write
Preview
Markdown
is supported
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