Hi, I was going through the codebase and came across the following function that computes the distance between points and the gaussian surface. Is there any derivation or explanation available for this code?
For instance:
Why rotate the difference of the mean position of the 3D gaussians?
Why not compute distance between gaussians as the simple euclidian distance between the means of the 3D gaussians (as visualized in the paper)
def distance_to_gaussian_surface(mean, svec, rotmat, query):
# mean - N x 3 - torch.Tensor (mean position)
# svec - N x 3 - torch.Tensor (scale vector)
# rotmat - N x 3 x 3 - torch.Tensor (rotation matrix)
# query - N x 3 - torch.Tensor (query points)
xyz = query - mean
# TODO: check here
# breakpoint()
xyz = torch.einsum("bij,bj->bi", rotmat.transpose(-1, -2), xyz)
xyz = F.normalize(xyz, dim=-1)
z = xyz[..., 2]
y = xyz[..., 1]
x = xyz[..., 0]
r_xy = torch.sqrt(x**2 + y**2 + 1e-10)
cos_theta = z
sin_theta = r_xy
cos_phi = x / r_xy
sin_phi = y / r_xy
d2 = svec[..., 0] ** 2 * cos_phi**2 + svec[..., 1] ** 2 * sin_phi**2
r2 = svec[..., 2] ** 2 * cos_theta**2 + d2**2 * sin_theta**2
return torch.sqrt(r2 + 1e-10)
Hi, I was going through the codebase and came across the following function that computes the distance between points and the gaussian surface. Is there any derivation or explanation available for this code?
For instance: