import{quatdot,quatfromanglex,quatfromangley,quatfromanglez,quatfromaxisangle,quatfromunitvecs,quatidentity,quatinvert,quatlerp,quatmul,quatnorm,quatslerp,quatvec3rotate}from"../../wasm/index.js";import{ManagedFloat64Array}from"./memory.js";export class Quat extends ManagedFloat64Array{static identity(){return new Quat(quatidentity())}static fromUnitVecs(from,to){return new Quat(quatfromunitvecs(from.byteOffset,to.byteOffset))}static fromAxisAngle(axis,angle){return new Quat(quatfromaxisangle(axis.byteOffset,angle))}static fromAngleX(angle){return new Quat(quatfromanglex(angle))}static fromAngleY(angle){return new Quat(quatfromangley(angle))}static fromAngleZ(angle){return new Quat(quatfromanglez(angle))}constructor(ptr){super(ptr)}get length(){return 4}mul(rhs){quatmul(this.byteOffset,this.byteOffset,rhs.byteOffset);return this}rotate(v){quatvec3rotate(v.byteOffset,this.byteOffset,v.byteOffset);return v}dot(rhs){return quatdot(this.byteOffset,rhs.byteOffset)}lerp(rhs,t){quatlerp(this.byteOffset,this.byteOffset,rhs.byteOffset,t);return this}slerp(rhs,t){quatslerp(this.byteOffset,this.byteOffset,rhs.byteOffset,t);return this}normalize(){return!!quatnorm(this.byteOffset,this.byteOffset)}invert(){return!!quatinvert(this.byteOffset,this.byteOffset)}} //# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJuYW1lcyI6WyJxdWF0ZG90IiwicXVhdGZyb21hbmdsZXgiLCJxdWF0ZnJvbWFuZ2xleSIsInF1YXRmcm9tYW5nbGV6IiwicXVhdGZyb21heGlzYW5nbGUiLCJxdWF0ZnJvbXVuaXR2ZWNzIiwicXVhdGlkZW50aXR5IiwicXVhdGludmVydCIsInF1YXRsZXJwIiwicXVhdG11bCIsInF1YXRub3JtIiwicXVhdHNsZXJwIiwicXVhdHZlYzNyb3RhdGUiLCJNYW5hZ2VkRmxvYXQ2NEFycmF5IiwiUXVhdCIsImlkZW50aXR5IiwiZnJvbVVuaXRWZWNzIiwiZnJvbSIsInRvIiwiYnl0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