rotateAboutPoint static method
dynamic
rotateAboutPoint(
- dynamic obj,
- dynamic point,
- dynamic axis,
- dynamic theta, {
- bool pointIsWorld = false,
Implementation
static rotateAboutPoint(obj, point, axis, theta, {bool pointIsWorld = false}) {
if (pointIsWorld) {
obj.parent.localToWorld(obj.position); // compensate for world coordinate
}
obj.position.sub(point); // remove the offset
obj.position.applyAxisAngle(axis, theta); // rotate the POSITION
obj.position.add(point); // re-add the offset
if (pointIsWorld) {
obj.parent.worldToLocal(obj.position); // undo world coordinates compensation
}
obj.rotateOnAxis(axis, theta); // rotate the OBJECT
}