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.
Time to work on plan B; pdist isn't valid in Cody. :-(
This one should not pass, it checks for parallelograms.
Thanks for bringing this to my attention Jan. Test suite has been updated.
Project Euler: Problem 1, Multiples of 3 and 5
Return the first and last characters of a character array
The Answer to Life, the Universe, and Everything
Sum the numbers on the main diagonal
01 - Scalar variables
Create an 8-color version of an image
Create cell array of numeric arrays
The Python Challenge, Level 1: Decode strings
Find mistyped words in text (mixed-up letters)
Pentago: find winning move
Find the treasures in MATLAB Central and discover how the community can help you!
Choose a web site to get translated content where available and see local events and offers. Based on your location, we recommend that you select: .
You can also select a web site from the following list:
Select the China site (in Chinese or English) for best site performance. Other MathWorks country sites are not optimized for visits from your location.
Contact your local office