From 7f13632f9eb07e45033e9860c099085288d71c6d Mon Sep 17 00:00:00 2001 From: Jim Riecken Date: Sun, 8 Dec 2013 17:49:45 -0800 Subject: [PATCH] Add minified version of 0.2 --- SAT.min.js | 12 ++++++++++++ 1 file changed, 12 insertions(+) create mode 100644 SAT.min.js diff --git a/SAT.min.js b/SAT.min.js new file mode 100644 index 0000000..3d3b7a3 --- /dev/null +++ b/SAT.min.js @@ -0,0 +1,12 @@ +/*! SAT.js - Version 0.2 - Copyright 2013 - Jim Riecken - released under the MIT License. https://github.com/jriecken/sat-js */ +function v(){function c(b,d){this.x=b||0;this.y=d||0}function m(b,d){this.pos=b||new c;this.points=d||[];this.recalc()}function y(b,d,a){this.pos=b||new c;this.w=d||0;this.h=a||0}function w(){this.b=this.a=null;this.overlapN=new c;this.overlapV=new c;this.clear()}function z(b,d,a){for(var k=Number.MAX_VALUE,c=-Number.MAX_VALUE,h=b.length,e=0;ec&&(c=f)}a[0]=k;a[1]=c}function A(b,d,a,k,c,h){var l=q.pop(),f=q.pop();b=e.pop().copy(d).sub(b);d=b.c(c);z(a,c,l);z(k,c, +f);f[0]+=d;f[1]+=d;if(l[0]>f[1]||f[0]>l[1])return e.push(b),q.push(l),q.push(f),!0;h&&(a=0,l[0]f[1]?(a=l[0]-f[1],h.aInB=!1):(a=l[1]-f[0],k=f[1]-l[0],a=aa&&h.overlapN.reverse()));e.push(b);q.push(l);q.push(f);return!1}function x(b,d){var a=b.d(),c=d.c(b);return 0>c?-1:c>a?1:0}function B(b,d,a){for(var c=e.pop().copy(d.pos).sub(b.pos), +t=d.r,h=t*t,l=b.points,f=l.length,g=e.pop(),p=e.pop(),m=0;mh&&(a.aInB=!1);var n=x(g,p);if(-1===n){g.copy(b.edges[q]);s=e.pop().copy(c).sub(l[q]);n=x(g,s);if(1===n){n=p.e();if(n>t)return e.push(c),e.push(g),e.push(p),e.push(s),!1;a&&(a.bInA=!1,r=p.normalize(),u=t-n)}e.push(s)}else if(1===n){if(g.copy(b.edges[s]),p.copy(c).sub(l[s]),n=x(g,p),-1===n){n=p.e();if(n>t)return e.push(c),e.push(g),e.push(p), +!1;a&&(a.bInA=!1,r=p.normalize(),u=t-n)}}else{s=g.f().normalize();n=p.c(s);q=Math.abs(n);if(0t)return e.push(c),e.push(s),e.push(p),!1;a&&(r=s,u=t-n,0<=n||u<2*t)&&(a.bInA=!1)}r&&a&&Math.abs(u)r;r++)e.push(new c);for(var q=[],r=0;5>r;r++)q.push([]);g.testCircleCircle=function(b,c,a){var k=e.pop().copy(c.pos).sub(b.pos),g=b.r+c.r,h=k.d();if(h>g*g)return e.push(k),!1;a&&(h=Math.sqrt(h),a.a=b,a.b=c,a.overlap=g-h,a.overlapN.copy(k.normalize()),a.overlapV.copy(k).scale(a.overlap),a.aInB=b.r<=c.r&&h<= +c.r-b.r,a.bInA=c.r<=b.r&&h<=b.r-c.r);e.push(k);return!0};g.testPolygonCircle=B;g.testCirclePolygon=function(b,c,a){if((b=B(c,b,a))&&a){c=a.a;var e=a.aInB;a.overlapN.reverse();a.overlapV.reverse();a.a=a.b;a.b=c;a.aInB=a.bInA;a.bInA=e}return b};g.testPolygonPolygon=function(b,c,a){for(var e=b.points,g=e.length,h=c.points,l=h.length,f=0;f