dflSample

taichi_glsl.sampling.dflSample(field: <taichi.lang.kernel_arguments.Template object at 0x7f9dc1a06c10>, P, dfl)

Sampling a field, when indices out of the field shape, return the given default value.

Parameters
  • field – (Tensor) Specify the field to sample.

  • P – (Vector) Specify the index in field.

  • dfl – (with the same type of field) Specify the index in field.

Returns

The return value is calcuated as:

return field[int(P)] if 0 <= P < vec(*field.shape) else dfl