/**
 * Minified by jsDelivr using Terser v5.39.0.
 * Original file: /npm/vec3@0.2.0/index.js
 *
 * Do NOT use SRI with dynamically generated files! More information: https://www.jsdelivr.com/using-sri-with-dynamic-files
 */
const re=/\((-?[.\d]+), (-?[.\d]+), (-?[.\d]+)\)/;class Vec3{constructor(t,s,h){this.x=t,this.y=s,this.z=h}isZero(){return 0===this.x&&0===this.y&&0===this.z}at(t){return this.toArray()[t]}xz(){return[this.x,this.z]}xy(){return[this.x,this.y]}yz(){return[this.y,this.z]}xzy(){return new Vec3(this.x,this.z,this.y)}set(t,s,h){return this.x=t,this.y=s,this.z=h,this}update(t){return this.x=t.x,this.y=t.y,this.z=t.z,this}rounded(){return new Vec3(Math.round(this.x),Math.round(this.y),Math.round(this.z))}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this}floored(){return new Vec3(Math.floor(this.x),Math.floor(this.y),Math.floor(this.z))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this}offset(t,s,h){return new Vec3(this.x+t,this.y+s,this.z+h)}translate(t,s,h){return this.x+=t,this.y+=s,this.z+=h,this}add(t){return this.x+=t.x,this.y+=t.y,this.z+=t.z,this}subtract(t){return this.x-=t.x,this.y-=t.y,this.z-=t.z,this}multiply(t){return this.x*=t.x,this.y*=t.y,this.z*=t.z,this}divide(t){return this.x/=t.x,this.y/=t.y,this.z/=t.z,this}plus(t){return this.offset(t.x,t.y,t.z)}minus(t){return this.offset(-t.x,-t.y,-t.z)}scaled(t){return new Vec3(this.x*t,this.y*t,this.z*t)}abs(){return new Vec3(Math.abs(this.x),Math.abs(this.y),Math.abs(this.z))}volume(){return this.x*this.y*this.z}modulus(t){return new Vec3(euclideanMod(this.x,t.x),euclideanMod(this.y,t.y),euclideanMod(this.z,t.z))}angleTo(t){return Math.acos(this.dot(t)/(this.norm()*t.norm()))}distanceTo(t){const s=t.x-this.x,h=t.y-this.y,i=t.z-this.z;return Math.sqrt(s*s+h*h+i*i)}distanceSquared(t){const s=t.x-this.x,h=t.y-this.y,i=t.z-this.z;return s*s+h*h+i*i}equals(t,s=0){return Math.abs(this.x-t.x)<=s&&Math.abs(this.y-t.y)<=s&&Math.abs(this.z-t.z)<=s}toString(){return"("+this.x+", "+this.y+", "+this.z+")"}clone(){return this.offset(0,0,0)}min(t){return new Vec3(Math.min(this.x,t.x),Math.min(this.y,t.y),Math.min(this.z,t.z))}max(t){return new Vec3(Math.max(this.x,t.x),Math.max(this.y,t.y),Math.max(this.z,t.z))}norm(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z)}dot(t){return this.x*t.x+this.y*t.y+this.z*t.z}cross(t){return new Vec3(this.y*t.z-this.z*t.y,this.z*t.x-this.x*t.z,this.x*t.y-this.y*t.x)}unit(){const t=this.norm();return 0===t?this.clone():this.scaled(1/t)}normalize(){const t=this.norm();return 0!==t&&(this.x/=t,this.y/=t,this.z/=t),this}scale(t){return this.x*=t,this.y*=t,this.z*=t,this}xyDistanceTo(t){const s=t.x-this.x,h=t.y-this.y;return Math.sqrt(s*s+h*h)}xzDistanceTo(t){const s=t.x-this.x,h=t.z-this.z;return Math.sqrt(s*s+h*h)}yzDistanceTo(t){const s=t.y-this.y,h=t.z-this.z;return Math.sqrt(s*s+h*h)}innerProduct(t){return this.x*t.x+this.y*t.y+this.z*t.z}manhattanDistanceTo(t){return Math.abs(t.x-this.x)+Math.abs(t.y-this.y)+Math.abs(t.z-this.z)}toArray(){return[this.x,this.y,this.z]}}function v(t,s,h){if(null==t)return new Vec3(0,0,0);if(Array.isArray(t))return new Vec3(parseFloat(t[0]),parseFloat(t[1]),parseFloat(t[2]));if("object"==typeof t)return new Vec3(parseFloat(t.x),parseFloat(t.y),parseFloat(t.z));if("string"==typeof t&&null==s){const s=t.match(re);if(s)return new Vec3(parseFloat(s[1]),parseFloat(s[2]),parseFloat(s[3]));throw new Error("vec3: cannot parse: "+t)}return new Vec3(parseFloat(t),parseFloat(s),parseFloat(h))}function euclideanMod(t,s){const h=t%s;return h<0?h+s:h}module.exports=v,v.Vec3=Vec3;
//# sourceMappingURL=/sm/c4a836b118baf3fec325afa5c55f4e9ff8dd01968d8a1edd4b75cffdf1d7234b.map