def centeroidOfTriangle(pa, pb, pc):
    """
    when given 3 points that are corners of a triangle
    this code calculates and returns the center of the triangle.
    the exact type of center is called "centeroid".
    it is the intersection point of the connection of each angle
    to the middle of its opposed edge.
    two of these connections are enough to get the intersection point.

    https://en.wikipedia.org/wiki/Centroid
    https://en.wikipedia.org/wiki/Line%E2%80%93line_intersection#Given_the_equations_of_the_lines
    """
    # get the middle of the opposing line (point pa to point pb has middle cm)
    am = [(pb[0] + pc[0]) / 2, (pb[1] + pc[1]) / 2]
    bm = [(pa[0] + pc[0]) / 2, (pa[1] + pc[1]) / 2]
    denominator = (pa[0] - am[0]) * (pb[1] - bm[1]) - \
        (pa[1] - am[1]) * (pb[0] - bm[0])
    if denominator != 0:
        x = ((pa[0] * am[1] - pa[1] * am[0]) * (pb[0] - bm[0]) -
             (pa[0] - am[0]) * (pb[0] * bm[1] - pb[1] * bm[0])) / denominator
        y = ((pa[0] * am[1] - pa[1] * am[0]) * (pb[1] - bm[1]) -
             (pa[1] - am[1]) * (pb[0] * bm[1] - pb[1] * bm[0])) / denominator
    else:
        print(f"cant find center for {pa}, {pb}, {pc}")
        x = pa[0]
        y = pa[1]
    return [x, y]