We know that degenerate triangle is a triangle which has all three of its points in a line, and thus has all of its sides on top of each other. So there is a three sides of triangle and now I have to determine whether it degenerate triangle or generate triangle.
How can I proceed to solve this using C language ?
Approach: The key observation in the problem is three points form a triangle only when they don't lie on the straight line, that is an area formed by the triangle of these three points is not equal to zero.
Non-degenerate triangle − it is a triangle that has a positive area. The condition for a non-degenerate triangle with sides a, b, c is − a + b > c a + c > b b + c > a.
They occur in the family of geometric objects with a common property of conics. For example, a conic section represented by an equation x2 – y2 = 0 can be called a degenerate as it is reduced to (x – y) (x + y) = 0 and has close proximity to the 2 intersecting lines forming at “X”.
Generally speaking, a polygon is non-degenerate if it has no anomalous points, but this just pushes the problem back one step; what is "anomalous"? The real answer is that a polygon is degenerate if it violates the specification.
When you have three side lengths satisfying a
≤ b
≤ c
and the sum a
+ b
= c
, then the triangle is degenerate.
(Valid triangles have a
+ b
> c
and triangles with a
+ b
< c
are not possible.)
If a, b, and c are the lengths of the three sides of a triangle, then
a + b > c
a + c > b
b + c > a
If any one of these inequalities is not true, then we get a degenerate triangle.
In simple term,first sort the a, b, c in ascending order then check below condition
a + b <= c
if this condition satisfy then triangle is degenerate triangle.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With