MCPcopy Create free account
hub / github.com/InternRobotics/G2VLM / interpolate

Function interpolate

eval_code/recons/models/moge/utils3d/numpy/utils.py:304–318  ·  view source on GitHub ↗

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)

Source from the content-addressed store, hash-verified

302
303
304def 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
321def image_scrcoord(

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected