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
This commit is contained in:
Roman Shapovalov 2021-07-23 09:31:57 -07:00 committed by Facebook GitHub Bot
parent 1872e0249c
commit e794d062e8

View File

@ -14,6 +14,9 @@ class RayBundle(NamedTuple):
RayBundle parametrizes points along projection rays by storing ray `origins`, RayBundle parametrizes points along projection rays by storing ray `origins`,
`directions` vectors and `lengths` at which the ray-points are sampled. `directions` vectors and `lengths` at which the ray-points are sampled.
Furthermore, the xy-locations (`xys`) of the ray pixels are stored as well. 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 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] + 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: Args:
ray_bundle: A `RayBundle` object with fields: 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] + rays_directions[i, :] * rays_lengths[i, j]
) )
``` ```
Note that both the directions and magnitudes of the vectors in
`rays_directions` matter.
Args: Args:
rays_origins: A tensor of shape `(..., 3)` rays_origins: A tensor of shape `(..., 3)`