Function in prelude::math auto-imported

cross

fn cross<V>(V a, V b) -> V
Source: compiler/src/builtin_docs/prelude/math.hy

Returns the cross product of two 3-element vectors.

a and b are both 3-tuples or both [T; 3] arrays of the same numeric element type; the result has the same shape.

Parameters#

NameType
aV
bV

Returns#

V

Examples#

use tests::assert;
assert!(cross((1, 0, 0), (0, 1, 0)) == (0, 0, 1));
let z = cross([0.0, 1.0, 0.0], [0.0, 0.0, 1.0]);
assert!(z[0] == 1.0);

See also#

  • sin: Returns the sine of x (in radians).
  • cos: Returns the cosine of x (in radians).
  • tan: Returns the tangent of x (in radians).
  • sqrt: Returns the square root of x.
  • floor: Returns the largest whole number less than or equal to x, as a float.
  • ceil: Returns the smallest whole number greater than or equal to x, as a float.
  • exp: Returns e raised to the power x.
  • ln: Returns the natural logarithm of x.
↑ ↓ navigate ↵ open