near_far_from_sphere
013292 opened this issue · 1 comments
013292 commented
Hi, since the previous issue on this topic has been closed, I open up this new one.
the snippet:
def near_far_from_sphere(self, rays_o, rays_d):
a = torch.sum(rays_d**2, dim=-1, keepdim=True)
b = 2.0 * torch.sum(rays_o * rays_d, dim=-1, keepdim=True)
mid = 0.5 * (-b) / a
near = mid - 1.0
far = mid + 1.0
return near, far
May I take it this way: the sphere is centered at the origin of world space and its radius is 1, so that c = torch.sum(rays_o**2, dim=-1, keepdim=True) - 1
?
But if I calculate x = (-b + torch.sqrt(b**2 - 4*a*c))/(2*a)
, it is non of near or far.
What's the difference between the solution x
and the near and far
?
Thank you :-)
xucao-42 commented