import torch


def normalize_pointcloud_transform(x):
    """
    Compute an affine transformation that normalizes the point cloud x to lie in [-0.5, 0.5]^2
    :param x: A point cloud represented as a tensor of shape [N, 3]
    :return: An affine transformation represented as a tuple (t, s) where t is a translation and s is scale
    """
    min_x, max_x = x.min(0)[0], x.max(0)[0]
    bbox_size = max_x - min_x

    translate = -(min_x + 0.5 * bbox_size)
    scale = 1.0 / torch.max(bbox_size)

    return translate, scale