Minimal operations for multidimensional vectors
This module assumes that a vector is an array of numbers, allowing these functions to be used on vectors of all dimensions.
npm install vctr
const { add, subtract, ... } = require('vctr')
Returns the sum of the two provided vectors.
Returns the difference between the two provided vectors.
Returns the product of the two provided vectors. The second argument may be a scalar quantity (a Number
) if desired.
Returns the quotient of the two provided vectors. The second argument may be a scalar quantity (a Number
) if desired.
Determines the dot product of the two provided vectors.
Converts vector
from Cartesian coordinates to spherical coordinates { direction, magnitude }
.
Converts vector
from spherical coordinates to Cartesian coordinates.
Calculates the direction in which vector
is pointing, in radians.
Calculates the distance covered by vector
.
Converts vector
to a unit vector.
Determines the distance (a scalar quantity) between the two provided vectors.
semibran/radians
- convert between radians and degrees