rotate method

Map<String, Matrix4> rotate(
  1. Vector3 axis,
  2. double angle
)
  • Rotate the camera around an axis passing by trackball's center
  • axis Rotation axis
  • angle Angle in radians
  • returns Object Object with 'camera' field containing transformation matrix resulting from the operation to be applied to the camera

Implementation

Map<String, Matrix4> rotate(Vector3 axis, double angle) {
    final 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;
  }