boundReflect

taichi_glsl.lagrangian.boundReflect(pos, vel, pmin=0, pmax=1, gamma=1, gamma_perpendicular=1)

Reflect particle velocity from a rectangular boundary (if collides).

boundaryReflect takes particle position, velocity and other parameters. Detect if the particle collides with the rect boundary given by pmin and pmax, if collide, returns the velocity after bounced with boundary, otherwise return the original velocity without any change.

Parameters
  • pos – (Vector) The particle position.

  • vel – (Vector) The particle velocity.

  • pmin – (scalar or Vector) The position lower boundary. If vector, it’s the bottom-left of rect.

  • pmin – (scalar or Vector) The position upper boundary. If vector, it’s the top-right of rect.