sample¶
-
taichi_glsl.sampling.
sample
(field: <taichi.lang.kernel_arguments.Template object at 0x7f9dc1a06bb0>, P)¶ Sampling a field with indices clampped into the field shape.
- Parameters
field – (Tensor) Specify the field to sample.
P – (Vector) Specify the index in field.
- Returns
The return value is calcuated as:
P = clamp(P, 0, vec(*field.shape) - 1) return field[int(P)]