Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Given three side of a triangle, how can I define whether it is a degenerate triangle or not?

Tags:

c

syntax

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 ?

like image 522
Salman Sourav Avatar asked Oct 09 '15 11:10

Salman Sourav


People also ask

How do you check whether 3 points form a triangle or not?

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.

What is meant by non-degenerate triangle?

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.

What is a degenerate equation?

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”.

What is a non-degenerate polygon?

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.


2 Answers

When you have three side lengths satisfying abc 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.)

like image 110
M Oehm Avatar answered Sep 18 '22 12:09

M Oehm


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.

like image 27
ajeet Avatar answered Sep 21 '22 12:09

ajeet