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 = this._gizmos.position; //rotation center
  this._translationMatrix.makeTranslation(-point.x, -point.y, -point.z);
  this._rotationMatrix.makeRotationAxis(axis, -angle);

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

  this.setTransformationMatrices(this._m4_1);

  return _transformation;
}