//>>built
define("dojox/math/curves",["dojo","dojox"],function(p,m){p.getObject("math.curves",!0,m);p.mixin(m.math.curves,{Line:function(f,d){this.start=f;this.end=d;this.dimensions=f.length;for(var c=0;c<f.length;c++)f[c]=Number(f[c]);for(c=0;c<d.length;c++)d[c]=Number(d[c]);this.getValue=function(g){for(var e=Array(this.dimensions),a=0;a<this.dimensions;a++)e[a]=(this.end[a]-this.start[a])*g+this.start[a];return e};return this},Bezier:function(f){this.getValue=function(d){if(1<=d)return this.p[this.p.length-
1];if(0>=d)return this.p[0];for(var c=Array(this.p[0].length),g=0;e<this.p[0].length;g++)c[g]=0;for(var e=0;e<this.p[0].length;e++){for(var a=g=0,b=0;b<this.p.length;b++)g+=this.p[b][e]*this.p[this.p.length-1][0]*m.math.bernstein(d,this.p.length,b);for(b=0;b<this.p.length;b++)a+=this.p[this.p.length-1][0]*m.math.bernstein(d,this.p.length,b);c[e]=g/a}return c};this.p=f;return this},CatmullRom:function(f,d){this.getValue=function(c){var g=c*(this.p.length-1);c=Math.floor(g);g-=c;var e=c-1;0>e&&(e=0);
var a=c+1;a>=this.p.length&&(a=this.p.length-1);var b=c+2;b>=this.p.length&&(b=this.p.length-1);for(var h=g*g,l=g*g*g,n=Array(this.p[0].length),k=0;k<this.p[0].length;k++)n[k]=(-this.c*this.p[e][k]+(2-this.c)*this.p[c][k]+(this.c-2)*this.p[a][k]+this.c*this.p[b][k])*l+(2*this.c*this.p[e][k]+(this.c-3)*this.p[c][k]+(3-2*this.c)*this.p[a][k]+-this.c*this.p[b][k])*h+(-this.c*this.p[e][k]+this.c*this.p[a][k])*g+this.p[c][k];return n};this.c=d?d:.7;this.p=f;return this},Arc:function(f,d,c){d=m.math.midpoint(f,
d);f=function(a,b){for(var h=Array(a.length),l=0;l<a.length;l++)h[l]=a[l]+b[l];return h}(function(a){for(var b=Array(a.length),h=0;h<a.length;h++)b[h]=-a[h];return b}(d),f);var g=Math.sqrt(Math.pow(f[0],2)+Math.pow(f[1],2)),e=m.math.radiansToDegrees(Math.atan(f[1]/f[0]));e=0>f[0]?e-90:e+90;m.math.curves.CenteredArc.call(this,d,g,e,e+(c?-180:180))},CenteredArc:function(f,d,c,g){this.center=f;this.radius=d;this.start=c||0;this.end=g;this.getValue=function(e){var a=Array(2);e=m.math.degreesToRadians(this.start+
(this.end-this.start)*e);a[0]=this.center[0]+this.radius*Math.sin(e);a[1]=this.center[1]-this.radius*Math.cos(e);return a};return this},Circle:function(f,d){m.math.curves.CenteredArc.call(this,f,d,0,360);return this},Path:function(){function f(){for(var a=0,b=0;b<c.length;b++){var h=a+c[b]/e;g[b]=[a,h,h-a];a=h}}var d=[],c=[],g=[],e=0;this.add=function(a,b){d.push(a);c.push(b);e+=b;f()};this.remove=function(a){for(var b=0;b<d.length;b++)if(d[b]==a){d.splice(b,1);e-=c.splice(b,1)[0];break}f()};this.removeAll=
function(){d=[];c=[];e=0};this.getValue=function(a){for(var b=!1,h=0,l=0;l<g.length;l++){var n=g[l];if(a>=n[0]&&a<n[1]){h=d[l].getValue((a-n[0])/n[2]);b=!0;break}}b||(h=d[d.length-1].getValue(1));for(a=0;a<l;a++)h=m.math.points.translate(h,d[a].getValue(1));return h};return this}});return m.math.curves});