simple-squiggle

A restricted subset of Squiggle
Log | Files | Refs | README

rotate.md (1367B)


      1 <!-- Note: This file is automatically generated from source code comments. Changes made in this file will be overridden. -->
      2 
      3 # Function rotate
      4 
      5 Rotate a vector of size 1x2 counter-clockwise by a given angle
      6 Rotate a vector of size 1x3 counter-clockwise by a given angle around the given axis
      7 
      8 
      9 ## Syntax
     10 
     11 ```js
     12 math.rotate(w, theta)
     13 math.rotate(w, theta, v)
     14 ```
     15 
     16 ### Parameters
     17 
     18 Parameter | Type | Description
     19 --------- | ---- | -----------
     20 `w` | Array &#124; Matrix | Vector to rotate
     21 `theta` | number &#124; BigNumber &#124; Complex &#124; Unit | Rotation angle
     22 `v` | Array &#124; Matrix | Rotation axis
     23 
     24 ### Returns
     25 
     26 Type | Description
     27 ---- | -----------
     28 Array &#124; Matrix | Multiplication of the rotation matrix and w
     29 
     30 
     31 ### Throws
     32 
     33 Type | Description
     34 ---- | -----------
     35 
     36 
     37 ## Examples
     38 
     39 ```js
     40 math.rotate([11, 12], math.pi / 2)                           // returns matrix([-12, 11])
     41 math.rotate(matrix([11, 12]), math.pi / 2)                   // returns matrix([-12, 11])
     42 
     43 math.rotate([1, 0, 0], unit('90deg'), [0, 0, 1])             // returns matrix([0, 1, 0])
     44 math.rotate(matrix([1, 0, 0]), unit('90deg'), [0, 0, 1])     // returns matrix([0, 1, 0])
     45 
     46 math.rotate([1, 0], math.complex(1 + i))                     // returns matrix([cos(1 + i) - sin(1 + i), sin(1 + i) + cos(1 + i)])
     47 ```
     48 
     49 
     50 ## See also
     51 
     52 [matrix](matrix.md),
     53 [rotationMatrix](rotationMatrix.md)