zRotate method
dynamic
zRotate(
- dynamic point,
- dynamic angle
- Rotate camera around its direction axis passing by a given point by a given angle
- @param {Vector3} point The point where the rotation axis is passing trough
- @param {Number} angle Angle in radians
- @returns The computed transormation matix
- @param {Vector3} point The point where the rotation axis is passing trough
Implementation
zRotate(point, angle) {
this._rotationMatrix.makeRotationAxis(this._rotationAxis, angle);
this._translationMatrix.makeTranslation(-point.x, -point.y, -point.z);
this._m4_1.makeTranslation(point.x, point.y, point.z);
this._m4_1.multiply(this._rotationMatrix);
this._m4_1.multiply(this._translationMatrix);
this
._v3_1
.setFromMatrixPosition(this._gizmoMatrixState)
.sub(point); //vector from rotation center to gizmos position
this
._v3_2
.copy(this._v3_1)
.applyAxisAngle(this._rotationAxis, angle); //apply rotation
this._v3_2.sub(this._v3_1);
this._m4_2.makeTranslation(this._v3_2.x, this._v3_2.y, this._v3_2.z);
this.setTransformationMatrices(this._m4_1, this._m4_2);
return _transformation;
}