# Problem Description
This is a geometric transformation problem where we need to:
1. Calculate the new position of a circle's center after rotation
2. The rotation occurs around a fixed point (green point)
3. The rotation angle is given in degrees (can be positive or negative)
4. The circle maintains its size and shape during transformation
5. The blue area represents the region covered by the rotating radius formed between the red point and the green point during the rotation process.

# Visual Facts
1. The diagram shows two examples with different rotations:
   - Example 1: 90° (counterclockwise)
   - Example 2: -90° (clockwise)

2. Coordinate Points:
   - Green point coordinates: (3,5) in both examples
   - Red point coordinates: 
     - Example 1: starts at (3,3), ends at (5,5)
     - Example 2: starts at (5,5), ends at (3,3)

3. Grid Properties:
   - Both x and y axes range from 0 to 8
   - Grid lines are spaced at unit intervals

4. Visual Elements:
   - Red dot represents the circle's center
   - Green dot serves as the rotation pivot point
   - Circle maintains constant radius during rotation
   - Dotted lines show the rotation path

# Visual Patterns
1. Rotational Properties:
   - Positive angle (90°) results in counterclockwise rotation
   - Negative angle (-90°) results in clockwise rotation
   - The rotation preserves the distance between red and green points

2. Mathematical Patterns:
   - The radius of rotation equals the distance between red and green points
   - The rotation follows standard geometric rotation formulas around a pivot point
   - 90° rotation creates perpendicular lines between original and final positions

3. Transformation Rules:
   - The circle's shape and size remain unchanged during rotation
   - The transformation only affects the position of the circle's center
   - All points maintain their relative distances from the pivot point
   - The rotation arc length is proportional to the angle of rotation
   - The blue area represents the region covered by the rotating radius formed between the red point and the green point during the rotation process.

4. Geometric Constraints:
   - The rotation occurs in a 2D plane
   - The pivot point (green) remains stationary
   - The transformation preserves the circle's geometric properties

# Solution
from typing import Tuple
import math

def solution(red: Tuple[float, float], angle: int, green: Tuple[float, float]) -> float:
    """
    Calculate the area of the blue sector.

    Args:
        red: A tuple (x, y) representing the coordinates of the red point.
        angle: An integer representing the rotation angle in degrees.
        green: A tuple (x, y) representing the coordinates of the green point.

    Returns:
        A float representing the area of the blue sector.
    """
    # Extract coordinates
    rx, ry = red
    gx, gy = green

    # Calculate the radius (distance between red and green)
    dx = rx - gx
    dy = ry - gy
    radius = math.hypot(dx, dy)  # Equivalent to sqrt(dx^2 + dy^2)

    # Calculate the sector area
    sector_area = (abs(angle) / 360) * math.pi * (radius ** 2)

    return round(sector_area, 2)


# Test Script
def test():
    def tuples_almost_equal(t1, t2,  tol: float = 1e-2) -> bool:
         return abs(t1 - t2) < tol

    test_cases = [
        {
            'red': (5.0, 5.0),
            'angle': 90,
            'green': (3.0, 5.0),
            'expected': 3.14
        },
        {
            'red': (5.0, 5.0),
            'angle': 180,
            'green': (3.0, 3.0),
            'expected': 12.57
        },
        {
            'red': (5.0, 5.0),
            'angle': 270,
            'green': (2.5, 5.0),
            'expected': 14.73
        },
        {
            'red': (1.0, 5.0),
            'angle': 45,
            'green': (3, 5.0),
            'expected': 1.57
        },
        {
            'red': (1, 1),
            'angle': 90,
            'green': (4, 4),
            'expected': 14.14
        },
        {
            'red': (0, 0),
            'angle': 90,
            'green': (100, 100),
            'expected':  15707.96
        },
        {
            'red': (5.0, 5.0),
            'angle': -90,
            'green': (-5, -5),
            'expected':  157.08
        },
        {
            'red': (10.0, 5.0),
            'angle': -90,
            'green': (-5, -10),
            'expected': 353.43
        },
                {
            'red': (10.0, 5.0),
            'angle': 90,
            'green': (-5, -10),
            'expected': 353.43
        },
                {
            'red': (10.0, 5.0),
            'angle': 180,
            'green': (-5, -10),
            'expected': 706.86
        },
    ]

    for test in test_cases:
        try:
            output = solution(
                red=test['red'],
                angle=test['angle'], 
                green=test['green']
            )
        except Exception as e:
            error_message = (
                f"An exception occurred while running the test case:\n"
                f"`red`: {test['red']}\n"
                f"`angle`: {test['angle']}\n"
                f"`green`: {test['green']}\n\n"
                f"Exception: '{str(e)}'"
            )
            assert False, error_message

        if not tuples_almost_equal(output, test['expected']):
            error_message = (
                f"The following Test Case failed:\n"
                f"`red`: {test['red']}\n"
                f"`angle`: {test['angle']}\n"
                f"`green`: {test['green']}\n\n"
                f"Actual Output: {output}\n"
                f"Expected Output: {test['expected']}"
            )
            assert False, error_message

test()