def rigid_transform(xyz, transform):
    """Applies a rigid transform (c2w) to an (N, 3) pointcloud.
    """
    device = xyz.device
    xyz_h = torch.cat([xyz, torch.ones((len(xyz), 1)).to(device)], dim=1)  # (N, 4)
    xyz_t_h = (transform @ xyz_h.T).T  # * checked: the same with the below

    return xyz_t_h[:, :3]
Applies a rigid transform (c2w) to an (N, 3) pointcloud.
    
mv-diffusion/One-2-3-45-by-view/reconstruction/data/scene.py