@polygonjs/polygonjs
Version:
node-based WebGL 3D engine https://polygonjs.com
54 lines (53 loc) • 1.3 kB
JavaScript
;
import { NamedFunction2, NamedFunction3, NamedFunction4 } from "./_Base";
export class quaternionSetFromEuler extends NamedFunction2 {
static type() {
return "quaternionSetFromEuler";
}
func(euler, target) {
target.setFromEuler(euler);
return target;
}
}
export class quaternionSetFromAxisAngle extends NamedFunction3 {
static type() {
return "quaternionSetFromAxisAngle";
}
func(axis, angle, target) {
target.setFromAxisAngle(axis, angle);
return target;
}
}
export class quaternionAngleTo extends NamedFunction2 {
static type() {
return "quaternionAngleTo";
}
func(src, to) {
return src.angleTo(to);
}
}
export class quaternionSlerp extends NamedFunction4 {
static type() {
return "quaternionSlerp";
}
func(q1, q2, lerp, target) {
target.copy(q1).slerp(q2, lerp);
return target;
}
}
export class rotateWithAxisAngle extends NamedFunction4 {
static type() {
return "rotateWithAxisAngle";
}
func(vector, axis, angle, target) {
return target.copy(vector).applyAxisAngle(axis, angle);
}
}
export class rotateWithQuaternion extends NamedFunction3 {
static type() {
return "rotateWithQuaternion";
}
func(vector, quat, target) {
return target.copy(vector).applyQuaternion(quat);
}
}