Problem 2671. Check if vertices form a rectangle
Solution Stats
Problem Comments
-
5 Comments
Most current solutions will fail if the four points fall on a circle but don't form a rectangle. Try adding X=[0 sqrt(2)/2 sqrt(2)/2 0]', Y=[1 sqrt(2)/2 -sqrt(2)/2 -1]'
Jon, I updated the test suite to include parallelograms that are not rectangles. While it does not include the specific example you gave, I think it takes care of the problem. Let me know if you think there is still an issue.
Matt, Jon's example can 'kill' some approaches, that check for trapezoids. X=[-1 -0.5 0.5 1]; Y=[0 sqrt(3)/2 sqrt(3)/2 0]; can eliminate those solutions which check only for 3 unique distances between points. It would be beneficial, to try some trapezoids, as well as kites or rhombi. Anyway, great problem!
Ah yes, I agree. Test suite updated again.
I don't know why there is a loop in the test cases when the rng is set to a particular value. randi will generate the same values again and again.
Doesn't make much sense.
Solution Comments
-
1 Comment
Time to work on plan B; pdist isn't valid in Cody. :-(
-
2 Comments
This one should not pass, it checks for parallelograms.
Thanks for bringing this to my attention Jan. Test suite has been updated.
Problem Recent Solvers17
Suggested Problems
-
given 3 sides, find area of this triangle
738 Solvers
-
How long is the longest prime diagonal?
367 Solvers
-
577 Solvers
-
Create a vector whose elements depend on the previous element
504 Solvers
-
Split a string into chunks of specified length
973 Solvers
More from this Author43
Problem Tags
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!