query the texture map at locations uv Args: uv: (*, 2) u is in the x/width direction, v is in the y/height direction, Returns: (*, dim)
(self, uv: np.ndarray)
| 40 | # image grid defined on 0..h-1 |
| 41 | |
| 42 | def __call__(self, uv: np.ndarray): |
| 43 | """ |
| 44 | query the texture map at locations uv |
| 45 | Args: |
| 46 | uv: (*, 2) u is in the x/width direction, v is in the y/height direction, |
| 47 | |
| 48 | Returns: |
| 49 | (*, dim) |
| 50 | """ |
| 51 | if isinstance(uv, (list, tuple)): |
| 52 | uv = np.array(uv) |
| 53 | |
| 54 | # in case want to tile the texture map |
| 55 | uv = np.mod(uv, 1) |
| 56 | |
| 57 | # convert uv to yx |
| 58 | y = uv[..., 1:2] * self.texture_height - 0.5 # (*, 1) |
| 59 | x = uv[..., 0:1] * self.texture_width - 0.5 # (*, 1) |
| 60 | yx = np.concatenate((y, x), axis=-1) |
| 61 | return self.interpolator(yx) |
nothing calls this directly
no outgoing calls
no test coverage detected