"""
A class for triangles.
>>> Triangle(Point(22, 1), Point(4, 12), Point(6, 3)).print()
(22, 1), (4, 12), (6, 3)
>>> Triangle(Point(0, 0), Point(0, 3), Point(4, 0)).perimeter()
12.0
"""
from typing import Final
from point import Point
from polygon import Polygon
class Triangle(Polygon):
"""The class for triangles."""
def __init__(self, p1: Point, p2: Point, p3: Point) -> None:
"""
Create a triangle.
:param p1: the first point spanning the triangle
:param p2: the second point spanning the triangle
:param p3: the third point spanning the triangle
"""
if (p1.distance(p2) tuple[Point, Point, Point]:
"""
Get the three points describing this triangle.
:return: a tuple with the three corners of this triangle
"""
return self.p1, self.p2, self.p3