var gdjs;(function(j){const D=()=>({collision:!1,move_axis:[0,0]}),S=()=>({collision:!1,closeX:0,closeY:0,closeSqDist:0,farX:0,farY:0,farSqDist:0}),F={minMaxA:[0,0],minMaxB:[0,0],edge:[0,0],axis:[0,0],move_axis:[0,0],result:D()},R={p:[0,0],q:[0,0],r:[0,0],s:[0,0],deltaQP:[0,0],axis:[0,0],result:S()},n=class{constructor(){this.vertices=[];this.edges=[];this.center=[0,0]}move(t,e){for(let o=0,i=this.vertices.length;o=e?this.vertices[0]:this.vertices[t+1];this.edges[t][0]=i[0]-o[0],this.edges[t][1]=i[1]-o[1]}}isConvex(){this.computeEdges();const t=this.edges.length;if(t<3)return!1;const e=this.edges[0][0]*this.edges[0+1][1]-this.edges[0][1]*this.edges[0+1][0]>0;for(let i=1;i0!==e)return!1;return this.edges[t-1][0]*this.edges[0][1]-this.edges[t-1][1]*this.edges[0][0]>0===e}computeCenter(){this.center[0]=0,this.center[1]=0;const t=this.vertices.length;for(let e=0;e0||r===0&&o)return s.collision=!1,s.move_axis[0]=0,s.move_axis[1]=0,s;const d=Math.abs(r);dA)return s;s.collision=!0,u===0&&(s.closeX=e,s.closeY=o,s.closeSqDist=0,s.farX=e,s.farY=o,s.farSqDist=0);const q=b/Math.abs(u),T=A/Math.abs(u);return s.closeX=e+q*c[0],s.closeY=o+q*c[1],s.closeSqDist=q*q*(c[0]*c[0]+c[1]*c[1]),s.farX=e+T*c[0],s.farY=o+T*c[1],s.farSqDist=T*T*(c[0]*c[0]+c[1]*c[1]),s}else if(f!==0&&0<=x&&x<=1&&0<=M&&M<=1){const r=a[0]+x*c[0],d=a[1]+x*c[1],u=(r-e)*(r-e)+(d-o)*(d-o);uo[1]&&(o[1]=i)}static distance(t,e,o,i){return to!=h[1]>o&&e<(h[0]-a[0])*(o-a[1])/(h[1]-a[1])+a[0]&&(i=!i)}return i}static copyCollisionTestResult(t,e){e.collision=t.collision,e.move_axis[0]=t.move_axis[0],e.move_axis[1]=t.move_axis[1]}static copyRaycastTestResult(t,e){e.collision=t.collision,e.closeX=t.closeX,e.closeY=t.closeY,e.closeSqDist=t.closeSqDist,e.farX=t.farX,e.farY=t.farY,e.farSqDist=t.farSqDist}};let C=n;C.makeNewCollisionTestResult=D,C.makeNewRaycastTestResult=S,j.Polygon=C})(gdjs||(gdjs={})); //# sourceMappingURL=polygon.js.map