Sunday, January 24, 2010

Valid triangle test case?

I need to write a test case to test three lines to determine if they form a valid triangle and what type of triangle they form. Is there a simple math algorithm/s which can be used for these tests?Valid triangle test case?
Let...


a = length of shortest line segment


b = length of 2nd shortest line segment


c = length of longest line segment





If a + b %26gt; c, then you can make a valid triangle out of the three line segments.





Furthermore, if a^2 + b^2 %26gt; c^2, the triangle is acute, if a^2 + b^2 = c^2 the triangle is right, and if a^2 + b^2 %26lt; c^2 the triangle is obtuse.

No comments:

Post a Comment