mathjs
Version:
Math.js is an extensive math library for JavaScript and Node.js. It features a flexible expression parser with support for symbolic computation, comes with a large set of built-in functions and constants, and offers an integrated solution to work with dif
48 lines (30 loc) • 1.31 kB
Markdown
<!-- Note: This file is automatically generated from source code comments. Changes made in this file will be overridden. -->
Rotate a vector of size 1x2 counter-clockwise by a given angle
Rotate a vector of size 1x3 counter-clockwise by a given angle around the given axis
```js
math.rotate(w, theta)
math.rotate(w, theta, v)
```
Parameter | Type | Description
--------- | ---- | -----------
`w` | Array &
`theta` | number &
`v` | Array &
Type | Description
---- | -----------
Array &
```js
math.rotate([11, 12], math.pi / 2) // returns matrix([-12, 11])
math.rotate(matrix([11, 12]), math.pi / 2) // returns matrix([-12, 11])
math.rotate([1, 0, 0], unit('90deg'), [0, 0, 1]) // returns matrix([0, 1, 0])
math.rotate(matrix([1, 0, 0]), unit('90deg'), [0, 0, 1]) // returns matrix([0, 1, 0])
math.rotate([1, 0], math.complex(1 + i)) // returns matrix([cos(1 + i) - sin(1 + i), sin(1 + i) + cos(1 + i)])
```
[ ](matrix.md),
[ ](rotationMatrix.md)