Convert path line to polyline?

Hello,
anyone here know it's it's possible to convert a path into a polyline?
I need to save SVG (but polyline, not path)
Many thanks!
r.

Hi
this is not the best way to do that, but all you need to do it better is inside this stuff (i hope).
have a look at the examples at the bottom.
cheers chris
//11:28 12.03.2010
//      www.ogebab.de
//Extension for Illustrator javascript (CS+)
------OBJ---- overview----------
     Point()
          x, y
          many functions...
     Line()
          many functions...
     Bezier()
          A, B, C, D
          isLine()
          more functions...
     XpPoint()
          lDir, an, rDir | type: Point
          isCurvePoint()
     Xpath()
          pPoints |type: XpPoint
          beziers
          SetPath()
     Xitem()
          center
          setToCenter()
//---------- little HELPERS----------------------
var fmm = 72 / 25.4;
function NumSort(a, b) {
     return a - b;
fibonacci = function(n) {
     return Math.round(Math.pow((Math.sqrt(5) + 1) / 2, Math.abs(n))
               / Math.sqrt(5))
               * (n < 0 && n % 2 ? -1 : 1);
function InVal(tx) {
     var inp, pt, t, num, d;
     inp = prompt(tx, "5");
     if (inp != "" && inp != null) {
          t = inp.search(",");
          if (t >= 0) {
               inp = inp.replace(",", ".");
          t = inp.search("pt");
          if (t >= 0) {
               pt = 1;
               num = inp.slice(0, t);
          } else {
               t = inp.search("mm");
               if (t >= 0) {
                    pt = 0;
                    num = inp.slice(0, t);
               } else {
                    t = inp.search("in");
                    if (t >= 0) {
                         pt = 2;
                         num = inp.slice(0, t);
                    } else {
                         pt = 0;
                         num = inp;
               d = eval(num);
               if (pt == 0) {
                    d = d * 72.0 / 25.4
               } else {
                    if (pt == 2) {
                         d = d * 72.0
               return (d);
          return (null);
function InNum(tx, n) {
     var inp = prompt(tx, n), t = inp.search(",");
     if (t >= 0) {
          inp = inp.replace(",", ".");
     return eval(inp);
function GetSelPaths() {
     var pf = app.activeDocument.pathItems, p = new Array();
     for ( var i68 = 0; i68 < pf.length; i68++) {
          if (pf[i68].selected == true) {
               p.push(pf[i68]);
     return p;
equate = function(a, b) {
     if (b >= 0)
          return a - b;
     return a + Math.abs(b)
Array.prototype.turn1 = function() {
     var a = this.shift();
     return this.push(a);
Array.prototype.insert = function(wert, stelle) {
     var a = this.slice(0, stelle), b = this.slice(stelle);
     b.unshift(wert);
     return (a.concat(b));
//-----------------------OBJECTS---------------------------------------------------------------------------------------------------
////----------intersection section-----
//--------ignore it until you understand the rest
//--usage:       Var = new Intersection();
//--               Var.IfIntersect(bezier,bezier); > if bezier is a line(and you know that), use Line.intersect() instead
//--               returns Status and (if) Points/Vector2Ds
//--- a tangent is not a intersection! similar points are SOMETIMES a intersection! ?
//--------KevLinDev.com--------*  copyright 2002-2003, Kevin Lindsey-----
Array.prototype.foreach=function(func){for(var i=0;i<this.length;i++)func(this[i]);};
Array.prototype.map=function(func){var result=new Array();for(var i=0;i<this.length;i++)result.push(func(this[i]));return result;};
Array.prototype.min=function(){var min=this[0];for(var i=0;i<this.length;i++)if(this[i]<min)min=this[i];return min;}
Array.prototype.max=function(){var max=this[0];for(var i=0;i<this.length;i++)if(this[i]>max)max=this[i];return max;}
Polynomial.TOLERANCE=1e-6;
Polynomial.ACCURACY=6;
function Polynomial(){this.init(arguments);}
Polynomial.prototype.init=function(coefs){this.coefs=new Array();for(var i=coefs.length-1;i>=0;i--)this.coefs.push(coefs[i]);};
Polynomial.prototype.eval=function(x){var result=0;for(var i=this.coefs.length-1;i>=0;i--)result=result*x+this.coefs[i];return result;};
Polynomial.prototype.multiply=function(that){var result=new Polynomial();for(var i=0;i<=this.getDegree()+that.getDegree();i++)result.coefs.push(0);for(var i=0;i<=this.getDegree();i++)for(var j=0;j<=that.getDegree();j++)result.coefs[i+j]+=this.coefs[i]*that.coefs[j];return result;};
Polynomial.prototype.divide_scalar=function(scalar){for(var i=0;i<this.coefs.length;i++)this.coefs[i]/=scalar;};
Polynomial.prototype.simplify=function(){for(var i=this.getDegree();i>=0;i--){if(Math.abs(this.coefs[i])<=Polynomial.TOLERANCE)this.coefs.pop();else break;}};
Polynomial.prototype.bisection=function(min,max){var minValue=this.eval(min);var maxValue=this.eval(max);var result;if(Math.abs(minValue)<=Polynomial.TOLERANCE)result=min;else if(Math.abs(maxValue)<=Polynomial.TOLERANCE)result=max;else if(minValue*maxValue<=0){var tmp1=Math.log(max-min);var tmp2=Math.log(10)*Polynomial.ACCURACY;var iters=Math.ceil((tmp1+tmp2)/Math.log(2));for(var i=0;i<iters;i++){result=0.5*(min+max);var value=this.eval(result);if(Math.abs(value)<=Polynomial.TOLERANCE){break;}if(value*minValue<0){max=result;maxValue=value;}else{min=result;minValue=value;}}}return result;};
Polynomial.prototype.toString=function(){var coefs=new Array();var signs=new Array();for(var i=this.coefs.length-1;i>=0;i--){var value=this.coefs[i];if(value!=0){var sign=(value<0)?" - ":" + ";value=Math.abs(value);if(i>0)if(value==1)value="x";else value+="x";if(i>1)value+="^"+i;signs.push(sign);coefs.push(value);}}signs[0]=(signs[0]==" + ")?"":"-";var result="";for(var i=0;i<coefs.length;i++)result+=signs[i]+coefs[i];return result;};
Polynomial.prototype.getDegree=function(){return this.coefs.length-1;};
Polynomial.prototype.getDerivative=function(){var derivative=new Polynomial();for(var i=1;i<this.coefs.length;i++){derivative.coefs.push(i*this.coefs[i]);}return derivative;};
Polynomial.prototype.getRoots=function(){var result;this.simplify();switch(this.getDegree()){case 0:result=new Array();break;case 1:result=this.getLinearRoot();break;case 2:result=this.getQuadraticRoots();break;case 3:result=this.getCubicRoots();break;case 4:result=this.getQuarticRoots();break;default:result=new Array();}return result;};
Polynomial.prototype.getRootsInInterval=function(min,max){var roots=new Array();var root;if(this.getDegree()==1){root=this.bisection(min,max);if(root!=null)roots.push(root);}else{var deriv=this.getDerivative();var droots=deriv.getRootsInInterval(min,max);if(droots.length>0){root=this.bisection(min,droots[0]);if(root!=null)roots.push(root);for(var i=0;i<=droots.length-2;i++){root=this.bisection(droots[i],droots[i+1]);if(root!=null)roots.push(root);}root=this.bisection(droots[droots.length-1],max);if(root!=null)roots.push(root);}else{root=this.bisection(min,max);if(root!=null)roots.push(root);}}return roots;};
Polynomial.prototype.getLinearRoot=function(){var result=new Array();var a=this.coefs[1];if(a!=0)result.push(-this.coefs[0]/a);return result;};
Polynomial.prototype.getQuadraticRoots=function(){var results=new Array();if(this.getDegree()==2){var a=this.coefs[2];var b=this.coefs[1]/a;var c=this.coefs[0]/a;var d=b*b-4*c;if(d>0){var e=Math.sqrt(d);results.push(0.5*(-b+e));results.push(0.5*(-b-e));}else if(d==0){results.push(0.5*-b);}}return results;};
Polynomial.prototype.getCubicRoots=function(){var results=new Array();if(this.getDegree()==3){var c3=this.coefs[3];var c2=this.coefs[2]/c3;var c1=this.coefs[1]/c3;var c0=this.coefs[0]/c3;var a=(3*c1-c2*c2)/3;var b=(2*c2*c2*c2-9*c1*c2+27*c0)/27;var offset=c2/3;var discrim=b*b/4 + a*a*a/27;var halfB=b/2;if(Math.abs(discrim)<=Polynomial.TOLERANCE)disrim=0;if(discrim>0){var e=Math.sqrt(discrim);var tmp;var root;tmp=-halfB+e;if(tmp>=0)root=Math.pow(tmp,1/3);else root=-Math.pow(-tmp,1/3);tmp=-halfB-e;if(tmp>=0)root+=Math.pow(tmp,1/3);else root-=Math.pow(-tmp,1/3);results.push(root-offset);}else if(discrim<0){var distance=Math.sqrt(-a/3);var angle=Math.atan2(Math.sqrt(-discrim),-halfB)/3;var cos=Math.cos(angle);var sin=Math.sin(angle);var sqrt3=Math.sqrt(3);results.push(2*distance*cos-offset);results.push(-distance*(cos+sqrt3*sin)-offset);results.push(-distance*(cos-sqrt3*sin)-offset);}else{var tmp;if(halfB>=0)tmp=-Math.pow(halfB,1/3);else tmp=Math.pow(-halfB,1/3);results.push(2*tmp-offset);results.push(-tmp-offset);}}return results;};
Polynomial.prototype.getQuarticRoots=function(){var results=new Array();if(this.getDegree()==4){var c4=this.coefs[4];var c3=this.coefs[3]/c4;var c2=this.coefs[2]/c4;var c1=this.coefs[1]/c4;var c0=this.coefs[0]/c4;var resolveRoots=new Polynomial(1,-c2,c3*c1-4*c0,-c3*c3*c0+4*c2*c0-c1*c1).getCubicRoots();var y=resolveRoots[0];var discrim=c3*c3/4-c2+y;if(Math.abs(discrim)<=Polynomial.TOLERANCE)discrim=0;if(discrim>0){var e=Math.sqrt(discrim);var t1=3*c3*c3/4-e*e-2*c2;var t2=(4*c3*c2-8*c1-c3*c3*c3)/(4*e);var plus=t1+t2;var minus=t1-t2;if(Math.abs(plus)<=Polynomial.TOLERANCE)plus=0;if(Math.abs(minus)<=Polynomial.TOLERANCE)minus=0;if(plus>=0){var f=Math.sqrt(plus);results.push(-c3/4 + (e+f)/2);results.push(-c3/4 + (e-f)/2);}if(minus>=0){var f=Math.sqrt(minus);results.push(-c3/4 + (f-e)/2);results.push(-c3/4 - (f+e)/2);}}else if(discrim<0){}else{var t2=y*y-4*c0;if(t2>=-Polynomial.TOLERANCE){if(t2<0)t2=0;t2=2*Math.sqrt(t2);t1=3*c3*c3/4-2*c2;if(t1+t2>=Polynomial.TOLERANCE){var d=Math.sqrt(t1+t2);results.push(-c3/4 + d/2);results.push(-c3/4 - d/2);}if(t1-t2>=Polynomial.TOLERANCE){var d=Math.sqrt(t1-t2);results.push(-c3/4 + d/2);results.push(-c3/4 - d/2);}}}}return results;};
function Vector2D(x,y){if(arguments.length>0){this.init(x,y);}}
Vector2D.prototype.init=function(x,y){this.x=x;this.y=y;};
Vector2D.prototype.length=function(){return Math.sqrt(this.x*this.x+this.y*this.y);};
Vector2D.prototype.dot=function(that){return this.x*that.x+this.y*that.y;};
Vector2D.prototype.cross=function(that){return this.x*that.y-this.y*that.x;}
Vector2D.prototype.unit=function(){return this.divide(this.length());};
Vector2D.prototype.unitEquals=function(){this.divideEquals(this.length());return this;};
Vector2D.prototype.add=function(that){return new Vector2D(this.x+that.x,this.y+that.y);};
Vector2D.prototype.addEquals=function(that){this.x+=that.x;this.y+=that.y;return this;};
Vector2D.prototype.subtract=function(that){return new Vector2D(this.x-that.x,this.y-that.y);};
Vector2D.prototype.subtractEquals=function(that){this.x-=that.x;this.y-=that.y;return this;};
Vector2D.prototype.multiply=function(scalar){return new Vector2D(this.x*scalar,this.y*scalar);};
Vector2D.prototype.multiplyEquals=function(scalar){this.x*=scalar;this.y*=scalar;return this;};
Vector2D.prototype.divide=function(scalar){return new Vector2D(this.x/ scalar, this.y /scalar);};
Vector2D.prototype.divideEquals=function(scalar){this.x/=scalar;this.y/=scalar;return this;};
Vector2D.prototype.perp=function(){return new Vector2D(-this.y,this.x);};
Vector2D.fromPoints=function(p1,p2){return new Vector2D(p2.x-p1.x,p2.y-p1.y);};
Vector2D.prototype.Dot=function (d){
     var ell=app.activeDocument.pathItems.ellipse(this.y + d/2 , this.x - d/2 ,d,d);
     ell.selected=false; return ell
function Intersection(status){if(arguments.length>0){this.init(status);}}
Intersection.prototype.init=function(status){this.status=status;this.points=new Array();};
Intersection.prototype.appendPoint=function(point){this.points.push(point);};
Intersection.prototype.appendPoints=function(points){this.points=this.points.concat(points);};
//-by ogebab---Gibt zurück: IntersectionObjekt (Obj.status / Obj.points / Obj.points.t1 / Obj.points.t2)
Intersection.prototype.IfInterSect=function(seg1,seg2){
     var result;
     if(seg1.type=="bez"){
          if(seg2.type=="line"){
               result=Intersection.intersectBezier3Line(seg1,seg2);
          }else{
               result=Intersection.intersectBezier3Bezier3(seg1,seg2);
     }else{
          if(seg2.type=="bez"){
               result=Intersection.intersectBezier3Line(seg2,seg1);
          }else{
               result=Intersection.intersectLineLine(seg2,seg1);
     if(result.status=="Intersection"){
          for(var i=0;i<result.points.length ;i++){
               if(seg1.type=="line"){
                    result.points[i].t1=getTOfPointOnLine(result.points[i], seg1);
               }else{
                    result.points[i].t1=getTOfPointOnCubicCurve(result.points[i], seg1);
               if(seg2.type=="line"){
                    result.points[i].t2=getTOfPointOnLine(result.points[i], seg2);
               }else{
                    result.points[i].t2=getTOfPointOnCubicCurve(result.points[i], seg2);
     return result
//--(bez, bez)
Intersection.intersectBezier3Bezier3=function(seg1,seg2){var a,b,c,d;var c13,c12,c11,c10;var c23,c22,c21,c20;var result=new Intersection("No Intersection");a=seg1.A.multiply(-1);b=seg1.B.multiply(3);c=seg1.C.multiply(-3);d=a.add(b.add(c.add(seg1.D)));c13=new Vector2D(d.x,d.y);a=seg1.A.multiply(3);b=seg1.B.multiply(-6);c=seg1.C.multiply(3);d=a.add(b.add(c));c12=new Vector2D(d.x,d.y);a=seg1.A.multiply(-3);b=seg1.B.multiply(3);c=a.add(b);c11=new Vector2D(c.x,c.y);c10=new Vector2D(seg1.A.x,seg1.A.y);a=seg2.A.multiply(-1);b=seg2.B.multiply(3);c=seg2.C.multiply(-3);d=a.add(b.add(c.add(seg2.D)));c23=new Vector2D(d.x,d.y);a=seg2.A.multiply(3);b=seg2.B.multiply(-6);c=seg2.C.multiply(3);d=a.add(b.add(c));c22=new Vector2D(d.x,d.y);a=seg2.A.multiply(-3);b=seg2.B.multiply(3);c=a.add(b);c21=new Vector2D(c.x,c.y);c20=new Vector2D(seg2.A.x,seg2.A.y);var c10x2=c10.x*c10.x;var c10x3=c10.x*c10.x*c10.x;var c10y2=c10.y*c10.y;var c10y3=c10.y*c10.y*c10.y;var c11x2=c11.x*c11.x;var c11x3=c11.x*c11.x*c11.x;var c11y2=c11.y*c11.y;var c11y3=c11.y*c11.y*c11.y;var c12x2=c12.x*c12.x;var c12x3=c12.x*c12.x*c12.x;var c12y2=c12.y*c12.y;var c12y3=c12.y*c12.y*c12.y;var c13x2=c13.x*c13.x;var c13x3=c13.x*c13.x*c13.x;var c13y2=c13.y*c13.y;var c13y3=c13.y*c13.y*c13.y;var c20x2=c20.x*c20.x;var c20x3=c20.x*c20.x*c20.x;var c20y2=c20.y*c20.y;var c20y3=c20.y*c20.y*c20.y;var c21x2=c21.x*c21.x;var c21x3=c21.x*c21.x*c21.x;var c21y2=c21.y*c21.y;var c22x2=c22.x*c22.x;var c22x3=c22.x*c22.x*c22.x;var c22y2=c22.y*c22.y;var c23x2=c23.x*c23.x;var c23x3=c23.x*c23.x*c23.x;var c23y2=c23.y*c23.y;var c23y3=c23.y*c23.y*c23.y;var poly=new Polynomial(-c13x3*c23y3+c13y3*c23x3-3*c13.x*c13y2*c23x2*c23.y+3*c13x2*c13.y*c23.x*c23y2,-6*c13.x*c22.x*c13y2*c23.x*c23.y+6*c13x2*c13.y*c22.y*c23.x*c23.y+3*c22.x*c13y3*c23x2-3*c13x3*c22.y*c23y2-3*c13.x*c13y2*c22.y*c23x2+3*c13x2*c22.x*c13.y*c23y2,-6*c21.x*c13.x*c13y2*c23.x*c23.y-6*c13.x*c22.x*c13y2*c22.y*c23.x+6*c13x2*c22.x*c13.y*c22.y*c23.y+3*c21.x*c13y3*c23x2+3*c22x2*c13y3*c23.x+3*c21.x*c13x2*c13.y*c23y2-3*c13.x*c21.y*c13y2*c23x2-3*c13.x*c22x2*c13y2*c23.y+c13x2*c13.y*c23.x*(6*c21.y*c23.y+3*c22y2)+c13x3*(-c21.y*c23y2-2*c22y2*c23.y-c23.y*(2*c21.y*c23.y+c22y2)),c11.x*c12.y*c13.x*c13.y*c23.x*c23.y-c11.y*c12.x*c13.x*c13.y*c23.x*c23.y+6*c21.x*c22.x*c13y3*c23.x+3*c11.x*c12.x*c13.x*c13.y*c23y2+6*c10.x*c13.x*c13y2*c23.x*c23.y-3*c11.x*c12.x*c13y2*c23.x*c23.y-3*c11.y*c12.y*c13.x*c13.y*c23x2-6*c10.y*c13x2*c13.y*c23.x*c23.y-6*c20.x*c13.x*c13y2*c23.x*c23.y+3*c11.y*c12.y*c13x2*c23.x*c23.y-2*c12.x*c12y2*c13.x*c23.x*c23.y-6*c21.x*c13.x*c22.x*c13y2*c23.y-6*c21.x*c13.x*c13y2*c22.y*c23.x-6*c13.x*c21.y*c22.x*c13y2*c23.x+6*c21.x*c13x2*c13.y*c22.y*c23.y+2*c12x2*c12.y*c13.y*c23.x*c23.y+c22x3*c13y3-3*c10.x*c13y3*c23x2+3*c10.y*c13x3*c23y2+3*c20.x*c13y3*c23x2+c12y3*c13.x*c23x2-c12x3*c13.y*c23y2-3*c10.x*c13x2*c13.y*c23y2+3*c10.y*c13.x*c13y2*c23x2-2*c11.x*c12.y*c13x2*c23y2+c11.x*c12.y*c13y2*c23x2-c11.y*c12.x*c13x2*c23y2+2*c11.y*c12.x*c13y2*c23x2+3*c20.x*c13x2*c13.y*c23y2-c12.x*c12y2*c13.y*c23x2-3*c20.y*c13.x*c13y2*c23x2+c12x2*c12.y*c13.x*c23y2-3*c13.x*c22x2*c13y2*c22.y+c13x2*c13.y*c23.x*(6*c20.y*c23.y+6*c21.y*c22.y)+c13x2*c22.x*c13.y*(6*c21.y*c23.y+3*c22y2)+c13x3*(-2*c21.y*c22.y*c23.y-c20.y*c23y2-c22.y*(2*c21.y*c23.y+c22y2)-c23.y*(2*c20.y*c23.y+2*c21.y*c22.y)),6*c11.x*c12.x*c13.x*c13.y*c22.y*c23.y+c11.x*c12.y*c13.x*c22.x*c13.y*c23.y+c11.x*c12.y*c13.x*c13.y*c22.y*c23.x-c11.y*c12.x*c13.x*c22.x*c13.y*c23.y-c11.y*c12.x*c13.x*c13.y*c22.y*c23.x-6*c11.y*c12.y*c13.x*c22.x*c13.y*c23.x-6*c10.x*c22.x*c13y3*c23.x+6*c20.x*c22.x*c13y3*c23.x+6*c10.y*c13x3*c22.y*c23.y+2*c12y3*c13.x*c22.x*c23.x-2*c12x3*c13.y*c22.y*c23.y+6*c10.x*c13.x*c22.x*c13y2*c23.y+6*c10.x*c13.x*c13y2*c22.y*c23.x+6*c10.y*c13.x*c22.x*c13y2*c23.x-3*c11.x*c12.x*c22.x*c13y2*c23.y-3*c11.x*c12.x*c13y2*c22.y*c23.x+2*c11.x*c12.y*c22.x*c13y2*c23.x+4*c11.y*c12.x*c22.x*c13y2*c23.x-6*c10.x*c13x2*c13.y*c22.y*c23.y-6*c10.y*c13x2*c22.x*c13.y*c23.y-6*c10.y*c13x2*c13.y*c22.y*c23.x-4*c11.x*c12.y*c13x2*c22.y*c23.y-6*c20.x*c13.x*c22.x*c13y2*c23.y-6*c20.x*c13.x*c13y2*c22.y*c23.x-2*c11.y*c12.x*c13x2*c22.y*c23.y+3*c11.y*c12.y*c13x2*c22.x*c23.y+3*c11.y*c12.y*c13x2*c22.y*c23.x-2*c12.x*c12y2*c13.x*c22.x*c23.y-2*c12.x*c12y2*c13.x*c22.y*c23.x-2*c12.x*c12y2*c22.x*c13.y*c23.x-6*c20.y*c13.x*c22.x*c13y2*c23.x-6*c21.x*c13.x*c21.y*c13y2*c23.x-6*c21.x*c13.x*c22.x*c13y2*c22.y+6*c20.x*c13x2*c13.y*c22.y*c23.y+2*c12x2*c12.y*c13.x*c22.y*c23.y+2*c12x2*c12.y*c22.x*c13.y*c23.y+2*c12x2*c12.y*c13.y*c22.y*c23.x+3*c21.x*c22x2*c13y3+3*c21x2*c13y3*c23.x-3*c13.x*c21.y*c22x2*c13y2-3*c21x2*c13.x*c13y2*c23.y+c13x2*c22.x*c13.y*(6*c20.y*c23.y+6*c21.y*c22.y)+c13x2*c13.y*c23.x*(6*c20.y*c22.y+3*c21y2)+c21.x*c13x2*c13.y*(6*c21.y*c23.y+3*c22y2)+c13x3*(-2*c20.y*c22.y*c23.y-c23.y*(2*c20.y*c22.y+c21y2)-c21.y*(2*c21.y*c23.y+c22y2)-c22.y*(2*c20.y*c23.y+2*c21.y*c22.y)),c11.x*c21.x*c12.y*c13.x*c13.y*c23.y+c11.x*c12.y*c13.x*c21.y*c13.y*c23.x+c11.x*c12.y*c13.x*c22.x*c13.y*c22.y-c11.y*c12.x*c21.x*c13.x*c13.y*c23.y-c11.y*c12.x*c13.x*c21.y*c13.y*c23.x-c11.y*c12.x*c13.x*c22.x*c13.y*c22.y-6*c11.y*c21.x*c12.y*c13.x*c13.y*c23.x-6*c10.x*c21.x*c13y3*c23.x+6*c20.x*c21.x*c13y3*c23.x+2*c21.x*c12y3*c13.x*c23.x+6*c10.x*c21.x*c13.x*c13y2*c23.y+6*c10.x*c13.x*c21.y*c13y2*c23.x+6*c10.x*c13.x*c22.x*c13y2*c22.y+6*c10.y*c21.x*c13.x*c13y2*c23.x-3*c11.x*c12.x*c21.x*c13y2*c23.y-3*c11.x*c12.x*c21.y*c13y2*c23.x-3*c11.x*c12.x*c22.x*c13y2*c22.y+2*c11.x*c21.x*c12.y*c13y2*c23.x+4*c11.y*c12.x*c21.x*c13y2*c23.x-6*c10.y*c21.x*c13x2*c13.y*c23.y-6*c10.y*c13x2*c21.y*c13.y*c23.x-6*c10.y*c13x2*c22.x*c13.y*c22.y-6*c20.x*c21.x*c13.x*c13y2*c23.y-6*c20.x*c13.x*c21.y*c13y2*c23.x-6*c20.x*c13.x*c22.x*c13y2*c22.y+3*c11.y*c21.x*c12.y*c13x2*c23.y-3*c11.y*c12.y*c13.x*c22x2*c13.y+3*c11.y*c12.y*c13x2*c21.y*c23.x+3*c11.y*c12.y*c13x2*c22.x*c22.y-2*c12.x*c21.x*c12y2*c13.x*c23.y-2*c12.x*c21.x*c12y2*c13.y*c23.x-2*c12.x*c12y2*c13.x*c21.y*c23.x-2*c12.x*c12y2*c13.x*c22.x*c22.y-6*c20.y*c21.x*c13.x*c13y2*c23.x-6*c21.x*c13.x*c21.y*c22.x*c13y2+6*c20.y*c13x2*c21.y*c13.y*c23.x+2*c12x2*c21.x*c12.y*c13.y*c23.y+2*c12x2*c12.y*c21.y*c13.y*c23.x+2*c12x2*c12.y*c22.x*c13.y*c22.y-3*c10.x*c22x2*c13y3+3*c20.x*c22x2*c13y3+3*c21x2*c22.x*c13y3+c12y3*c13.x*c22x2+3*c10.y*c13.x*c22x2*c13y2+c11.x*c12.y*c22x2*c13y2+2*c11.y*c12.x*c22x2*c13y2-c12.x*c12y2*c22x2*c13.y-3*c20.y*c13.x*c22x2*c13y2-3*c21x2*c13.x*c13y2*c22.y+c12x2*c12.y*c13.x*(2*c21.y*c23.y+c22y2)+c11.x*c12.x*c13.x*c13.y*(6*c21.y*c23.y+3*c22y2)+c21.x*c13x2*c13.y*(6*c20.y*c23.y+6*c21.y*c22.y)+c12x3*c13.y*(-2*c21.y*c23.y-c22y2)+c10.y*c13x3*(6*c21.y*c23.y+3*c22y2)+c11.y*c12.x*c13x2*(-2*c21.y*c23.y-c22y2)+c11.x*c12.y*c13x2*(-4*c21.y*c23.y-2*c22y2)+c10.x*c13x2*c13.y*(-6*c21.y*c23.y-3*c22y2)+c13x2*c22.x*c13.y*(6*c20.y*c22.y+3*c21y2)+c20.x*c13x2*c13.y*(6*c21.y*c23.y+3*c22y2)+c13x3*(-2*c20.y*c21.y*c23.y-c22.y*(2*c20.y*c22.y+c21y2)-c20.y*(2*c21.y*c23.y+c22y2)-c21.y*(2*c20.y*c23.y+2*c21.y*c22.y)),-c10.x*c11.x*c12.y*c13.x*c13.y*c23.y+c10.x*c11.y*c12.x*c13.x*c13.y*c23.y+6*c10.x*c11.y*c12.y*c13.x*c13.y*c23.x-6*c10.y*c11.x*c12.x*c13.x*c13.y*c23.y-c10.y*c11.x*c12.y*c13.x*c13.y*c23.x+c10.y*c11.y*c12.x*c13.x*c13.y*c23.x+c11.x*c11.y*c12.x*c12.y*c13.x*c23.y-c11.x*c11.y*c12.x*c12.y*c13.y*c23.x+c11.x*c20.x*c12.y*c13.x*c13.y*c23.y+c11.x*c20.y*c12.y*c13.x*c13.y*c23.x+c11.x*c21.x*c12.y*c13.x*c13.y*c22.y+c11.x*c12.y*c13.x*c21.y*c22.x*c13.y-c20.x*c11.y*c12.x*c13.x*c13.y*c23.y-6*c20.x*c11.y*c12.y*c13.x*c13.y*c23.x-c11.y*c12.x*c20.y*c13.x*c13.y*c23.x-c11.y*c12.x*c21.x*c13.x*c13.y*c22.y-c11.y*c12.x*c13.x*c21.y*c22.x*c13.y-6*c11.y*c21.x*c12.y*c13.x*c22.x*c13.y-6*c10.x*c20.x*c13y3*c23.x-6*c10.x*c21.x*c22.x*c13y3-2*c10.x*c12y3*c13.x*c23.x+6*c20.x*c21.x*c22.x*c13y3+2*c20.x*c12y3*c13.x*c23.x+2*c21.x*c12y3*c13.x*c22.x+2*c10.y*c12x3*c13.y*c23.y-6*c10.x*c10.y*c13.x*c13y2*c23.x+3*c10.x*c11.x*c12.x*c13y2*c23.y-2*c10.x*c11.x*c12.y*c13y2*c23.x-4*c10.x*c11.y*c12.x*c13y2*c23.x+3*c10.y*c11.x*c12.x*c13y2*c23.x+6*c10.x*c10.y*c13x2*c13.y*c23.y+6*c10.x*c20.x*c13.x*c13y2*c23.y-3*c10.x*c11.y*c12.y*c13x2*c23.y+2*c10.x*c12.x*c12y2*c13.x*c23.y+2*c10.x*c12.x*c12y2*c13.y*c23.x+6*c10.x*c20.y*c13.x*c13y2*c23.x+6*c10.x*c21.x*c13.x*c13y2*c22.y+6*c10.x*c13.x*c21.y*c22.x*c13y2+4*c10.y*c11.x*c12.y*c13x2*c23.y+6*c10.y*c20.x*c13.x*c13y2*c23.x+2*c10.y*c11.y*c12.x*c13x2*c23.y-3*c10.y*c11.y*c12.y*c13x2*c23.x+2*c10.y*c12.x*c12y2*c13.x*c23.x+6*c10.y*c21.x*c13.x*c22.x*c13y2-3*c11.x*c20.x*c12.x*c13y2*c23.y+2*c11.x*c20.x*c12.y*c13y2*c23.x+c11.x*c11.y*c12y2*c13.x*c23.x-3*c11.x*c12.x*c20.y*c13y2*c23.x-3*c11.x*c12.x*c21.x*c13y2*c22.y-3*c11.x*c12.x*c21.y*c22.x*c13y2+2*c11.x*c21.x*c12.y*c22.x*c13y2+4*c20.x*c11.y*c12.x*c13y2*c23.x+4*c11.y*c12.x*c21.x*c22.x*c13y2-2*c10.x*c12x2*c12.y*c13.y*c23.y-6*c10.y*c20.x*c13x2*c13.y*c23.y-6*c10.y*c20.y*c13x2*c13.y*c23.x-6*c10.y*c21.x*c13x2*c13.y*c22.y-2*c10.y*c12x2*c12.y*c13.x*c23.y-2*c10.y*c12x2*c12.y*c13.y*c23.x-6*c10.y*c13x2*c21.y*c22.x*c13.y-c11.x*c11.y*c12x2*c13.y*c23.y-2*c11.x*c11y2*c13.x*c13.y*c23.x+3*c20.x*c11.y*c12.y*c13x2*c23.y-2*c20.x*c12.x*c12y2*c13.x*c23.y-2*c20.x*c12.x*c12y2*c13.y*c23.x-6*c20.x*c20.y*c13.x*c13y2*c23.x-6*c20.x*c21.x*c13.x*c13y2*c22.y-6*c20.x*c13.x*c21.y*c22.x*c13y2+3*c11.y*c20.y*c12.y*c13x2*c23.x+3*c11.y*c21.x*c12.y*c13x2*c22.y+3*c11.y*c12.y*c13x2*c21.y*c22.x-2*c12.x*c20.y*c12y2*c13.x*c23.x-2*c12.x*c21.x*c12y2*c13.x*c22.y-2*c12.x*c21.x*c12y2*c22.x*c13.y-2*c12.x*c12y2*c13.x*c21.y*c22.x-6*c20.y*c21.x*c13.x*c22.x*c13y2-c11y2*c12.x*c12.y*c13.x*c23.x+2*c20.x*c12x2*c12.y*c13.y*c23.y+6*c20.y*c13x2*c21.y*c22.x*c13.y+2*c11x2*c11.y*c13.x*c13.y*c23.y+c11x2*c12.x*c12.y*c13.y*c23.y+2*c12x2*c20.y*c12.y*c13.y*c23.x+2*c12x2*c21.x*c12.y*c13.y*c22.y+2*c12x2*c12.y*c21.y*c22.x*c13.y+c21x3*c13y3+3*c10x2*c13y3*c23.x-3*c10y2*c13x3*c23.y+3*c20x2*c13y3*c23.x+c11y3*c13x2*c23.x-c11x3*c13y2*c23.y-c11.x*c11y2*c13x2*c23.y+c11x2*c11.y*c13y2*c23.x-3*c10x2*c13.x*c13y2*c23.y+3*c10y2*c13x2*c13.y*c23.x-c11x2*c12y2*c13.x*c23.y+c11y2*c12x2*c13.y*c23.x-3*c21x2*c13.x*c21.y*c13y2-3*c20x2*c13.x*c13y2*c23.y+3*c20y2*c13x2*c13.y*c23.x+c11.x*c12.x*c13.x*c13.y*(6*c20.y*c23.y+6*c21.y*c22.y)+c12x3*c13.y*(-2*c20.y*c23.y-2*c21.y*c22.y)+c10.y*c13x3*(6*c20.y*c23.y+6*c21.y*c22.y)+c11.y*c12.x*c13x2*(-2*c20.y*c23.y-2*c21.y*c22.y)+c12x2*c12.y*c13.x*(2*c20.y*c23.y+2*c21.y*c22.y)+c11.x*c12.y*c13x2*(-4*c20.y*c23.y-4*c21.y*c22.y)+c10.x*c13x2*c13.y*(-6*c20.y*c23.y-6*c21.y*c22.y)+c20.x*c13x2*c13.y*(6*c20.y*c23.y+6*c21.y*c22.y)+c21.x*c13x2*c13.y*(6*c20.y*c22.y+3*c21y2)+c13x3*(-2*c20.y*c21.y*c22.y-c20y2*c23.y-c21.y*(2*c20.y*c22.y+c21y2)-c20.y*(2*c20.y*c23.y+2*c21.y*c22.y)),-c10.x*c11.x*c12.y*c13.x*c13.y*c22.y+c10.x*c11.y*c12.x*c13.x*c13.y*c22.y+6*c10.x*c11.y*c12.y*c13.x*c22.x*c13.y-6*c10.y*c11.x*c12.x*c13.x*c13.y*c22.y-c10.y*c11.x*c12.y*c13.x*c22.x*c13.y+c10.y*c11.y*c12.x*c13.x*c22.x*c13.y+c11.x*c11.y*c12.x*c12.y*c13.x*c22.y-c11.x*c11.y*c12.x*c12.y*c22.x*c13.y+c11.x*c20.x*c12.y*c13.x*c13.y*c22.y+c11.x*c20.y*c12.y*c13.x*c22.x*c13.y+c11.x*c21.x*c12.y*c13.x*c21.y*c13.y-c20.x*c11.y*c12.x*c13.x*c13.y*c22.y-6*c20.x*c11.y*c12.y*c13.x*c22.x*c13.y-c11.y*c12.x*c20.y*c13.x*c22.x*c13.y-c11.y*c12.x*c21.x*c13.x*c21.y*c13.y-6*c10.x*c20.x*c22.x*c13y3-2*c10.x*c12y3*c13.x*c22.x+2*c20.x*c12y3*c13.x*c22.x+2*c10.y*c12x3*c13.y*c22.y-6*c10.x*c10.y*c13.x*c22.x*c13y2+3*c10.x*c11.x*c12.x*c13y2*c22.y-2*c10.x*c11.x*c12.y*c22.x*c13y2-4*c10.x*c11.y*c12.x*c22.x*c13y2+3*c10.y*c11.x*c12.x*c22.x*c13y2+6*c10.x*c10.y*c13x2*c13.y*c22.y+6*c10.x*c20.x*c13.x*c13y2*c22.y-3*c10.x*c11.y*c12.y*c13x2*c22.y+2*c10.x*c12.x*c12y2*c13.x*c22.y+2*c10.x*c12.x*c12y2*c22.x*c13.y+6*c10.x*c20.y*c13.x*c22.x*c13y2+6*c10.x*c21.x*c13.x*c21.y*c13y2+4*c10.y*c11.x*c12.y*c13x2*c22.y+6*c10.y*c20.x*c13.x*c22.x*c13y2+2*c10.y*c11.y*c12.x*c13x2*c22.y-3*c10.y*c11.y*c12.y*c13x2*c22.x+2*c10.y*c12.x*c12y2*c13.x*c22.x-3*c11.x*c20.x*c12.x*c13y2*c22.y+2*c11.x*c20.x*c12.y*c22.x*c13y2+c11.x*c11.y*c12y2*c13.x*c22.x-3*c11.x*c12.x*c20.y*c22.x*c13y2-3*c11.x*c12.x*c21.x*c21.y*c13y2+4*c20.x*c11.y*c12.x*c22.x*c13y2-2*c10.x*c12x2*c12.y*c13.y*c22.y-6*c10.y*c20.x*c13x2*c13.y*c22.y-6*c10.y*c20.y*c13x2*c22.x*c13.y-6*c10.y*c21.x*c13x2*c21.y*c13.y-2*c10.y*c12x2*c12.y*c13.x*c22.y-2*c10.y*c12x2*c12.y*c22.x*c13.y-c11.x*c11.y*c12x2*c13.y*c22.y-2*c11.x*c11y2*c13.x*c22.x*c13.y+3*c20.x*c11.y*c12.y*c13x2*c22.y-2*c20.x*c12.x*c12y2*c13.x*c22.y-2*c20.x*c12.x*c12y2*c22.x*c13.y-6*c20.x*c20.y*c13.x*c22.x*c13y2-6*c20.x*c21.x*c13.x*c21.y*c13y2+3*c11.y*c20.y*c12.y*c13x2*c22.x+3*c11.y*c21.x*c12.y*c13x2*c21.y-2*c12.x*c20.y*c12y2*c13.x*c22.x-2*c12.x*c21.x*c12y2*c13.x*c21.y-c11y2*c12.x*c12.y*c13.x*c22.x+2*c20.x*c12x2*c12.y*c13.y*c22.y-3*c11.y*c21x2*c12.y*c13.x*c13.y+6*c20.y*c21.x*c13x2*c21.y*c13.y+2*c11x2*c11.y*c13.x*c13.y*c22.y+c11x2*c12.x*c12.y*c13.y*c22.y+2*c12x2*c20.y*c12.y*c22.x*c13.y+2*c12x2*c21.x*c12.y*c21.y*c13.y-3*c10.x*c21x2*c13y3+3*c20.x*c21x2*c13y3+3*c10x2*c22.x*c13y3-3*c10y2*c13x3*c22.y+3*c20x2*c22.x*c13y3+c21x2*c12y3*c13.x+c11y3*c13x2*c22.x-c11x3*c13y2*c22.y+3*c10.y*c21x2*c13.x*c13y2-c11.x*c11y2*c13x2*c22.y+c11.x*c21x2*c12.y*c13y2+2*c11.y*c12.x*c21x2*c13y2+c11x2*c11.y*c22.x*c13y2-c12.x*c21x2*c12y2*c13.y-3*c20.y*c21x2*c13.x*c13y2-3*c10x2*c13.x*c13y2*c22.y+3*c10y2*c13x2*c22.x*c13.y-c11x2*c12y2*c13.x*c22.y+c11y2*c12x2*c22.x*c13.y-3*c20x2*c13.x*c13y2*c22.y+3*c20y2*c13x2*c22.x*c13.y+c12x2*c12.y*c13.x*(2*c20.y*c22.y+c21y2)+c11.x*c12.x*c13.x*c13.y*(6*c20.y*c22.y+3*c21y2)+c12x3*c13.y*(-2*c20.y*c22.y-c21y2)+c10.y*c13x3*(6*c20.y*c22.y+3*c21y2)+c11.y*c12.x*c13x2*(-2*c20.y*c22.y-c21y2)+c11.x*c12.y*c13x2*(-4*c20.y*c22.y-2*c21y2)+c10.x*c13x2*c13.y*(-6*c20.y*c22.y-3*c21y2)+c20.x*c13x2*c13.y*(6*c20.y*c22.y+3*c21y2)+c13x3*(-2*c20.y*c21y2-c20y2*c22.y-c20.y*(2*c20.y*c22.y+c21y2)),-c10.x*c11.x*c12.y*c13.x*c21.y*c13.y+c10.x*c11.y*c12.x*c13.x*c21.y*c13.y+6*c10.x*c11.y*c21.x*c12.y*c13.x*c13.y-6*c10.y*c11.x*c12.x*c13.x*c21.y*c13.y-c10.y*c11.x*c21.x*c12.y*c13.x*c13.y+c10.y*c11.y*c12.x*c21.x*c13.x*c13.y-c11.x*c11.y*c12.x*c21.x*c12.y*c13.y+c11.x*c11.y*c12.x*c12.y*c13.x*c21.y+c11.x*c20.x*c12.y*c13.x*c21.y*c13.y+6*c11.x*c12.x*c20.y*c13.x*c21.y*c13.y+c11.x*c20.y*c21.x*c12.y*c13.x*c13.y-c20.x*c11.y*c12.x*c13.x*c21.y*c13.y-6*c20.x*c11.y*c21.x*c12.y*c13.x*c13.y-c11.y*c12.x*c20.y*c21.x*c13.x*c13.y-6*c10.x*c20.x*c21.x*c13y3-2*c10.x*c21.x*c12y3*c13.x+6*c10.y*c20.y*c13x3*c21.y+2*c20.x*c21.x*c12y3*c13.x+2*c10.y*c12x3*c21.y*c13.y-2*c12x3*c20.y*c21.y*c13.y-6*c10.x*c10.y*c21.x*c13.x*c13y2+3*c10.x*c11.x*c12.x*c21.y*c13y2-2*c10.x*c11.x*c21.x*c12.y*c13y2-4*c10.x*c11.y*c12.x*c21.x*c13y2+3*c10.y*c11.x*c12.x*c21.x*c13y2+6*c10.x*c10.y*c13x2*c21.y*c13.y+6*c10.x*c20.x*c13.x*c21.y*c13y2-3*c10.x*c11.y*c12.y*c13x2*c21.y+2*c10.x*c12.x*c21.x*c12y2*c13.y+2*c10.x*c12.x*c12y2*c13.x*c21.y+6*c10.x*c20.y*c21.x*c13.x*c13y2+4*c10.y*c11.x*c12.y*c13x2*c21.y+6*c10.y*c20.x*c21.x*c13.x*c13y2+2*c10.y*c11.y*c12.x*c13x2*c21.y-3*c10.y*c11.y*c21.x*c12.y*c13x2+2*c10.y*c12.x*c21.x*c12y2*c13.x-3*c11.x*c20.x*c12.x*c21.y*c13y2+2*c11.x*c20.x*c21.x*c12.y*c13y2+c11.x*c11.y*c21.x*c12y2*c13.x-3*c11.x*c12.x*c20.y*c21.x*c13y2+4*c20.x*c11.y*c12.x*c21.x*c13y2-6*c10.x*c20.y*c13x2*c21.y*c13.y-2*c10.x*c12x2*c12.y*c21.y*c13.y-6*c10.y*c20.x*c13x2*c21.y*c13.y-6*c10.y*c20.y*c21.x*c13x2*c13.y-2*c10.y*c12x2*c21.x*c12.y*c13.y-2*c10.y*c12x2*c12.y*c13.x*c21.y-c11.x*c11.y*c12x2*c21.y*c13.y-4*c11.x*c20.y*c12.y*c13x2*c21.y-2*c11.x*c11y2*c21.x*c13.x*c13.y+3*c20.x*c11.y*c12.y*c13x2*c21.y-2*c20.x*c12.x*c21.x*c12y2*c13.y-2*c20.x*c12.x*c12y2*c13.x*c21.y-6*c20.x*c20.y*c21.x*c13.x*c13y2-2*c11.y*c12.x*c20.y*c13x2*c21.y+3*c11.y*c20.y*c21.x*c12.y*c13x2-2*c12.x*c20.y*c21.x*c12y2*c13.x-c11y2*c12.x*c21.x*c12.y*c13.x+6*c20.x*c20.y*c13x2*c21.y*c13.y+2*c20.x*c12x2*c12.y*c21.y*c13.y+2*c11x2*c11.y*c13.x*c21.y*c13.y+c11x2*c12.x*c12.y*c21.y*c13.y+2*c12x2*c20.y*c21.x*c12.y*c13.y+2*c12x2*c20.y*c12.y*c13.x*c21.y+3*c10x2*c21.x*c13y3-3*c10y2*c13x3*c21.y+3*c20x2*c21.x*c13y3+c11y3*c21.x*c13x2-c11x3*c21.y*c13y2-3*c20y2*c13x3*c21.y-c11.x*c11y2*c13x2*c21.y+c11x2*c11.y*c21.x*c13y2-3*c10x2*c13.x*c21.y*c13y2+3*c10y2*c21.x*c13x2*c13.y-c11x2*c12y2*c13.x*c21.y+c11y2*c12x2*c21.x*c13.y-3*c20x2*c13.x*c21.y*c13y2+3*c20y2*c21.x*c13x2*c13.y,c10.x*c10.y*c11.x*c12.y*c13.x*c13.y-c10.x*c10.y*c11.y*c12.x*c13.x*c13.y+c10.x*c11.x*c11.y*c12.x*c12.y*c13.y-c10.y*c11.x*c11.y*c12.x*c12.y*c13.x-c10.x*c11.x*c20.y*c12.y*c13.x*c13.y+6*c10.x*c20.x*c11.y*c12.y*c13.x*c13.y+c10.x*c11.y*c12.x*c20.y*c13.x*c13.y-c10.y*c11.x*c20.x*c12.y*c13.x*c13.y-6*c10.y*c11.x*c12.x*c20.y*c13.x*c13.y+c10.y*c20.x*c11.y*c12.x*c13.x*c13.y-c11.x*c20.x*c11.y*c12.x*c12.y*c13.y+c11.x*c11.y*c12.x*c20.y*c12.y*c13.x+c11.x*c20.x*c20.y*c12.y*c13.x*c13.y-c20.x*c11.y*c12.x*c20.y*c13.x*c13.y-2*c10.x*c20.x*c12y3*c13.x+2*c10.y*c12x3*c20.y*c13.y-3*c10.x*c10.y*c11.x*c12.x*c13y2-6*c10.x*c10.y*c20.x*c13.x*c13y2+3*c10.x*c10.y*c11.y*c12.y*c13x2-2*c10.x*c10.y*c12.x*c12y2*c13.x-2*c10.x*c11.x*c20.x*c12.y*c13y2-c10.x*c11.x*c11.y*c12y2*c13.x+3*c10.x*c11.x*c12.x*c20.y*c13y2-4*c10.x*c20.x*c11.y*c12.x*c13y2+3*c10.y*c11.x*c20.x*c12.x*c13y2+6*c10.x*c10.y*c20.y*c13x2*c13.y+2*c10.x*c10.y*c12x2*c12.y*c13.y+2*c10.x*c11.x*c11y2*c13.x*c13.y+2*c10.x*c20.x*c12.x*c12y2*c13.y+6*c10.x*c20.x*c20.y*c13.x*c13y2-3*c10.x*c11.y*c20.y*c12.y*c13x2+2*c10.x*c12.x*c20.y*c12y2*c13.x+c10.x*c11y2*c12.x*c12.y*c13.x+c10.y*c11.x*c11.y*c12x2*c13.y+4*c10.y*c11.x*c20.y*c12.y*c13x2-3*c10.y*c20.x*c11.y*c12.y*c13x2+2*c10.y*c20.x*c12.x*c12y2*c13.x+2*c10.y*c11.y*c12.x*c20.y*c13x2+c11.x*c20.x*c11.y*c12y2*c13.x-3*c11.x*c20.x*c12.x*c20.y*c13y2-2*c10.x*c12x2*c20.y*c12.y*c13.y-6*c10.y*c20.x*c20.y*c13x2*c13.y-2*c10.y*c20.x*c12x2*c12.y*c13.y-2*c10.y*c11x2*c11.y*c13.x*c13.y-c10.y*c11x2*c12.x*c12.y*c13.y-2*c10.y*c12x2*c20.y*c12.y*c13.x-2*c11.x*c20.x*c11y2*c13.x*c13.y-c11.x*c11.y*c12x2*c20.y*c13.y+3*c20.x*c11.y*c20.y*c12.y*c13x2-2*c20.x*c12.x*c20.y*c12y2*c13.x-c20.x*c11y2*c12.x*c12.y*c13.x+3*c10y2*c11.x*c12.x*c13.x*c13.y+3*c11.x*c12.x*c20y2*c13.x*c13.y+2*c20.x*c12x2*c20.y*c12.y*c13.y-3*c10x2*c11.y*c12.y*c13.x*c13.y+2*c11x2*c11.y*c20.y*c13.x*c13.y+c11x2*c12.x*c20.y*c12.y*c13.y-3*c20x2*c11.y*c12.y*c13.x*c13.y-c10x3*c13y3+c10y3*c13x3+c20x3*c13y3-c20y3*c13x3-3*c10.x*c20x2*c13y3-c10.x*c11y3*c13x2+3*c10x2*c20.x*c13y3+c10.y*c11x3*c13y2+3*c10.y*c20y2*c13x3+c20.x*c11y3*c13x2+c10x2*c12y3*c13.x-3*c10y2*c20.y*c13x3-c10y2*c12x3*c13.y+c20x2*c12y3*c13.x-c11x3*c20.y*c13y2-c12x3*c20y2*c13.y-c10.x*c11x2*c11.y*c13y2+c10.y*c11.x*c11y2*c13x2-3*c10.x*c10y2*c13x2*c13.y-c10.x*c11y2*c12x2*c13.y+c10.y*c11x2*c12y2*c13.x-c11.x*c11y2*c20.y*c13x2+3*c10x2*c10.y*c13.x*c13y2+c10x2*c11.x*c12.y*c13y2+2*c10x2*c11.y*c12.x*c13y2-2*c10y2*c11.x*c12.y*c13x2-c10y2*c11.y*c12.x*c13x2+c11x2*c20.x*c11.y*c13y2-3*c10.x*c20y2*c13x2*c13.y+3*c10.y*c20x2*c13.x*c13y2+c11.x*c20x2*c12.y*c13y2-2*c11.x*c20y2*c12.y*c13x2+c20.x*c11y2*c12x2*c13.y-c11.y*c12.x*c20y2*c13x2-c10x2*c12.x*c12y2*c13.y-3*c10x2*c20.y*c13.x*c13y2+3*c10y2*c20.x*c13x2*c13.y+c10y2*c12x2*c12.y*c13.x-c11x2*c20.y*c12y2*c13.x+2*c20x2*c11.y*c12.x*c13y2+3*c20.x*c20y2*c13x2*c13.y-c20x2*c12.x*c12y2*c13.y-3*c20x2*c20.y*c13.x*c13y2+c12x2*c20y2*c12.y*c13.x);var roots=poly.getRootsInInterval(0,1);for(var i=0;i<roots.length;i++){var s=roots[i];var xRoots=new Polynomial(c13.x,c12.x,c11.x,c10.x-c20.x-s*c21.x-s*s*c22.x-s*s*s*c23.x).getRoots();var yRoots=new Polynomial(c13.y,c12.y,c11.y,c10.y-c20.y-s*c21.y-s*s*c22.y-s*s*s*c23.y).getRoots();if(xRoots.length>0&&yRoots.length>0){var TOLERANCE=1e-3;checkRoots:for(var j=0;j<xRoots.length;j++){var xRoot=xRoots[j];if(0<=xRoot&&xRoot<=1){for(var k=0;k<yRoots.length;k++){if(Math.abs(xRoot-yRoots[k])<TOLERANCE){result.points.push(c23.multiply(s*s*s).add(c22.multiply(s*s).add(c21.multiply(s).add(c20))));break checkRoots;}}}}}}if(result.points.length>0)result.status="Intersection";return result;};
//--(bez, line) erwartet trotzdem segment
Intersection.intersectBezier3Line=function(seg1,seg2){var a,b,c,d;var c3,c2,c1,c0;var cl;var n;var min=seg2.A.min(seg2.D);var max=seg2.A.max(seg2.D);var result=new Intersection("No Intersection");a=seg1.A.multiply(-1);b=seg1.B.multiply(3);c=seg1.C.multiply(-3);d=a.add(b.add(c.add(seg1.D)));c3=new Vector2D(d.x,d.y);a=seg1.A.multiply(3);b=seg1.B.multiply(-6);c=seg1.C.multiply(3);d=a.add(b.add(c));c2=new Vector2D(d.x,d.y);a=seg1.A.multiply(-3);b=seg1.B.multiply(3);c=a.add(b);c1=new Vector2D(c.x,c.y);c0=new Vector2D(seg1.A.x,seg1.A.y);n=new Vector2D(seg2.A.y-seg2.D.y,seg2.D.x-seg2.A.x);cl=seg2.A.x*seg2.D.y-seg2.D.x*seg2.A.y;roots=new Polynomial(n.dot(c3),n.dot(c2),n.dot(c1),n.dot(c0)+cl).getRoots();for(var i=0;i<roots.length;i++){var t=roots[i];if(0<=t&&t<=1){var p5=seg1.A.lerp(seg1.B,t);var p6=seg1.B.lerp(seg1.C,t);var p7=seg1.C.lerp(seg1.D,t);var p8=p5.lerp(p6,t);var p9=p6.lerp(p7,t);var pt10=p8.lerp(p9,t);if(seg2.A.x==seg2.D.x){if(min.y<=pt10.y&&pt10.y<=max.y){result.status="Intersection";result.appendPoint(pt10);}}else if(seg2.A.y==seg2.D.y){if(min.x<=pt10.x&&pt10.x<=max.x){result.status="Intersection";result.appendPoint(pt10);}}else if(pt10.gte(min)&&pt10.lte(max)){result.status="Intersection";result.appendPoint(pt10);}}}return result;};
//--(line, line) erwartet trotzdem segment
Intersection.intersectLineLine=function (seg1,seg2){var result;var ua_t=(seg2.D.x-seg2.A.x)*(seg1.A.y-seg2.A.y)-(seg2.D.y-seg2.A.y)*(seg1.A.x-seg2.A.x);var ub_t=(seg1.D.x-seg1.A.x)*(seg1.A.y-seg2.A.y)-(seg1.D.y-seg1.A.y)*(seg1.A.x-seg2.A.x);var u_b=(seg2.D.y-seg2.A.y)*(seg1.D.x-seg1.A.x)-(seg2.D.x-seg2.A.x)*(seg1.D.y-seg1.A.y);if(u_b!=0){var ua=ua_t/u_b;var ub=ub_t/u_b;if(0<=ua&&ua<=1&&0<=ub&&ub<=1){result=new Intersection("Intersection");result.points.push(new Point(seg1.A.x+ua*(seg1.D.x-seg1.A.x),seg1.A.y+ua*(seg1.D.y-seg1.A.y)));}else{result=new Intersection("No Intersection");}}else{if(ua_t==0||ub_t==0){result=new Intersection("Coincident");}else{result=new Intersection("Parallel");}}return result;};
Intersection.intersectBezier3Circle=function(p1,p2,p3,p4,c,r){return Intersection.intersectBezier3Ellipse(p1,p2,p3,p4,c,r,r);};
Intersection.intersectBezier3Ellipse=function(p1,p2,p3,p4,ec,rx,ry){var a,b,c,d;var c3,c2,c1,c0;var result=new Intersection("No Intersection");a=p1.multiply(-1);b=p2.multiply(3);c=p3.multiply(-3);d=a.add(b.add(c.add(p4)));c3=new Vector2D(d.x,d.y);a=p1.multiply(3);b=p2.multiply(-6);c=p3.multiply(3);d=a.add(b.add(c));c2=new Vector2D(d.x,d.y);a=p1.multiply(-3);b=p2.multiply(3);c=a.add(b);c1=new Vector2D(c.x,c.y);c0=new Vector2D(p1.x,p1.y);var rxrx=rx*rx;var ryry=ry*ry;var poly=new Polynomial(c3.x*c3.x*ryry+c3.y*c3.y*rxrx,2*(c3.x*c2.x*ryry+c3.y*c2.y*rxrx),2*(c3.x*c1.x*ryry+c3.y*c1.y*rxrx)+c2.x*c2.x*ryry+c2.y*c2.y*rxrx,2*c3.x*ryry*(c0.x-ec.x)+2*c3.y*rxrx*(c0.y-ec.y)+2*(c2.x*c1.x*ryry+c2.y*c1.y*rxrx),2*c2.x*ryry*(c0.x-ec.x)+2*c2.y*rxrx*(c0.y-ec.y)+c1.x*c1.x*ryry+c1.y*c1.y*rxrx,2*c1.x*ryry*(c0.x-ec.x)+2*c1.y*rxrx*(c0.y-ec.y),c0.x*c0.x*ryry-2*c0.y*ec.y*rxrx-2*c0.x*ec.x*ryry+c0.y*c0.y*rxrx+ec.x*ec.x*ryry+ec.y*ec.y*rxrx-rxrx*ryry);
var roots1=poly.getRootsInInterval(0,1);for(var i=0;i<roots1.length;i++){var t=roots1[i];result.points.push(c3.multiply(t*t*t).add(c2.multiply(t*t).add(c1.multiply(t).add(c0))));}if(result.points.length>0)result.status="Intersection";return result;};
Intersection.intersectLinePolygon=function(a1,a2,points){var result=new Intersection("No Intersection");var length=points.length;for(var i=0;i<length;i++){var b1=points[i];var b2=points[(i+1)%length];var inter=Intersection.intersectLineLine(a1,a2,b1,b2);result.appendPoints(inter.points);}if(result.points.length>0)result.status="Intersection";return result;};
Intersection.intersectPolygonPolygon=function(points1,points2){var result=new Intersection("No Intersection");var length=points1.length;for(var i=0;i<length;i++){var a1=points1[i];var a2=points1[(i+1)%length];var inter=Intersection.intersectLinePolygon(a1,a2,points2);result.appendPoints(inter.points);}if(result.points.length>0)result.status="Intersection";return result;};
//--------------by Andreas Weber-----------------------
function getTOfPointOnCubicCurve(p0, seg){return getTOfPoint.apply(this, arguments);}
function getTOfPoint(p0,seg){var p1=seg.A,p2=seg.B,p3=seg.C,p4=seg.D;var ax,bx,cx,dx,ay,by,cy,dy,xl,yl,i,j,k,len1,len2,len3,min,r,round,v;var p0x=p0.x,p0y=p0.y,p1x=p1.x,p1y=p1.y,p2x=p2.x,p2y=p2.y,p3x=p3.x,p3y=p3.y;round=10000;var p4x=p4.x,p4y=p4.y;ax=p4x-3*p3x+3*p2x-p1x;bx=3*p3x-6*p2x+3*p1x;cx=3*p2x-3*p1x;dx=p1x-p0x;ay=p4y-3*p3y+3*p2y-p1y;by=3*p3y-6*p2y+3*p1y;cy=3*p2y-3*p1y;dy=p1y-p0y;min=1/round;if(ax<min&&ax>0-min){ax=0} if(bx<min&&bx>0-min){bx=0} if(cx<min&&cx>0-min){cx=0} if(dx<min&&dx>0-min){dx=0} if(ay<min&&ay>0-min){ay=0} if(by<min&&by>0-min){by=0} if(cy<min&&cy>0-min){cy=0} if(dy<min&&dy>0-min){dy=0} xl=solveCubicPolynomial(ax,bx,cx,dx);yl=solveCubicPolynomial(ay,by,cy,dy);for(i=0,len1=xl.length;i<len1;i++){v=xl[i];if(v!='NAN'){xl[i]=Math.round(v*round)/round;}v=xl[i];if(v<0||v>1){xl.splice(i,1);len1--;i--;}}for(i=0,len1=yl.length;i<len1;i++){v=yl[i];if(v!='NAN'){yl[i]=Math.round(v*round)/round;}v=yl[i];if(v<0||v>1){yl.splice(i,1);len1--;i--;}}if(xl[0]=='NAN'){return yl;}else if(yl[0]=='NAN'){return xl;}else{r=new Array();len1=xl.length;len2=yl.length;for(i=0;i<len1;i++){for(j=0;j<len2;j++){if(xl[i]==yl[j]){for(k=0,len3;k<r.length;k++){if(r[k]==xl[i]){break;}}r.push(xl[i]);yl.splice(j,1);len2--;}}}if(r.length>0){return r;} return[-1];}}
/*by Aless Lasaruk, adapted by Andreas Weber*/
function solveCubicPolynomial(a, b, c, d) { var p, q, di, pi; if(a==0){ if(b==0){ if(c==0 && d==0){ return ['NAN']; }else if(c != 0){ return [-d/c]; } }else{ di = c*c-4*b*d; if (di < 0){ return []; }else if(di==0) { return [-c/(2*b)]; }else{ return [(-c + Math.sqrt(di))/(2*b), (-c - Math.sqrt(di))/(2*b)]; } } } p = (3*a*c - b*b)/(3*a*a); q = (2*b*b*b-9*a*b*c+27*a*a*d)/(27*a*a*a); di = q*q/4+p*p*p/27; if(di > 0){ return [crt(-q/2+Math.sqrt(di))+crt(-q/2-Math.sqrt(di))-b/(3*a)]; }else if(di==0) { return [crt(q/2)-b/(3*a), -crt(4*q)-b/(3*a)]; }else{ pi = Math.PI; return [2*Math.sqrt(-p/3)*Math.cos(1/3*Math.acos(-q/2*Math.sqrt(-27/(p*p*p))))- b/(3*a), -2*Math.sqrt(-p/3)*Math.cos(1/3*Math.acos(-q/2*Math.sqrt(-27/(p*p*p)))+ pi/3) - b/(3*a), -2*Math.sqrt(-p/3)*Math.cos(1/3*Math.acos(-q/2*Math.sqrt(-27/(p*p*p)))- pi/3) - b/(3*a) ]; } }
function crt(x){return x<0 ? -Math.pow(-x,1/3) : Math.pow(x,1/3);}
function getTOfPointOnLine(pt, seg){return seg.A.distanceFrom(pt)/seg.A.distanceFrom(seg.D);}
////----------end of intersection
// POINT OBJ
// point und line: basiert auf code: written by Kevin Lindsey
// ([email protected])
function Point(x, y) {
     this.name = "_point";
     if (arguments.length == 1) {
          this.x = x[0];
          this.y = x[1]
     if (arguments.length == 2) {
          this.x = x;
          this.y = y
     this.arr = [ this.x, this.y ];
Point.prototype.lerp = function(that, t) {
     return new Point(this.x + (that.x - this.x) * t, this.y + (that.y - this.y)
               * t);
Point.prototype.distanceFrom = function(that) {
     var dx = this.x - that.x;
     var dy = this.y - that.y;
     return Math.sqrt(dx * dx + dy * dy);
Point.prototype.angle = function(p2) {
     var w = Math.atan2(p2.y - this.y, p2.x - this.x) * 180 / Math.PI;
     if (w < 0) {
          w = w + 360
     return w;
Point.prototype.plumb = function(lp1, lp2) {
     var x = this.x, y = this.y, x0 = lp1.x, y0 = lp1.y, x1 = lp2.x, y1 = lp2.y;
     if (!(x1 - x0))
          return new Point(x0, y);
     else if (!(y1 - y0))
          return new Point(x, y0);
     var left, tg = -1 / ((y1 - y0) / (x1 - x0));
     var o = {
          x : left = (x1 * (x * tg - y + y0) + x0 * (x * -tg + y - y1))
                    / (tg * (x1 - x0) + y0 - y1),
          y : tg * left - tg * x + y
     return new Point(o.x, o.y);
Point.prototype.isInHull = function(hull) {// hull? handlungsbedarf
     // wenn hull=bezier
     if (hull.A) {
          hull.pPoints.push(hull.A);
          hull.pPoints.push(hull.B);
          hull.pPoints.push(hull.C);
          hull.pPoints.push(hull.D);
     var w = new Array();
     for ( var i1 = 0; i1 < hull.pPoints.length; i1++) {
          w[i1] = this.angle(hull.pPoints[i1])
     w.sort(NumSort);
     for ( var i = 0; i < w.length; i++) {
          if (i == 0) {
               if (w[0] + 360 - w[w.length - 1] > 180) {
                    return false
          } else {
               if (w[i] - w[i - 1] > 180) {
                    return false
     return true
Point.prototype.Dot = function(d) {
     var ell = app.activeDocument.pathItems.ellipse(this.y + d / 2, this.x - d
               / 2, d, d);
     ell.selected = false;
     return ell
Point.prototype.Line = function(pt) {
     var list = [ [ this.x, this.y ], [ pt.x, pt.y ] ], line = app.activeDocument.pathItems
               .add();
     line.setEntirePath(list);
     return line
Point.prototype.add = function(that) {
     return new Point(this.x + that.x, this.y + that.y);
Point.prototype.addEquals = function(that) {
     this.x += that.x;
     this.y += that.y;
     return this;
Point.prototype.scalarAdd = function(scalar) {
     return new Point(this.x + scalar, this.y + scalar);
Point.prototype.scalarAddEquals = function(scalar) {
     this.x += scalar;
     this.y += scalar;
     return this;
Point.prototype.subtract = function(that) {
     return new Point(this.x - that.x, this.y - that.y);
Point.prototype.subtractEquals = function(that) {
     this.x -= that.x;
     this.y -= that.y;
     return this;
Point.prototype.scalarSubtract = function(scalar) {
     return new Point(this.x - scalar, this.y - scalar);
Point.prototype.scalarSubtractEquals = function(scalar) {
     this.x -= scalar;
     this.y -= scalar;
     return this;
Point.prototype.multiply = function(scalar) {
     return new Point(this.x * scalar, this.y * scalar);
Point.prototype.multiplyEquals = function(scalar) {
     this.x *= scalar;
     this.y *= scalar;
     return this;
Point.prototype.divide = function(scalar) {
     return new Point(this.x / scalar, this.y / scalar);
Point.prototype.divideEquals = function(scalar) {
     this.x /= scalar;
     this.y /= scalar;
     return this;
Point.prototype.eq = function(that) {
     return (this.x == that.x && this.y == that.y);
Point.prototype.lt = function(that) {
     return (this.x < that.x && this.y < that.y);
Point.prototype.lte = function(that) {
     return (this.x <= that.x && this.y <= that.y);
Point.prototype.gt = function(that) {
     return (this.x > that.x && this.y > that.y);
Point.prototype.gte = function(that) {
     return (this.x >= that.x && this.y >= that.y);
Point.prototype.min = function(that) {
     return new Point(Math.min(this.x, that.x), Math.min(this.y, that.y));
Point.prototype.max = function(that) {
     return new Point(Math.max(this.x, that.x), Math.max(this.y, that.y));
Point.prototype.toString = function() {
     return this.x + "," + this.y;
Point.prototype.setXY = function(x, y) {
     this.x = x;
     this.y = y;
Point.prototype.setFromPoint = function(that) {
     this.x = that.x;
     this.y = that.y;
Point.prototype.swap = function(that) {
     var x = this.x;
     var y = this.y;
     this.x = that.x;
     this.y = that.y;
     that.x = x;
     that.y = y;
// LINE OBJ
function Line(p1, p2) {
     this.p1 = p1;
     this.p2 = p2;
     this.type = this.type()
Line.prototype.type = function() {
     if (this.p1.x == this.p2.x) {
          return "vert"
     if (this.p1.y == this.p2.y) {
          return "hori"
     return "diag"
// Steigung
Line.prototype.slope = function() {
     var p = this.p2.subtract(this.p1);
     return p.y / p.x
Line.prototype.YatX0 = function() {
     return this.p1.y - this.slope() * this.p1.x
Line.prototype.isParallel = function(that) {
     if (this.type == "diag" && that.type == "diag") {
          if (this.slope() == that.slope()) {
               return true
          return false
     if (this.type == that.type)
          return true;
     return false
Line.prototype.intersect = function(that) {
     var a = this.type, b = that.type, x, y;
     if (this.isParallel(that) == false) {
          if (a == "hori") {
               y = this.p1.y;
               if (b == "vert")
                    return new Point(that.p1.x, y);
               if (b == "diag")
                    return new Point(equate(that.YatX0(), y)
                              / equate(this.slope(), that.slope()), y)
          if (a == "vert") {
               x = this.p1.x;
               if (b == "hori")
                    return new Point(x, that.p1.y);
               if (b == "diag")
                    return new Point(x, that.slope() * x + that.YatX0())
          if (a == "diag") {
               if (b == "hori") {
                    y = that.p1.y;
                    x = equate(y, this.YatX0())
                              / equate(this.slope(), that.slope());
                    return new Point(x, y)
               if (b == "vert") {
                    x = that.p1.x;
                    y = this.slope() * x + this.YatX0();
                    return new Point(x, y)
               if (b == "diag") {
                    x = equate(that.YatX0(), this.YatX0())
                              / equate(this.slope(), that.slope());
                    y = this.slope() * x + this.YatX0();
                    return new Point(x, y)
     return "parallel"
Line.prototype.plumb = function(pt) { // lotrecht
     var x = pt.x, y = pt.y, x0 = this.p1.x, y0 = this.p1.y, x1 = this.p2.x, y1 = this.p2.y;
     if (!(x1 - x0))
          return new Point(x0, y);
     else if (!(y1 - y0))
          return new Point(x, y0);
     var left, tg = -1 / ((y1 - y0) / (x1 - x0));
     var o = {
          x : left = (x1 * (x * tg - y + y0) + x0 * (x * -tg + y - y1))
                    / (tg * (x1 - x0) + y0 - y1),
          y : tg * left - tg * x + y
     return new Point(o.x, o.y);
Line.prototype.getT = function(pt) {
     return this.p1.distanceFrom(pt) / this.p1.distanceFrom(this.p2);
Line.prototype.hasPoint = function(pt) {
     var t = this.getT(pt);
     if (t < 0 || t > 1)
          return t;
     return t
// BEZIER OBJ
function Bezier(p1, p2) {
     this.name = "_bezier";
     this.A = p1.an;
     this.B = p1.rDir;
     this.C = p2.lDir;
     this.D = p2.an;
     this.type = this.isLine()
Bezier.prototype.isLine = function() {
     var self = this;
     if (self.A.x == self.B.x && self.A.y == self.B.y && self.D.x == self.C.x
               && self.D.y == self.C.y) {
          return "line"
     return "bez"
Bezier.prototype.PointsForT = function(ti) {
     if (this.type == "bez") {
          this.BT = this.A.lerp(this.B, ti); // new B
          this.tt = this.B.lerp(this.C, ti); // ???
          this.CT = this.C.lerp(this.D, ti); // new C
          this.T1 = this.BT.lerp(this.tt, ti);// new point lDir
          this.T2 = this.tt.lerp(this.CT, ti);// new point rDir
          this.PP = this.T1.lerp(this.T2, ti);// new point an
          this.t = ti;
          this.normale = function() {
               var n = this.PP.subtract(this.T1), n2 = new Point(-n.y, n.x);
               return n2.add(this.PP);
          // tangent is T1 or T2
          if (ti <= 0.001) {
               this.tang = this.T2.angle(this.PP)
          if (ti >= 0.999) {
               this.tang = this.PP.angle(this.T1)
          if (ti > 0.001 && ti < 0.999) {
               this.tang = this.T2.angle(this.T1)
     if (this.type == "line") {
          this.PP = this.A.lerp(this.D, ti);
          // return this
     return this
Bezier.prototype.BezLength = function(tolerance) {
     var seelf = this, len1 = this.A.distanceFrom(this.D), len2 = 0, result = new Array(
               [ this.A, 0 ]);
     result.push( [ this.D, 1 ]);
     var ri = 1, s = 2, z = 0;
     romberg();
     function romberg() {
          z += 1;
          for (ri; ri < s; ri += 2) {
               var temp = seelf.PointsForT(ri / s);
               result = result.insert( [ temp.PP, temp.t ], ri);//
          s = s * 2;
          ri = 1;
          for ( var j = 0; j < result.length; j++) {
               result[0][2] = len2;
               if (result[0][1] < 1) {
                    len2 += result[0][0].distanceFrom(result[1][0]);
               result.turn1();
     while (len2 - len1 > tolerance || z < 5) { //
          len1 = len2;
          len2 = 0;
          romberg();
     return {
          bezLength : len2,
          list : result
     // return len2;
Bezier.prototype.getTonLength = function(le, tolerance) {
     try {
          var dat = this.BezLength(tolerance)
     } catch (e) {
          return "getLengthFail"
     var lDiff; // var t;
     if (dat.bezLength < le) {
          le -= 0.0001
     if (dat.bezLength < le) {
          alert("getTonLength_toShort \n  " + le + " " + dat.bezLength);
          return "toShort"
     if (dat.bezLength == le)
          return 1;
     if (le == 0)
          return 0
          // if(dat.bezLength>le){alert("getTonLength_toLong \n "+le+"
          // "+dat.bezLength);return "toLong"}
          // if(dat.bezLength==le){le=le-0.1}
     for ( var i = 0; i < dat.list.length; i++) {
          if (dat.list[i][2] > le) {
               lDiff = (dat.list[i][2] - dat.list[i - 1][2])
                         / (le - dat.list[i - 1][2]);
               // alert();
               return dat.list[i - 1][1] + dat.list[1][1] / lDiff;
// EXTENDED PATHPOINT OBJ
function XpPoint(ld, an, rd) {
     if (arguments.length < 1)
          return null;
     this.name = "_pPoint";
     if (ld.anchor) { // illustrator pathPoint
          this.lDir = new Point(ld.leftDirection);
          this.an = new Point(ld.anchor);
          this.rDir = new Point(ld.rightDirection);
          this.type = ld.pointType;
     } else if (ld.an) { // pPoint
          this.lDir = ld.lDir;
          this.an = ld.an;
          this.rDir = ld.rDir;
          this.type = ld.type;
     } else if (ld.x) { // point('s)
          if (an)
               this.an = an
          else
               this.an = ld;
          this.lDir = ld;
          if (rd)
               this.rDir = rd
          else
               this.rDir = ld;
          // this.ai.type=
// only useful for pathPoints on Beziers, not on rect or line or ....
XpPoint.prototype.isCurvePoint = function() {
     if ((Math.round((this.rDir.y - this.an.y) / (this.rDir.x - this.an.x)
               * 1000) == Math.round((this.lDir.y - this.an.y)
               / (this.lDir.x - this.an.x) * 1000))
               || (this.rDir.y == this.an.y && this.lDir.y == this.an.y)
               || (this.rDir.x == this.an.x && this.lDir.x == this.an.x)) {
          return true
     return false
// EXTENDED PATH OBJ
Xpath.prototype = new Xitem();
Xpath.prototype.constructor = Xpath ;
function Xpath(pfad) {
     Xitem.call(this, pfad);
     this.name = "_Xpath";
     this.ai = pfad;
     if (pfad.pathPoints) {
          this.pPoints = new Array();
          this.pPoints.name = "_pPoints";
          for ( var i = 0; i < pfad.pathPoints.length; i++) {
               this.pPoints.push(new XpPoint(pfad.pathPoints[i]))
     if (this.pPoints) {
          this.beziers = new Array();
          this.beziers.name = "_beziers";
          var i73 = 0, pts = this.pPoints;
          if (pfad.closed == false)
               i73++;
          for (i73; i73 < pts.length; i73++) {
               this.beziers.push(new Bezier(pts[0], pts[1]));
               pts.turn1()
          pts.turn1()
Xpath.prototype.SetPath = function() {
     var ancor = new Array(), p = this.pPoints;
     for ( var i1 = 0; i1 < p.length; i1++) {
          ancor.push( [ p[i1].an.x, p[i1].an.y ]);
     var P;
     if (this.ai.pathPoints) {
          P = this.ai.pathPoints.parent
     } else {
          P = app.activeDocument.pathItems.add()
     P.setEntirePath(ancor);
     for ( var i = 0; i < p.length; i++) {
          P.pathPoints[i].rightDirection = [ p[i].rDir.x, p[i].rDir.y ];
          P.pathPoints[i].leftDirection = [ p[i].lDir.x, p[i].lDir.y ];
          if (p[i].type) {
               P.pathPoints[i].pointType = p[i].type
// EXTENDED ITEM OBJ
function Xitem(obj) {
     if (obj) {
          this.name = "_Xitem";
          this.ai = obj;
          Xitem.prototype.center = new Point(this.ai.position[0] + this.ai.width
                    / 2, this.ai.position[1] - this.ai.height / 2);
          Xitem.prototype.bottomLeft = new Point(this.ai.position[0],
                    this.ai.position[1] - this.ai.height);
          Xitem.prototype.topRight = new Point(this.ai.position[0]
                    + this.ai.width, this.ai.position[1]);
Xitem.prototype.SetToCenter = function(point) {
     this.ai.position = [ point.x - this.ai.width / 2,
               point.y + this.ai.height / 2 ]
Xitem.prototype.SetToBottom = function(point) {
     this.ai.position = [ point.x - this.ai.width / 2, point.y + this.ai.height ]
Xitem.prototype.SetToTop = function(point) {
     this.ai.position = [ point.x - this.ai.width / 2, point.y ]
Xitem.prototype.inside = function(pt) {
     if (pt.x < this.topRight.x && pt.y < this.topRight.y) {
          if (pt.x > this.bottomLeft.x && pt.y > this.bottomLeft.y) {
               return true
     return false
// Xitem.prototype.duplicate=function (){return new Xitem(this.ai.duplicate())};
// ----------END OF
// XTENDAIJS----------------------------------------------------------
function Demo(h) {
     alert("we will take its first 4 pathpoints as points for a beziersegment");
     var pfad = new Xpath(h);
     sel[0].remove();
     var a = pfad.pPoints[1].an;
     var b = pfad.pPoints[2].an;
     var c = pfad.pPoints[3].an;
     var d = pfad.pPoints[0].an;
     var bez = new Bezier( {
          an : a,
          rDir : b
          lDir : c,
          an : d
     }) // ------ (pPoint1 , pPoint2)
     // ------{A,B,C,D} are Points ( with properties x,y)
     var p1 = bez.A.Dot(15), p2 = bez.D.Dot(15);
     redraw()
     alert("These are the anchors");
     // ---------Bezier.Point.function(size)
     var p3 = bez.B.Dot(10), p4 = bez.C.Dot(10);
     // ---------Bezier.Point.function(Point)
     var l1 = bez.A.Line(bez.B), l2 = bez.C.Line(bez.D);
     redraw()
     alert("These are the handles");
     var t03 = bez.PointsForT(0.3);
     t03.PP.Dot(10);
     redraw()
     alert("This is the Point on the Path at T=0.3...");
     bez.B.Line(bez.C);
     t03.BT.Line(t03.tt);
     t03.CT.Line(t03.tt);
     t03.T1.Line(t03.T2);
     redraw()
     alert("... and this is how it was calculated");
     bez.PointsForT(0.1).PP.Dot(10);
     bez.PointsForT(0.2).PP.Dot(10);
     bez.PointsForT(0.5).PP.Dot(10);
     bez.PointsForT(0.4).PP.Dot(10);
     bez.PointsForT(0.6).PP.Dot(10);
     bez.PointsForT(0.7).PP.Dot(10);
     bez.PointsForT(0.8).PP.Dot(10);
     bez.PointsForT(0.9).PP.Dot(10);
     redraw()
     alert("Points from T=0.1 to 0.9");
     var pa1 = new Xpath(pa.add()); //-------- normally created from existing PathItem...
     // -------...then this step is  not necessary:
     pa1.pPoints = [ new XpPoint(a, a, b), new XpPoint(c, d, d) ];
     pa1.SetPath();
     redraw()
     alert("This is the resulting Path \n try to set a point manually at pos t 0.3\n and observe how the handles change");
function Demo3(PagEitem) {
     var p = new Xpath(PagEitem);
     var pZero = new Point(0, 0);
     alert(p.center);
     p.SetToCenter(pZero);
     redraw();
     alert(p.name);
     alert(p.ai.typename);
     p.SetToCenter( {
          x : 20,
          y : 20
function Demo2() {
     var pa1 = new Xpath(sel[0]), pa2 = new Xpath(sel[1]);
     for ( var i_1 = 0; i_1 < pa1.beziers.length; i_1++) {
          for ( var i_2 = 0; i_2 < pa2.beziers.length; i_2++) {
               var inters = new Intersection().IfInterSect(pa1.beziers[i_1],
                         pa2.beziers[i_2]);
               if (inters.status == "Intersection") {
                    for ( var i_3 = 0; i_3 < inters.points.length; i_3++) {
                         // if you want to know the point...
                         inters.points[i_3].Dot(7);
                         // ...to manipulate path 1...
                         pa1.beziers[i_1].PointsForT(inters.points[i_3].t1).PP
                                   .Dot(15);
                         // ...path 2
                         pa2.beziers[i_2].PointsForT(inters.points[i_3].t2).PP
                                   .Dot(20);
function polyline(){
     for(var i =0;i<pa.length;i++){
          var polypoints=[];
          var pfad= new Xpath(pa[i]);
          for(var j =0

Similar Messages

  • Converting straight line to neat curve (arc ) in Visio 2013

    hi friends
    i am new to visio .
    i was watching a visio training video from youtube & i saw that the guy drew two straight lines & then when hover the mouse on these lines, at the middle of each line, a handle (connection point) ( if i don't mistake) was appeared & then the
    guy simply click on the handle (point) & pull it out & so created a neat curve (arc).
    but in visio 2013, when i draw two lines, i don't see any of those point on my lines so that i pull them out ( drag them) to create a neat curve.
    has this ability removed in Visio 2013?
    to clarify, i paste the screenshots from that video training:
    look at the point which i have selected them with a red line around it. where are these in visio 2013 ?
    i even selected all checkmarks in view menu , visual Aids, but again they don't appear on simple lines
    visio converting straight line to curve

    I use a inexpensive plug in to join open paths from dxf dwg files it is call Concatenate by Rick Johnson if the paths are not  connected this will do it for you.
    Then you can go to Object>Path>Simplify
    That will probably give you the result you need.

  • Can you protect a PDF document so it cannot be exploded or converted into lines in programs such as illustrator?

    We create PDF documents from our architectural programs all the time. Currently these drawings can be imported into other programs such as illustrator and exploded and ungrouped into lines. There is no option for security from this architectural program, but I need a solution to protect the PDF file so that the PDF is a flat image and cannot be exploded or converted into lines. Is there a program or setting in the Adobe programs that can do this??? thanks.

    You can set password security using Acrobat (not PDF pack), but it is of no value against a motivated thief, because some apps ignore it.
    You can rasterise in Photoshop but this is a terrible thing to do: file size explodes, quality plummets.

  • How to convert from line chart data to CSV format

    Hi ,
    I am using Flex 3 and AS.
    I am getting data from MS SQL and display the data as line
    chart this is ok.
    But i want to convert this line chart data to CSV or .xsl
    format.I find one example in fourms the from data grid to CSV
    For this URL is
    http://www.abdulqabiz.com/blog/archives/flash_and_actionscript/datagriddataexporter.php
    But i want Line chart to CSV.Please help me.

    Line chart is a just a visual representation of some data
    that's sitting in your database. Isn't it? You load this in Flex,
    probably using HTTPService class, and pass it to some chart object.
    Now when use says that she needs it in CSV format, you're
    gonna have to send another request to the server to produce the
    same data, convert into CSV or XLS format and let user download it.
    Of course, if use doesn't want to download, you don't have to
    go to the server, at least for CSV format. You can convert the same
    data that used plot the chart to convert to CSV.
    Am I missing something here?
    ATTA

  • Convert a line read from text file into string

    how to convert a line from text file into string?
    i know how to convert to numbers,
    private int  parseLine1(String line) {
              StringTokenizer tokenizer = new StringTokenizer(line);
                  value1 = Integer.valueOf(tokenizer.nextToken()).intValue();
                  value2 = Integer.valueOf(tokenizer.nextToken()).intValue();
                 return value1;
                     }but what about charactrs?

    ok, here is my problem, i have a file with a bunch of Xs in it but position function doesn't return a correct value, what's going wrong?
    private int positioni(){
           int i=0;
           int j=0;
           int b=0;
           String line="";
            while(line!= null){
                for(int a=0; a<line.length(); a++){
                    if(line.charAt(a)=='X'){
                        i=a;}
                b++;
                j=b;
                t=line.length();
                line=read(gridFileN);
           return i;
    private String read(String ggridFileN){
             TextStreamReader ggridFile = new TextStreamReader(ggridFileN);
             return ggridFile.readLine();

  • Converting separate lines of JTextArea to LinkedList Node

    I have a JTextArea where user can input text in multiple lines. When the user click a button, I would like to convert each line in the JTextArea into a node of LinkedList. For example, if the JTextArea has 5 lines of text, then the LinkedList should have 5 nodes where each node represents the string of each line.
    I do not have problem with LinkedList. The problems I'm having is I do not know what reader should I use and how validate that it is a new line.
    Here's what I have which is definately incorrect.
         public void changeTextToNode( String text )
              String text = textArea.getText();
              try
                   StringReader reader = new StringReader( text );
                   BufferedReader reader2 = new BufferedReader( reader );
                   StringBuffer strBuf = new StringBuffer();
                   while( // validate it's a new line and not end of stream )
                                   LineNode ln = new LineNode( // String of a single line );
              catch( Exception e )
              }     Any help would be greatly appreciated. Thank you.

    Yes, I would like to split on \n. How can I checkwhen it's a
    new line (\n)? Thanks for helping out.I have a couple of questions about this:
    1) When a JTextArea wraps to the next line does it
    automatically insert a newline?probably not, thats why it might be best to split on \n and also keep a char counter, and split when it becomes greater then the length of the textarea

  • Change color or thickness of Path lines

    Is there a way to change the path lines to make them more visible when I am editing them? When I use the pen tool to make a path then I go back and edit the path via the nodes sometimes depending on the colors of the photo the path disappears. Is there any way to thicken the lines or change their colors or something to make them more visible?
    Thanks for you help

    Dig wrote:
    Is there a way to change the path lines to make them more visible when I am editing them?
    No but you can do the opposite.
    Change the image by lightening it with a Levels adjustment layer, and delete it when you're done.

  • Strokes of line and polyline behave different during zooming - why?

    Hello,
    I noticed a different behaviour between the a line an a polyline during zooming. The stroke of the line will not be increased while zooming. But the stroke of the polyline will be increased while zooming. I don't understand this behaviour. Is this a feature or a bug? For a better understanding you can execute the following demo:
    import javafx.application.Application;
    import javafx.beans.value.ChangeListener;
    import javafx.beans.value.ObservableValue;
    import javafx.scene.Group;
    import javafx.scene.Node;
    import javafx.scene.Scene;
    import javafx.scene.control.Slider;
    import javafx.scene.paint.Color;
    import javafx.scene.shape.Line;
    import javafx.scene.shape.Polyline;
    import javafx.stage.Stage;
    public class ScaleDemoLinePolyline extends Application {
         public static void main(String[] args) {
              launch(args);
         @Override
         public void start(Stage stage) throws Exception {
              final Group root = new Group();
              Scene scene = new Scene(root, 800, 600, Color.WHITE);
              stage.setScene(scene);
              //create a group with line and polyline
              final Group elements = new Group();
              Line line = new Line(100, 100, 400, 100);
              Polyline polyline = new Polyline(new double[] { 100, 200, 400, 200 });
              elements.getChildren().add(line);
              elements.getChildren().add(polyline);
              root.getChildren().add(elements);
              //init the slider for zooming
              Slider scale = new Slider();
              scale.setMin(1);
              scale.setMax(50);
              scale.setValue(1);
              scale.setLayoutX(100);
              scale.setLayoutY(500);
              root.getChildren().add(scale);
              scale.valueProperty().addListener(new ChangeListener<Number>() {
                   public void changed(ObservableValue<? extends Number> ov,
                             Number old_val, Number new_val) {
                        for (Node node : elements.getChildren()) {
                             node.setScaleX(new_val.doubleValue());
                             node.setScaleY(new_val.doubleValue());
              stage.show();
    }Thanks for your help!
    Best Regards

    Sorry for the thread. I regonized, that this is bug, which is fixed in version 2.1. see http://javafx-jira.kenai.com/browse/RT-13328

  • Only available option is convert path to extrusion?

    When I right click on a part of my image with the direct selection tool, only the option "convert path to extrusion" is available. How do I make the free transform option available again?

    Hi!
    Have you tried getting the move tool, and selecting "show transform controls" in its option bar? that way, you can scale them anytime.

  • Any way to outline a stroke to convert a line to a  filled object? [CS4]

    Illustrator has 'outline stroke' or somesuch, which lets you convert a line item to a filled object. I'd like to do the same in ID for arrow lines. Any way to kludge this?
    Thanks in advance.
    Aaron

    Both methods work but neither produces a single object. In other words, the arrow head is still separate from the line and selectable as such with the direct selection tool. Thus pasting it back in ID and filling it with a gradient gives a noticeable difference between arrowhead and line.
    Anyway, this is progress... Thanks, both!
    Aaron

  • Suggested New Feature to Photoshop Clipping Path Lines

    I've been using Photoshop for 20 years, and now that I'm 51 yrs old I have an increasingly hard time seeing the thin clipping path line if it is on a dark texture.  Yes, I have had my eyes checked very recently, and yes, I do need eyeglasses when working on the computer now.  I would like to suggest that Adobe consider adding a feature that allows a user to choose line weight and color.  It would really be helpful.  Age has certainly taken it's toll on my eyes (and my hair)!  Does anyone else have my same issue?

    Clipping Path or are you referring to the Pen Option ruber Band?

  • Convert path to line?

    I have a vector shape. I want to take one side of the shape and take those points to make a new line. Thanks

    I should also mention that the Knife tool can be used to open a closed path. I think the easiest way to do this is to drag with the Knife tool across a segment you'd like to delete. This creates a new point, and if you delete that point, the path will become an open one. (It's a bit mysterious how that works...)
    You can also click the Knife tool on a point, but this typically creates two points in place of one, which I find a bit confusing. (Does it create just one new point? Or does it create two new points surrounding the original?)
    You can also drag the Knife tool across the entire object. Come to think of it, this may be the best way to use this tool, as it seems to immediately split the closed path into two open paths. From there, you can select and delete the portion of the original object you don't need, and then continue to delete any unneeded points from the remaining open path with the Subselection tool.

  • Converted Path to Button Border Allways hidden

    A bunch of paths are imported from Illustrator to Flash and converted to Button Symbols. The Stroke is set to Hairline (0.10) Light Gray and the Fill to solid White for all of the paths. When the file loads the Fill colors are provided from an XML file and can be Red/Blue etc. My problem is that the Solid Fill covers/hides the Stroke/borders.
    As workaround I copied all paths to another layer placed on top of the symbols layer. So all symbols are behind and the top layer simulates the borders.
    Is any way to make the Symbols border to be displayed without having that extra layer? I tried using very Heavy/Thick border setting but still the fill is hiding it.

    Ned,
    Thank you immensely for looking into this. It took me a couple of extra days to try few things. Here are my latest findings:
    I have no problem at all running the file. Everything is as intended except the buttons borders.
    If I preview the output/movie into Flash or Browser I can see the buttons borders. It doesn’t matter if the color is the original White fill or any other color.
    If I include the file in the ASP page I also can see the borders when the XML file is empty (each button is a room on a floor plan and when the SQL query returns no room then no button is re-painted) and all rooms stay (again) the original White fill.
    If any room is found and the button is repainted then the borders disappear. This made me think that the buttons are not re-painted the correct way. Here are the few lines of code involved in the process:
    for each (var Zone:XML in myXML.zone)
                var ColorUp:ColorTransform = new ColorTransform();
                ColorUp.color = Zone.@up;
                var ColorOver:ColorTransform = new ColorTransform();
                ColorOver.color = Zone.@over;
                for each (var btn:XML in Zone.room)
                            myButton = getChildByName("btn_" + btn.@number);                                
                            if (myButton != null)
                                        myButton.upState.transform.colorTransform = ColorUp;
                                        myButton.downState.transform.colorTransform = ColorUp;
                                        myButton.overState.transform.colorTransform = ColorOver;
    Thank you again!
    Tin

  • Text converted to lines will not print

    I have a AICS3 document with some text. The font acts a little funny, but it has been working. It shows up fine in my document, but it will not print. I conert it to lines, it shows up in my document, but it still won't print. I place it in an ID file, export it as a PDF. The text shows up in ID, but will not print. It shows up when I open the PDF in Acrobat Reader, but not in Acrobat. In both cases, the text (that has been long converted to outlines) does not print. Can anyone help? Since the text has been converted to outlines is it not just a group of compound paths? I even changed the fill with no luck. In general, I am very tired of the way we users are treated like criminals when it comes to fonts--regardless if that is the problem here. I mean, what good is a font if you can't print it? Anyway, I digress. Any ideas from anyone? I'd really like to get this thing printed.
    Thanks,
    MGuilfoile
    G5/2500, OS 10.4.11, AICS

    "Overprint fill" is useful in a situation such as 100K text printing over solid yellow. The setting will prevent the yellow from being knocked out behind the black, causing unnecessary registration problems.
    White text is created by lack of ink, so preventing the background objects from being knocked out causes the white objects to disappear. Only if you were printing opaque white ink over a color, such as in screen printing, would that ever be used, and probably not even then.
    Hopefully an expert will come along with a more detailed and accurate explanation.
    Mike D.

  • How to convert each line in a multi-line paragraph to one separate paragraph

    hi friends
    imagine in a word 2013 document, we have this one paragraph :
    i want each line in this paragraph have a bullet point, but the problem is when i select these four lines & click on bullet point button, only first line will have bullet point.
    i do know that i can press enter after each line so that each line be converted to a separate paragraph but need a method or trick so that i select the entire paragraph & by clicking on something, it be divided to 4 paragraphs at once.
    i googled for "converting one paragraph to multiple"  but didn't find any helpful stuff
    thanks in advanced

    I suspect the suggestion you've got from Hans is as elegant as you're going to get.
    Personally I tend to opt for making the first line into a bullet, then at the end of the line hit return (you'll get a bulleted empty line and your second line of text bulleted), then press Delete to pull the second line of text back up into its original
    place (while keeping the bullet). Repeat that for each line until they all have their bullet points, while remaining in their original format (eg without a massive space between each of them).
    But that's only because I hadn't seen Hans' method before! :-)
    hi Keith
    thanks for solution. when there are lots of line, as you know better than me, an automated method is better

Maybe you are looking for

  • Value Mapping in Import Manager

    Hi All, I have Probelm while loading data to MAIN TABLE through Import manager,I am getting XML file from Legacy System in which legacy sends State Code like NM (for New Mexico) .In my region table I made Name and Code as display field .Created my Im

  • My ipod camera is not working it is all pitch black

    when open ipod touch camera its all pitch black how do i fix it ?

  • Lose iMovie audio adjustments when burning to iDVD

    Using iMovie 3.1 and trying to make an off camera voice audible by raising the volume control, but when I listen to the finished DVD in player, the off camera voice is so low it's inaudible. It seems that I'm getting a result opposite from the one i

  • What FM can be use to determine what activity is ticked on the BPP_ROLE?

    Hi experts! In transaction PFCG, Display role: Authorizations is there a Function Module that can determine which activity is ticked in the inner authorization object BPP_ROLE based on the user (e.g BUYER)? Thanks!

  • Advice Needed on home purchase CA

    Here is my situation: My income is $125k a year but have FICO of 650. Spouse's income is 80k a year with about 710 FICO We have $200k for a down payment We want to buy a home that is $840k. We can put 20 percent down or all the $200k which would be a