Align `points_src` to `points_tgt` with respect to a Z-axis shift. ### Parameters: - `points_src: torch.Tensor` of shape (..., N, 3) - `points_tgt: torch.Tensor` of shape (..., N, 3) - `weights: torch.Tensor` of shape (..., N) ### Returns: - `scale: torch.Tensor` of s
(points_src: torch.Tensor, points_tgt: torch.Tensor, weight: Optional[torch.Tensor], trunc: Optional[Union[float, torch.Tensor]] = None, max_iters: int = 30, eps: float = 1e-6)
| 377 | |
| 378 | |
| 379 | def align_points_xyz_shift(points_src: torch.Tensor, points_tgt: torch.Tensor, weight: Optional[torch.Tensor], trunc: Optional[Union[float, torch.Tensor]] = None, max_iters: int = 30, eps: float = 1e-6): |
| 380 | """ |
| 381 | Align `points_src` to `points_tgt` with respect to a Z-axis shift. |
| 382 | |
| 383 | ### Parameters: |
| 384 | - `points_src: torch.Tensor` of shape (..., N, 3) |
| 385 | - `points_tgt: torch.Tensor` of shape (..., N, 3) |
| 386 | - `weights: torch.Tensor` of shape (..., N) |
| 387 | |
| 388 | ### Returns: |
| 389 | - `scale: torch.Tensor` of shape (...). |
| 390 | - `shift: torch.Tensor` of shape (..., 3) |
| 391 | """ |
| 392 | dtype, device = points_src.dtype, points_src.device |
| 393 | |
| 394 | shift, _, _ = align(torch.ones_like(points_src).swapaxes(-2, -1), (points_tgt - points_src).swapaxes(-2, -1), weight[..., None, :], trunc) |
| 395 | |
| 396 | return shift |
| 397 | |
| 398 | |
| 399 | def align_affine_lstsq(x: torch.Tensor, y: torch.Tensor, w: torch.Tensor = None) -> Tuple[torch.Tensor, torch.Tensor]: |