![]() If two out of three sides of a triangle have equal length, then the triangle will be called an isosceles triangle. Triangles are classified into two categories based on their side and angle. We should also know that the sum of all the interior angles of a triangle is always 180 degrees. Those three line segments are the sides of the triangle, the point where the two lines intersect is known as the vertex, and the space between them is what we call an angle. We can draw a triangle using any three dots in such a way that the line segments will connect each other end to end. It is the basic or the purest form of Polygon. If it is, you claim that f + g = h (as best as you can tell) and deal with the degenerate case.A triangle is a 2-dimensional closed figure that has three sides and angles. You then check whether the sum of f and g is somewhere between h - epsilon and h + epsilon – or put another way, whether the absolute value of f + g - h is less than or equal to epsilon. In those cases, if you want to catch degenerate triangles, what you usually do is pick an "epsilon" value (some very small value relative to the numbers you're dealing with) that represents the maximum amount of roundoff you're willing to tolerate. But when checking the "not a triangle" condition, it's relatively easy to set up a situation where adding the two sides rounds off (because of the vicissitudes of floating-point arithmetic in the CPU) to something that's very close to, but not quite exactly, the third side. For checking the equilateral/isosceles/scalene conditions, you're fine because the user is directly entering in the floating-point numbers and you're not manipulating them, so there's no chance for you to introduce error.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |