sign

taichi_glsl.scalar.sign(x, edge=0)

Extract the sign of the parameter.

sign returns -1.0 if x is less than edge, 0.0 if x is equal to edge, and +1.0 if x is greater than edge.

Parameters
  • x – Specify the value from which to extract the sign.

  • edge – Specify a custom location of the edge instead of 0.

Note

sign(x, edge) is equivalent with sign(x - edge).

Returns

The return value is computed as (x >= edge) - (x <= edge), with type promoted.