rotate method

dynamic rotate(
  1. dynamic axis,
  2. dynamic angle
)

Rotate the camera around an axis passing by trackball's center @param {Vector3} axis Rotation axis @param {number} angle Angle in radians @returns {Object} Object with 'camera' field containing transformation matrix resulting from the operation to be applied to the camera

Implementation

rotate(axis, angle) {
  var point = _gizmos.position; //rotation center
  _translationMatrix.makeTranslation(-point.x, -point.y, -point.z);
  _rotationMatrix.makeRotationAxis(axis, -angle);

  //rotate camera
  _m4_1.makeTranslation(point.x, point.y, point.z);
  _m4_1.multiply(_rotationMatrix);
  _m4_1.multiply(_translationMatrix);

  setTransformationMatrices(_m4_1);

  return _transformation;
}