def transform_point(p, affine):
    """
    Apply affine to point p

    Args:
        p: [x, y, z]
        affine: [4x4] matrix

    Returns:
        [x, y, z]
    """
    M = affine[:3, :3]
    offset = affine[:3, 3]
    return M.dot(p) + offset