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#
| Name | Type |
|---|---|
a | V |
b | V |
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 ofx(in radians).cos: Returns the cosine ofx(in radians).tan: Returns the tangent ofx(in radians).sqrt: Returns the square root ofx.floor: Returns the largest whole number less than or equal tox, as afloat.ceil: Returns the smallest whole number greater than or equal tox, as afloat.exp: Returnseraised to the powerx.ln: Returns the natural logarithm ofx.