Compute the intersection between plane_i and ray_i. Returns: ts: (*,)
(
plane_centers: torch.Tensor, # (*, d)
plane_normals: torch.Tensor, # (*, d)
ray_origins: torch.Tensor, # (*, d)
ray_directions: torch.Tensor, # (*, d)
)
| 1893 | |
| 1894 | |
| 1895 | def plane_ray_intersection( |
| 1896 | plane_centers: torch.Tensor, # (*, d) |
| 1897 | plane_normals: torch.Tensor, # (*, d) |
| 1898 | ray_origins: torch.Tensor, # (*, d) |
| 1899 | ray_directions: torch.Tensor, # (*, d) |
| 1900 | ) -> torch.Tensor: |
| 1901 | """ |
| 1902 | Compute the intersection between plane_i and ray_i. |
| 1903 | |
| 1904 | Returns: |
| 1905 | ts: (*,) |
| 1906 | """ |
| 1907 | |
| 1908 | nt_d = (ray_directions * plane_normals).sum(dim=-1) # (*,) |
| 1909 | co = plane_centers - ray_origins # (*, d) |
| 1910 | nt_co = (plane_normals * co).sum(dim=-1) # (*,) |
| 1911 | mask = nt_d.abs() < 1.e-8 # (*,) |
| 1912 | ts = nt_co / nt_d # (if nt_d == 0 -> t = inf) |
| 1913 | ts = ts.masked_fill(mask, torch.inf) |
| 1914 | return ts # (*,) |
| 1915 | |
| 1916 | |
| 1917 | def baseline_pcd_ray_intersection( |
nothing calls this directly
no test coverage detected