def calculate_dimensions(point1, point2):
    """
    Calculates the length and width of a rectangle with opposite corners
    defined by point1 and point2.
    """
    return abs(point1.getX() - point2.getX()), abs(point1.getY() - point2.getY())