Write a program that takes three 2d coordinate tuples (Cartesian), and classifies what shape these three points describe.
In almost all cases these points will describe a triangle of varying types. In some degenerate cases, the points will either describe a singular point or a straight line. The program will determine which of the following tags apply to the described shape:
- Point (3 points are co-incident)
- Line (3 points lie on a straight line - no more than 2 points may be co-incident)
- Equilateral (3 sides equal, 3 angles equal)
- Isosceles (2 sides equal, 2 angles equal)
- Scalene (0 sides equal, 0 angles equal)
- Right (1 angle exactly π/2 (or 90°))
- Oblique (0 angles exactly π/2 (or 90°))
- Obtuse (1 angle > π/2 (or 90°))
- Acute (3 angles < π/2 (or 90°))
Note that for some described shapes, more than one of the above tags will apply. For example, any right-angled will also either be isosceles or scalene.
- The program may read the 3 input coordinates from STDIN, command-line, environment variables or whatever method is convenient for your language of choice.
- The input co-ordinates my be formatted however is convenient for your language of choice. It can be assumed that all input numbers are well-formed with respect to the datatypes you end up using.
- Nothing can be assumed about the ordering of the input coordinates.
- The program will output to STDOUT, dialog box or whatever display method is convenient for your language of choice.
- The output will display all the tags applicable to the shape described by the input coordinates.
- Tags may be output in any order.
- Your language's trigonometric libraries/APIs are allowed, but any APIs that specifically calculate triangle types are banned.
- When determining equality of angles or lengths of sides, you will likely end up comparing floating-point values. Two such values are to be considered "equal" if one is within 1% of the other.
- Standard “loopholes” which are no longer funny
- This is code-golf, so the shortest answer in bytes wins.
Input Output (1,2) (1,2) (1,2) Point (1,2) (3,4) (5,6) Line (0,0) (1,1) (2,0) Isosceles Right (0,0) (2,1) (10,1) Scalene Oblique Obtuse