:param origin: [batch_size, *shape, 3] :param direction: [batch_size, *shape, 3] :param t0_lower: Optional [batch_size, *shape, 1] lower bound of t0 when intersecting this volume. :param params: Optional meta parameters in case Volume is parametric :param eps
(
self,
origin: torch.Tensor,
direction: torch.Tensor,
t0_lower: Optional[torch.Tensor] = None,
params: Optional[Dict] = None,
)
| 190 | self.device = device |
| 191 | |
| 192 | def intersect( |
| 193 | self, |
| 194 | origin: torch.Tensor, |
| 195 | direction: torch.Tensor, |
| 196 | t0_lower: Optional[torch.Tensor] = None, |
| 197 | params: Optional[Dict] = None, |
| 198 | ) -> VolumeRange: |
| 199 | """ |
| 200 | :param origin: [batch_size, *shape, 3] |
| 201 | :param direction: [batch_size, *shape, 3] |
| 202 | :param t0_lower: Optional [batch_size, *shape, 1] lower bound of t0 when intersecting this volume. |
| 203 | :param params: Optional meta parameters in case Volume is parametric |
| 204 | :param epsilon: to stabilize calculations |
| 205 | |
| 206 | :return: A tuple of (t0, t1, intersected) where each has a shape |
| 207 | [batch_size, *shape, 1]. If a ray intersects with the volume, `o + td` is |
| 208 | in the volume for all t in [t0, t1]. If the volume is bounded, t1 is guaranteed |
| 209 | to be on the boundary of the volume. |
| 210 | """ |
| 211 | |
| 212 | batch_size, *shape, _ = origin.shape |
| 213 | t0 = torch.zeros(batch_size, *shape, 1, dtype=origin.dtype, device=origin.device) |
| 214 | if t0_lower is not None: |
| 215 | t0 = torch.maximum(t0, t0_lower) |
| 216 | t1 = t0 + self.max_dist |
| 217 | t0 = t0.clamp(self.min_dist) |
| 218 | return VolumeRange(t0=t0, t1=t1, intersected=t0 + self.min_t_range < t1) |
| 219 | |
| 220 | |
| 221 | class SphericalVolume(MetaModule, Volume): |
nothing calls this directly
no test coverage detected