class_docstr: Axis-aligned bounding box defined by the two opposite corners.
class_docstr_tok: ["Axis-aligned","bounding","box","defined","by","the","two","opposite","corners","."]
docstr: Args:
      origin: [batch_size, *shape, 3]
      direction: [batch_size, *shape, 3]
      t0_lower: Optional [batch_size, *shape, 1] lower bound of t0 when intersecting this volume.
      params: Optional meta parameters in case Volume is parametric
      epsilon: to stabilize calculations
  
  Return:
      A tuple of (t0, t1, intersected) where each has a shape [batch_size, *shape, 1]. If a ray intersects with
      the volume, `o + td` is in the volume for all t in [t0, t1]. If the volume is bounded, t1 is guaranteed to
      be on the boundary of the volume.
docstr_tok: ["Args",":","origin",":","[","batch_size",",","*","shape",",","3","]","direction",":","[","batch_size",",","*","shape",",","3","]","t0_lower",":","Optional","[","batch_size",",","*","shape",",","1","]","lower","bound","of","t0","when","intersecting","this","volume",".","params",":","Optional","meta","parameters","in","case","Volume","is","parametric","epsilon",":","to","stabilize","calculations","Return",":","A","tuple","of","(","t0",",","t1",",","intersected",")","where","each","has","a","shape","[","batch_size",",","*","shape",",","1","]",".","If","a","ray","intersects","with","the","volume",",","`","o","+","td","`","is","in","the","volume","for","all","t","in","[","t0",",","t1","]",".","If","the","volume","is","bounded",",","t1","is","guaranteed","to","be","on","the","boundary","of","the","volume","."]
code: def intersect(
      self,
      origin: torch.Tensor,
      direction: torch.Tensor,
      t0_lower: Optional[torch.Tensor] = None,
      epsilon=1e-6,
  ):
      """
      Args:
          origin: [batch_size, *shape, 3]
          direction: [batch_size, *shape, 3]
          t0_lower: Optional [batch_size, *shape, 1] lower bound of t0 when intersecting this volume.
          params: Optional meta parameters in case Volume is parametric
          epsilon: to stabilize calculations
  
      Return:
          A tuple of (t0, t1, intersected) where each has a shape [batch_size, *shape, 1]. If a ray intersects with
          the volume, `o + td` is in the volume for all t in [t0, t1]. If the volume is bounded, t1 is guaranteed to
          be on the boundary of the volume.
      """
  
      batch_size, *shape, _ = origin.shape
      ones = [1] * len(shape)
      bbox = self.bbox.view(1, *ones, 2, 3).to(origin.device)
  
      def _safe_divide(a, b, epsilon=1e-6):
          return a / torch.where(b < 0, b - epsilon, b + epsilon)
  
      ts = _safe_divide(
          bbox - origin[..., None, :],
          direction[..., None, :],
          epsilon=epsilon,
      )
  
      # Cases to think about:
      #
      #   1. t1 <= t0: the ray does not pass through the AABB.
      #   2. t0 < t1 <= 0: the ray intersects but the BB is behind the origin.
      #   3. t0 <= 0 <= t1: the ray starts from inside the BB
      #   4. 0 <= t0 < t1: the ray is not inside and intersects with the BB twice.
      #
      # 1 and 4 are clearly handled from t0 < t1 below.
      # Making t0 at least min_dist (>= 0) takes care of 2 and 3.
      t0 = (
          ts.min(dim=-2)
          .values.max(dim=-1, keepdim=True)
          .values.clamp(self.min_dist)
      )
      t1 = ts.max(dim=-2).values.min(dim=-1, keepdim=True).values
      assert t0.shape == t1.shape == (batch_size, *shape, 1)
      if t0_lower is not None:
          assert t0.shape == t0_lower.shape
          t0 = torch.maximum(t0, t0_lower)
  
      intersected = t0 + self.min_t_range < t1
      t0 = torch.where(intersected, t0, torch.zeros_like(t0))
      t1 = torch.where(intersected, t1, torch.ones_like(t1))
  
      return VolumeRange(t0=t0, t1=t1, intersected=intersected)
  
imports: import math
  from dataclasses import dataclass
  from typing import Dict, Optional, Tuple
  import numpy
  import torch
  import torch.nn.functional
  from torch import nn
  from ...configuration_utils import ConfigMixin, register_to_config
  from ...models import ModelMixin
  from ...utils import BaseOutput
  from .camera import create_pan_cameras
label_desc: Use image node_id 2 for calling the BoundingBoxVolume obj's underlying member method code with example usage: obj.intersect(origin, direction, t0_lower, epsilon) and returns: VolumeRange, unknown