From e794d062e85a8f5211b68eecb351429aeb065409 Mon Sep 17 00:00:00 2001 From: Roman Shapovalov Date: Fri, 23 Jul 2021 09:31:57 -0700 Subject: [PATCH] Improving RayBundle docstrings Summary: This changes only documentation. We want to be explicit that ray directions are not normalised (nor assumed to be normalised) but their magnitude is used. Reviewed By: nikhilaravi Differential Revision: D29845210 fbshipit-source-id: b81fb3da13a42ad20e8721ed5271fd4f3d8f5acb --- pytorch3d/renderer/implicit/utils.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/pytorch3d/renderer/implicit/utils.py b/pytorch3d/renderer/implicit/utils.py index c27870e3..a973bdee 100644 --- a/pytorch3d/renderer/implicit/utils.py +++ b/pytorch3d/renderer/implicit/utils.py @@ -14,6 +14,9 @@ class RayBundle(NamedTuple): RayBundle parametrizes points along projection rays by storing ray `origins`, `directions` vectors and `lengths` at which the ray-points are sampled. Furthermore, the xy-locations (`xys`) of the ray pixels are stored as well. + Note that `directions` don't have to be normalized; they define unit vectors + in the respective 1D coordinate systems; see documentation for + :func:`ray_bundle_to_ray_points` for the conversion formula. """ origins: torch.Tensor @@ -36,6 +39,8 @@ def ray_bundle_to_ray_points(ray_bundle: RayBundle) -> torch.Tensor: + ray_bundle.directions[i, :] * ray_bundle.lengths[i, j] ) ``` + Note that both the directions and magnitudes of the vectors in + `ray_bundle.directions` matter. Args: ray_bundle: A `RayBundle` object with fields: @@ -70,6 +75,8 @@ def ray_bundle_variables_to_ray_points( + rays_directions[i, :] * rays_lengths[i, j] ) ``` + Note that both the directions and magnitudes of the vectors in + `rays_directions` matter. Args: rays_origins: A tensor of shape `(..., 3)`