Converting path to refnum ?

I am working with a custom VI that I made that writes a 2D spreadsheet to a file during a measurement. The 2D data may later be appended, or optionally (at the start) the file may be created for this purpose (with a header file).
However, during a recent measurement, someone tripped over the power cable for the computer and all data (representing about 15 minutes of sensitive measurements) was lost since it was not flushed to disk.
The flush VI needs a refnum input. I want to place this VI just before the return of the call, so that this does not happen again (say - the computer crashes, or if I need to abort the measurement because some of the parameters went out of range, but do not want to lose the data already acquired).
So, how do I generate a refnum from a file path. If it matters, I am using Labview 8.6 on a Fedora 10 machine. 
Message Edited by m-s on 03-26-2010 01:36 PM

Please post an image of your code so we can help out.
I suspect you are using an Express VI and it will have to be converted to real code so you can drop the flush inside it. Just opening another ref to the same file and flushing on that ref will not guarrentee the buffers asscosated with the other ref gets flushed.
Ben
Ben Rayner
I am currently active on.. MainStream Preppers
Rayner's Ridge is under construction

Similar Messages

  • Path to refnum

    How can I convert path to refnum? Currently I am doing it with Get File Size. But it seems an overkill. Any other simpler way?
    Have a very nice day!

    Hi rashid,
    see the attached example.
    Mike
    Attachments:
    Unbenannt 11_LV80.vi ‏9 KB

  • 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.

  • Convert path to hyperlink from SQL Server 2000 to JSP

    Hello,
              I have the following fields in my database table:
              report_key           (not shown on JSP)     
              report_name           (on JSP)
              path                (not shown on JSP)
              user role/right      (not shown on JSP)
              The "path" field contains a URL to a specific report
              (http://www.home.com/reports/1033.cr). The "report_name" field has a
              numeric name for the report (1033). What I need to do is be able to
              display the html output of the table records (which I have already
              done), but convert the report_name to a hyperlink that the user can
              click on to directly open the report. A hyperlink data type isn't
              available in SQL Server, so I'm not sure how to do this in the JSP.
              Basically, what needs to happen is the table data on the JSP page
              displays the "report_name" (in this case 1033) as a hyperlink, which
              is picked up by the URL path in the "path" field (or appended to that
              path I suppose). So, everytime our reports admin enters a report in
              the table, this new report with its new path will be added to the html
              output on the JSP page. And would look like this:
              report_name
              1033 (appears as underlined hypertext)
              1066
              1099
              1245
              1478
              Any help or suggestions would be greatly appreciated.
              TIA,
              Bruce Johnson
              Programmer/Analyst
              

    Hi Peter,
    As you are having issue with SDK's.
    I would suggest you to post your question in
    Business Objects SDK Application Development » [Legacy Application Development SDKs|;
    That forum is monitored by qualified technicians and you will get a faster response there. Also, all  SDK queries remain in one place and thus can be easily searched in one place.
    Thank you for your understanding,
    Shweta

  • 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

  • Error when accessing low level objects and converting variant to refnum Type

    Hope someone can give a clue....
    I'm using a dll, but it only has one creatable object, and I need to call two non-creatable objects.
    When the method to return the new reference is called, an error occured ("Member not found.
    in My.vi").
    The weird thing is that when I wired the new reference, I'm able to see the new methods and properties expected of the new object.
    Should I ignore this error???
    Also, does anyone know, How can I convert a variant to a ActiveX refnum??? because, when I use the To G type Lib, if a refnum type is wired, it's like this type is not supported, but the list states otherwise.
    Thank you in advance for any clue you can give me!!!

    Since I do not know what type of ActiveX object you are calling, I do not know about the error you are seeing. However, since everything seems to be working after that, I would assume it's okay. Now, you can convert a variant to an ActiveX refnum, but how you do this depends upon what type of refnum you need. Use the Variant to Data.vi to convert your variant type to a refnum by wiring in an ActiveX refnum to the "type" input. You will first need to determine what type of ActiveX refnum it is (Automation, Control, etc) and then wire that wire type into this VI.
    J.R. Allen

  • Convert path with effects to plain path

    Ok I have a square that has a scribble effect on it. I want to convert this square with the scribble effect to a bath where each scribble is outlined, sort of like live trace, but I'm not sure if this is possible. Thanks to those who help.

    You can select the scribble effect box and then go to the OBJECT menu, zip down to "EXPAND APPEARANCE" and the job will be done.
    Hope that helps.
    Just did a re-read, you want outlines! So add to the above by going back to the object menu, Choose PATH and OUTLINE STROKE
    Message was edited by: Michael Riordan

  • Easy: Convert Path to Selection Quickly

    I''m using Photoshop CS2:
    I'm coloring comic book pages as a hobby and to create areas to fill, I make a path with the pen.  I then convert the path to a selection and fill it with the paint bucket.  But converting the path to a selection requires clicking on the path palette, then dragging the path to the "load path as a selection" button.  Since I make a different path for every item on the page, this gets to be a real time killer. I tried going into the keyboard shortcuts to assign CTRL+P to "load path as a selection", but "load path as a selection" is not there to be assigned a keyboard shortcut.  If I use what is there, ("Make selection..."), when I use CTRL+P, I get a dialog I don't want that asks me about the feathering radius, anti-aliasing, etc...  So is there a way that I can simply close a path, then convert to a selection without all the extra steps?  A keyboard shortcut would be fine, but I can't seem to make one using just Photoshop options.  What to do?

    Use Ctrl+Enter to make a selection from the active path (no dialog)
    For a dialog, right click inside the active path and choose Make Selection.
    MTSTUNER

  • 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

  • Convert path query to xquery

    Hello
    I need to convert this path regions/africa/item[[[NOT[/location="United States"]] AND /quantity="1" AND /payment="Creditcard"] OR shipping="Will ship only within country"]
    to xquery, where the data stored in standard.xml
    Thank you

    I found the solution if someone is interested
    <result>
    for $i in doc("standard.xml")//item
    where not(($i/location="United States" and $i/quantity="1" and $i/payment="Creditcard") or $i/shipping="Will ship only within country")
    return count($i)
    </result>
    Thanks all

  • Illustrator converting paths to embedded images

    I have a funky issue that I've come across. I have several files that were made using Illustrator CS3. There is a particular type of path item in them (a basic shape path with gaussian blur applied to them) that when I open up the file using CS6 that path item is treated by Illustrator like it's a embedded image.
    I've remade those items as an actual path item with gaussian blur applied, and all seems fine until I save and re-open the file, they become embedded images again. I'm thinking it might be an issue with a setting somewhere but I'm not finding it.
    I have several files of the same type that don't have this issue but I'm not finding any difference between them. At this point I'm stumped...any suggestions?

    After playing around with things for a while I've learned that what I must do is choose "Save as..." with the file, then it will change it to a CS6 file and the world seems happy, but because I had warning dialogs supressed it wasn't alerting me to the fact that the file still was a legacy file when I simply saved, and when I chose "Save as..." I just wasn't making it far enough to get to the dialog where I got to change the file type. Again, most of the files (which were all created at the same time) were not having this issue which was why it was confusing...

  • How to I 'ungrey' 3D options in Photoshop cs6? Trying to convert path into 3D objects.

    Hello everyone! I have been trying to create 3D text following a tutorial on adobe tv: http://tv.adobe.com/watch/learn-photoshop-cc/distorting-and-extruding-text-in-3d/. My paths are ready but my 3D options are grey. I read a post else where that suggested it may be a problem with my graphics card being too weak, (I have a GeForce GTX 760, which I thought was powerful) The other suggestion was to change the documents colour profile to RGB. However I could not see the option for this in 'colour settings'.
    Advice and feedback will be much appreciated.
    Cheers,
    - Coen

    Correct. 3D only works in RGB. Image --> Mode is your friend.
    Mylenium

  • 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.

  • Convert Mask path to shape path?

    Can I convert a Mask path into a shape path in AECS4?
    I am running into a problem with resizing my layers - I am animating a signature, and part of it was done as a shape, part of it as a mask that 'reveals' a signature (someone else created the original) when I try to enlarge the whole thing, only the shape portion enlarges without artifacting (vector) the mask portion gets blocky and ugly if enlarged.

    The After Effects CC (12.2) update makes creating Bezier paths easier and more obvious.
    option for creating shape layers based on Bezier paths:
    When a shape tool (Rectangle, Rounded Rectangle, Polygon, Star, or Ellipse tool) is active, you can use the new Bezier Path option in the Tools panel to create a new shape based on a Bezier path, as opposed to the default of creating a new shape based on a parametric path. Holding the Alt (Windows) or Option (Mac OS) key while drawing a shape causes the opposite behavior—i.e., if the Bezier Path option is enabled, holding the Alt or Option key causes the shape tool to create a parametric path; if the Bezier Path option is disabled, holding the Alt or Option key causes the shape tool to create a Bezier path.
    command for converting a parametric shape layer path to a Bezier path:
    You can convert a parametric path to a Bezier path after the parametric path has already been created by context-clicking (right-clicking or Control-clicking on Mac OS) the property group for the parametric path (e.g., Rectangle Path 1) and choosing the Convert To Bezier Path command from the context menu. If the parametric path is animated (keyframed), the converted Bezier path is a static path based on the parametric path at the current time; keyframes are lost.
    IMPORTANT: When you use the Convert To Bezier Path command to convert a parametric shape path to a Bezier shape path, the Bezier path that is created does not animate well (i.e., interpolation between paths behaves strangely and unpredictably). This is related to path direction and how transformations are stored. For now, you should not use these converted paths for animated paths (interpolation between paths); but, if you do want to try, you may be able to work around the issues by reversing the path before conversion.

  • NaN/PathRefnum? function producing useless answers for Path, Refnum

    I have found similar threads to this, but not quite the same, AFAICT.
    I'm trying simply to see if an INI file exists, so I created the following snippet:
    I also created a small file, put it in my C:\ directory, which I have attached here.
    When I run the LV program with C:\test.ini, my indicators come out as NaN/Path?: False, NaN/Refnum?: True
    which I tried to interpret as (1) a valid path (file exists) and (2) a nonexisting refnum (although the refnum came from an LV-supplied subVI).
    I then changed the control (file to find) to C:\test.in (lopped off final "i") and the two indicators gave me the same results. That blew away my first interpretation, and I can't come up with anything else which makes sense.
    So, for paths and refnums, what is going on here, if anything?
    I did see that the second test threw an error from the "Open Config Data" subVI, so I can use that for my test, but I'd like to know if the NaN... function is actually good for anything but numbers. If not, IMHO LV should change its designation on the palette.
    Cameron
    To err is human, but to really foul it up requires a computer.
    The optimist believes we are in the best of all possible worlds - the pessimist fears this is true.
    Profanity is the one language all programmers know best.
    An expert is someone who has made all the possible mistakes.
    To learn something about LabVIEW at no extra cost, work the online LabVIEW tutorial(s):
    LabVIEW Unit 1 - Getting Started
    Learn to Use LabVIEW with MyDAQ
    Solved!
    Go to Solution.
    Attachments:
    test.ini ‏1 KB

    Thanks, Nathand,
    That clears it up a lot (and then digging down into the layers below the "Open Config Data" VI brings back the opacity). That's just one of the things which has confused me about the Config File VIs subpalette, but the explanation and the fact that you have to use a special "Not a Config Data Refnum.vi" with these instead of the normal "NaN/Path/Refnum?" (I never saw it until you pointed it out) answers several of the other questions, too. Like I said at first, in this case I just wanted to see if the file was there, so there are alternatives. But when I need to do more than what the prepackaged VIs do (which I expect I will), then it's just a matter of digging down in with my hip boots on. (Yuck.) But it's all fun, or I wouldn't be doing it in the first place.
    Cameron
    To err is human, but to really foul it up requires a computer.
    The optimist believes we are in the best of all possible worlds - the pessimist fears this is true.
    Profanity is the one language all programmers know best.
    An expert is someone who has made all the possible mistakes.
    To learn something about LabVIEW at no extra cost, work the online LabVIEW tutorial(s):
    LabVIEW Unit 1 - Getting Started
    Learn to Use LabVIEW with MyDAQ

Maybe you are looking for

  • Young library is looking for it's way

    Good day! Two and a half years have past and I think I've done something good. I've written a library to draw notes (music text) on screen. Library is based on swing (it extends JPanel... and that's all ;D). I've made some applications with that libr

  • How to configure lion mail service with lion server settings

    I've sucessfully setup outgoing mail but I keep getting "The server returned the error: The server "incoming.domain" cannot be contaced on port 110".  What configurations for Lion Server and Mail incoming mail server do I need to receive mail?

  • E7 and Microsoft Apps

    I noticed that Nokia Suite is no longer listing Microsoft Apps as a 'Software Update'. I did not install it when it first came up, as I do not think I need it. Is this suite being phased out for the E7 since it is no longer listed as an update?

  • Troubleshoot Error - Unable to perform table-based value assignment config

    After to creating class, characteristics, and value assignment type, the system is unable to perform table-based value assignment configuration. The following error is displayed:

  • Understandng the callable object within GP

    Hi All, I have basic question on callable objects in GP. I would like to know how the Adobe form content gets persisted with in GP . Example : We have 4 steps in a GP process , one requestor and two approvers. Each step is a webDynpro callable object