from typing import Tuple class Inertia: def __init__(self, area: float, centroid: Tuple[float, float]): self.area = area self.centroid = centroid def __add__(self, other): AX = self.area * self.centroid[0] + other.area * other.centroid[0] AY = self.area * self.centroid[1] + other.area * other.centroid[1] self.area = self.area + other.area self.centroid = (AX / self.area, AY / self.area)