Beta
Triangle in a Square
Loading description...
Mathematics
Geometry
Algorithms
View
This comment has been reported as {{ abuseKindText }}.
Show
This comment has been hidden. You can view it now .
This comment can not be viewed.
- |
- Reply
- Edit
- View Solution
- Expand 1 Reply Expand {{ comments?.length }} replies
- Collapse
- Spoiler
- Remove
- Remove comment & replies
- Report
{{ fetchSolutionsError }}
-
-
Your rendered github-flavored markdown will appear here.
-
Label this discussion...
-
No Label
Keep the comment unlabeled if none of the below applies.
-
Issue
Use the issue label when reporting problems with the kata.
Be sure to explain the problem clearly and include the steps to reproduce. -
Suggestion
Use the suggestion label if you have feedback on how this kata can be improved.
-
Question
Use the question label if you have questions and/or need help solving the kata.
Don't forget to mention the language you're using, and mark as having spoiler if you include your solution.
-
No Label
- Cancel
Commenting is not allowed on this discussion
You cannot view this solution
There is no solution to show
Please sign in or sign up to leave a comment.
Reference solution used for random tests is clearly incorrect:
At
a = 415339.9863145371
pointing 88 degrees clockwise andb = 459659.20499247574
pointing ~172.43 degrees counter-clockwise, the third side equalsc = 666405.0066220658
and the bounding square is around471795.42395730014
, smaller than479755.37244198116
.While the issue is valid, your solution seems to have some rounding problems, e.g.
Yes, because my solution was just brute-forcing all the angles. It wasn't constant time, and there are always gaps between the angles tried.
One fixed test case is
TriangleFitsInSquare(120.378, 340.873, 220.494, 600.698)
, which violates the triangle equality (and expectstrue
for some reasons).There are also cases like
TriangleFitsInSquare(101.419, 184.952, 83.533, 454.56)
which is a triangle with 0 area.This comment has been hidden.
This comment has been hidden.
Hi, thank you. Added them. I tried to be lazy with negative test cases, and immediately someone noticed it :D Designing my first kata, as you see.
Yes, was easy to see - bad world;-)... So thanks and well done:-)!