Interpolate with given barycentric coordinates and triangle indices Args: bary (np.ndarray): shape (..., 3), barycentric coordinates tri_id (np.ndarray): int array of shape (...), triangle indices attr (np.ndarray): shape (N, M), vertices attributes faces (np.nda
(bary: np.ndarray, tri_id: np.ndarray, attr: np.ndarray, faces: np.ndarray)
| 302 | |
| 303 | |
| 304 | def interpolate(bary: np.ndarray, tri_id: np.ndarray, attr: np.ndarray, faces: np.ndarray) -> np.ndarray: |
| 305 | """Interpolate with given barycentric coordinates and triangle indices |
| 306 | |
| 307 | Args: |
| 308 | bary (np.ndarray): shape (..., 3), barycentric coordinates |
| 309 | tri_id (np.ndarray): int array of shape (...), triangle indices |
| 310 | attr (np.ndarray): shape (N, M), vertices attributes |
| 311 | faces (np.ndarray): int array of shape (T, 3), face vertex indices |
| 312 | |
| 313 | Returns: |
| 314 | np.ndarray: shape (..., M) interpolated result |
| 315 | """ |
| 316 | faces_ = np.concatenate([np.zeros((1, 3), dtype=faces.dtype), faces + 1], axis=0) |
| 317 | attr_ = np.concatenate([np.zeros((1, attr.shape[1]), dtype=attr.dtype), attr], axis=0) |
| 318 | return np.sum(bary[..., None] * attr_[faces_[tri_id + 1]], axis=-2) |
| 319 | |
| 320 | |
| 321 | def image_scrcoord( |
nothing calls this directly
no outgoing calls
no test coverage detected