export function Vector(t=0,e=0,r=0){const o="object"==typeof t?t:{x:t,y:e,z:r},n={add:t=>{let e={x:o.x+t.x,y:o.y+t.y,z:o.z+t.z};return Vector(e.x,e.y,e.z)},mul:t=>"number"==typeof t?Vector(o.x*t,o.y*t,o.z*t):"object"==typeof t?Vector(o.x*t.x,o.y*t.y,o.z*t.z):void 0,distance:t=>Math.sqrt(Math.pow(t.x-o.x,2)+Math.pow(t.y-o.y,2)+Math.pow(t.z-o.z,2)),len:Math.sqrt(o.x*o.x+o.y*o.y+o.z*o.z),dot:t=>o.x*t.x+o.y*t.y+o.z*t.z,normalized:()=>{n.len;return{x:o.x/length,y:o.y/length,z:o.z/length}},direction:t=>{Vector(t).len;return Vector(t.x-o.x,t.y-o.y,t.z-o.z).normalized()},x:t,y:e,z:r};return n}export function clamp(t,e,r){return Math.min(Math.max(t,e),r)}export function VectorDirection(t,e){return Vector(e.x-t.x,e.y-t.y,e.z-t.z).normalized()}