Problem 51. Find the two most distant points
Solution Stats
Problem Comments
-
6 Comments
More easy that it seems.
You need to specify "Euclidean" distance :-)
Good problem, not too hard but required thinking
Please add the next test :
p = [0,0;
2,1;
2,6;
1,6];
ix_correct = [1 3];
assert(isequal(mostDistant(p),ix_correct))
The solutions of the form:
[~,indx]=max(dist(p'));
unique(indx)
will fail, the last line will return an extra index [1,3,4] instead of just [1,3]
refer to
Convex Hull therom and the Graham's Scan method
+1
Solution Comments
Show commentsProblem Recent Solvers2496
Suggested Problems
-
Replace NaNs with the number that appears to its left in the row.
2737 Solvers
-
790 Solvers
-
260 Solvers
-
Arrange vector in ascending order
738 Solvers
-
Create an index-powered vector
579 Solvers
More from this Author96
Problem Tags
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!