meta data for this page
  •  

This is an old revision of the document!


Rotate

Shapes can be rotated by any given angle about the X, Y, and Z axis. The angles can be specified as either positive or negative values, in RADIANS.

Learn about rotation at MathIsFun.com

Defaults:

  • angles : [0, 0, 0]
let myshape = cuboid({size: [5, 20, 5]})
let newshape = rotate([(Math.PI * 2 / 4), (Math.PI * 2 / 24), (Math.PI * 2 / 12)], myshape)

In addition, there are simple versions of the same function for rotating about a single axis.

let myshape = cuboid({size: [5, 20, 5]})
let newshape = rotateX((Math.PI * 2 / 4), myshape)
newshape = rotateY((Math.PI * 2 / 24), newshape)
newshape = rotateZ((Math.PI * 2 / 12), newshape)

There is a math function to convert DEGREE to RADIAN values.

let newshape = rotate([degreeToRad(90), degreeToRad(15), degreeToRad(30)], myshape)
let newshape = rotateX(degreeToRad(90), myshape)