from typing import Callable
from typing import Union


def transform_curve(
    curve: Callable,
    matrix: tuple[
        tuple[Union[float, int], Union[float, int]],
        tuple[Union[float, int], Union[float, int]],
    ],
) -> Callable:
    """
    Applies a linear transformation (matrix) to a curve.

    :param curve: parametrized curve
    :param matrix: linear transformation 2x2 matrix (same structure as numpy arrays)
    """
    g = lambda t: curve(t)[0]
    m = lambda t: curve(t)[1]
    return lambda t: (
        g(t) * matrix[0][0] + m(t) * matrix[0][1],
        g(t) * matrix[1][0] + m(t) * matrix[1][1],
    )