Line to Poly

In 10g is there a simple way to convert a line string with the same start and end point to a polygon? I have a table with a large amount of data and want to find a fast way to convert.

Here is one way, but you have to pay attention to the assumptions:
They are all single line strings
They all have the same start and end point
They are all defined with counter clockwise rotation
They are all two dimensional
They are not self crossing line strings
Then:
drop the spatial index
update mytable a set a.geom_column.sdo_gtype=2003;
update mytable a set a.geom.sdo_elem_info=mdsys.sdo_elem_info_array(1,1003,1);
commit;
recreate the spatial index (use layer_gtype=polygon)
If they are not all defined with counter-clockwise rotation:
drop the spatial index
update mytable a set a.geom_column.sdo_gtype=3;
update mytable a set a.geom.sdo_elem_info=mdsys.sdo_elem_info_array(1,3,1);
commit;
execute sdo_migrate.to_current('table_name','column_name');
recreate the spatial index
As the complexity goes up, it will no longer be possible to do this with simple sql, and you will need pl/sql routines. In any event, it shouldn't be too difficult.

Similar Messages

  • Select query giving error

    Hi can Some one help me how to fit the query in the Main query, I need to selete SYS_ID the below Work around query is getting the output correctly
    but when i tried to put in the main query am getting ORA-00933 not sure how to fix this. Can some one advice me where am making wrong.
    Work Around query :
       SELECT ALTID.B_SYS_ID FROM N08.B_ALT_ID_TB ALTID WHERE ALTID.B_ALT_ID
               IN ( SELECT MEDCO.RE_MEDCD_ID_NUM 
                 FROM N09.T_MEDCD_ID MEDCO
              INNER JOIN N09.T_POLY POLY
                    ON POLY.RE_UNIQUE_ID = MEDCO.RE_UNIQUE_ID) AS B_SYS_ID
    Need to integerate the above column in the below query.
    Main Query :
    SELECT 'Diff' AS SC,
         POLY.ID,
          ALTID.B_SYS_ID FROM N08.B_ALT_ID_TB ALTID WHERE ALTID.B_ALT_ID
               IN ( SELECT MEDCO.RE_MEDCD_ID_NUM 
                 FROM N09.T_MEDCD_ID MEDCO
              INNER JOIN N09.T_POLY POLY
                    ON POLY.RE_UNIQUE_ID = MEDCO.RE_UNIQUE_ID) AS B_SYS_ID,
        NULL AS BEG_DT,
      NULL AS ID,
    FROM
       N09.T_POLY POLY
    Oracle Version : 10gR2
    Thanks in advance.

    Hi,
    Hillbird wrote:
    Hi Frank,
    Thanks for your responces. The Error am getting is at line number 7 & col# 55 -- ON POLY.RE_UNIQUE_ID = MEDCO.RE_UNIQUE_ID) AS B_SYS_ID,.
    I also changed the alias name in thesubquery as S-poly and left the main query alias as POLY. You still haven't posted a completed query, or any sample data and results.
    But still i am getting the same error message.
    Error Message
    ORA-00933 : Sql command not properly ended
    oo933 00000 - "Sql command not properly ended"
    Vendor Code 933 Error at line 7 column 55
    Iam framing a select query, The work around query is used to checkhow to reterive the value from the DB and with the business rules. on which the framing
    select query the B_sys_id comes in column 3 and i still have more columns to select. Hence i even tried as below
    SELECT 'Diff' AS SC,
    POLY.ID,
    ALTID.B_SYS_ID FROM N08.B_ALT_ID_TB ALTID WHERE ALTID.B_ALT_ID
    IN ( SELECT MEDCO.RE_MEDCD_ID_NUM 
                 FROM N09.T_MEDCD_ID MEDCO
                 WHERE POLY.RE_UNIQUE_ID = MEDCO.RE_UNIQUE_ID),
    NULL AS BEG_DT,
    NULL AS ID,
    FROM
    N09.T_POLY POLY
    But still the same error message i got.
    Hence i just tried as below
    SELECT 'Diff' AS SC,
    1 as dummy,
    2 as dummy_1,
    ALTID.B_SYS_ID FROM N08.B_ALT_ID_TB ALTID WHERE ALTID.B_ALT_ID
    IN ( SELECT MEDCO.RE_MEDCD_ID_NUM 
                 FROM N09.T_MEDCD_ID MEDCO
              INNER JOIN N09.T_POLY POLY
    ON POLY.RE_UNIQUE_ID = MEDCO.RE_UNIQUE_ID)
    This is working.
    Can you please let me know what is that i need to do if i want to add more columns in the select clause after
    this line ON POLY.REUNIQUE_ID = MEDCO.RE_UNIQUE_ID)_
    Thanks.
    A query (not counting sub-queries) has, at most, only one of each type of clause: one SELECT clause, followed by one FROM clause, followed (optionally) by one WHERE clause. All items to be returned go together in the one SELECT clause. All tables needed are named in the on FROM clause. All filtering conditions go together in the one WHERE clause.
    Perhaps you meant something like this:
    SELECT  'Diff'           AS SC
    ,          POLY.ID
    ,           ALTID.B_SYS_ID
    ,       NULL AS BEG_DT
    ,     NULL AS ID
    FROM     N08.B_ALT_ID_TB ALTID
    JOIN    N09.T_POLY     POLY   ON  altid.column_a  = poly.column_b
    WHERE      ALTID.B_ALT_ID     IN (
                          SELECT  MEDCO.RE_MEDCD_ID_NUM 
                             FROM    N09.T_MEDCD_ID           MEDCO
                             WHERE   POLY.RE_UNIQUE_ID      = MEDCO.RE_UNIQUE_ID
                      )With the little information I have, I can't even guess what the real join condition(s) might be. I used
    ON  altid.column_a  = poly.column_bjust to show the correct syntax.

  • Polygon Line (Stroke Size)

    Hello,
    A friend in this forum once helped me to sort out a problem in the code below. The problem then was that I wanted to increase the stroke size of polygon lines. The polygon points represent cities. The example then was based on 2 cities and the code worked. Now I increased it to 3 cities but the result is wrong.
    package graphic;
    import java.awt.Color;
    import java.awt.Graphics2D;
    import java.awt.Polygon;
    import java.awt.image.BufferedImage;
    import java.util.*;
    import javax.swing.ImageIcon;
    import javax.swing.JFrame;
    import javax.swing.JLabel;
    import java.awt.geom.*;
    import java.awt.BasicStroke;
    import java.awt.RenderingHints;
    public class DrawCliqueTest {
         public static void main(String[] args) {
              try {
                   JFrame frame = new JFrame();
                   frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
                   BufferedImage image = new BufferedImage(400, 300,
                                                     BufferedImage.TYPE_INT_RGB);
                   Graphics2D g = image.createGraphics();
                   g.setRenderingHint(RenderingHints.KEY_ANTIALIASING,
                             RenderingHints.VALUE_ANTIALIAS_ON);
                   g.setColor(Color.WHITE);
                   g.fillRect(0, 0, image.getWidth(), image.getHeight());          
                   g.setColor(Color.BLACK);
                   List<String[]> StringElements = new ArrayList<String[]>();
                   String[] Elem1 = {"Wahington","Chicago","London"};
                   String[] Elem2 = {"Washington","Tokyo","London","Chicago"};
                   StringElements.add(Elem1);
                   StringElements.add(Elem2);
                   List<int[]> Xlist = new ArrayList<int[]>();
                   int[] xPoint1 = {150,278,250};
                   int[] xPoint2 = {150,50,250,278};
                   Xlist.add(xPoint1);
                   Xlist.add(xPoint2);
                   List<int[]>Ylist = new ArrayList<int[]>();
                   int[] yPoint1 = {50,80,203};
                   int[] yPoint2 = {50,200,203,80};
                   Ylist.add(yPoint1);
                   Ylist.add(yPoint2);
                   ArrayList<Polygon> list = new ArrayList<Polygon>();
                   list.add(new Polygon(new int[] {150, 278,250}, new int[] {50, 80,203}, 3));
                   list.add(new Polygon(new int[] {150, 50, 250, 278},
                                           new int[] {50, 200, 203, 80}, 4));
                   //Draw the Strings
                   for(int i = 0; i < StringElements.size(); i++) {
                        for(int j = 0; j < StringElements.get(i).length; j++) {
                             g.setColor(Color.RED);
                             g.drawString(StringElements.get(i)[j], Xlist.get(i)[j],
                                                           Ylist.get(i)[j]);
                   // Draw a line between every pair of points
                   for (Polygon poly : list) {
                        for (int i = 0; i < poly.npoints-1; i++) {
                             for (int j = i+1; j < poly.npoints; j++) {
                                  g.setColor(Color.BLACK);
                                  //if((i == 0 && j == 3) || (i == 1 && j == 0))
                                  if(((i==0 && j==3) ||(i==0 && j==2))||((i==1 && j==0)||(i==1 && j==2))||((i==2 && j==0 ||(i==2 && j==3))))
                                       g.setStroke(new BasicStroke(2f));
                                  else
                                       g.setStroke(new BasicStroke(1f));
                                  g.drawLine(poly.xpoints, poly.ypoints[i],poly.xpoints[j], poly.ypoints[j]);
                   g.dispose();
                   frame.add(new JLabel(new ImageIcon(image)));
                   frame.pack();
                   frame.setVisible(true);
              } catch(Exception e) { e.printStackTrace(); }
    The program is meant to check the elements in each array of the ArrayList "StringElements" and get the strongly connected cities (the same cities that are in both arrays; Elem1 and Elem2. .
    If you run the code, it draws the connections between London->Washington, London->Chicago and London->Tokyo with a stroke size 2 and the rest with stroke size 1. But, London->Tokyo is not suppose to be drawn with stroke size 2 because Tokyo is not in Elem1.
    My plans is to implement this line of the code which is my problem point: if(((i==0 && j==3) ||(i==0 && j==2))||((i==1 && j==0)||(i==1 && j==2))||((i==2 && j==0 ||(i==2 && j==3)))) dynamically but the static version is not even working.
    Any solution or idea on how to overcome this problem?
    Thanks,
    Jona_T

    import java.awt.Color;
    import java.awt.Graphics2D;
    import java.awt.Polygon;
    import java.awt.image.BufferedImage;
    import java.util.*;
    import javax.swing.ImageIcon;
    import javax.swing.JFrame;
    import javax.swing.JLabel;
    import java.awt.geom.*;
    import java.awt.BasicStroke;
    import java.awt.RenderingHints;
    public class DCT {
        public static void main(String[] args) {
            JFrame frame = new JFrame();
            frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
            BufferedImage image = new BufferedImage(400, 300,
                                          BufferedImage.TYPE_INT_RGB);
            Graphics2D g = image.createGraphics();
            g.setRenderingHint(RenderingHints.KEY_ANTIALIASING,
                               RenderingHints.VALUE_ANTIALIAS_ON);
            g.setColor(Color.WHITE);
            g.fillRect(0, 0, image.getWidth(), image.getHeight());          
            g.setColor(Color.BLACK);
            List<String[]> StringElements = new ArrayList<String[]>();
            String[] Elem1 = {"Washington","Chicago","London"};
            String[] Elem2 = {"Washington","Tokyo","London","Chicago"};
            StringElements.add(Elem1);
            StringElements.add(Elem2);
            List<int[]> Xlist = new ArrayList<int[]>();
            int[] xPoint1 = {150,278,250};
            int[] xPoint2 = {150,50,250,278};
            Xlist.add(xPoint1);
            Xlist.add(xPoint2);
            List<int[]>Ylist = new ArrayList<int[]>();
            int[] yPoint1 = {50,80,203};
            int[] yPoint2 = {50,200,203,80};
            Ylist.add(yPoint1);
            Ylist.add(yPoint2);
            ArrayList<Polygon> list = new ArrayList<Polygon>();
            list.add(new Polygon(new int[] {150, 278, 250},
                                 new int[] { 50,  80, 203}, 3));
            list.add(new Polygon(new int[] {150,  50, 250, 278},
                                 new int[] { 50, 200, 203,  80}, 4));
             //Draw the Strings
             for(int i = 0; i < StringElements.size(); i++) {
                 for(int j = 0; j < StringElements.get(i).length; j++) {
                     g.setColor(Color.RED);
                     g.drawString(StringElements.get(i)[j], Xlist.get(i)[j],
                                                            Ylist.get(i)[j]);
             // Draw a line between every pair of points in each polygon.
             for(int i = 0; i < list.size(); i++) {
                 Polygon poly = (Polygon)list.get(i);
                 for (int j = 0; j < poly.npoints; j++) {
                     for (int k = j+1; k < poly.npoints; k++) {
                         g.setColor(Color.BLACK);
                         // Use heavy Stroke if route is duplicated.
                         if(isDuplicated(i, j, k, StringElements))
                             g.setStroke(new BasicStroke(2f));
                         else
                             g.setStroke(new BasicStroke(1f));
                         g.drawLine(poly.xpoints[j], poly.ypoints[j],
                                    poly.xpoints[k], poly.ypoints[k]);
             g.dispose();
             frame.add(new JLabel(new ImageIcon(image)));
             frame.pack();
             frame.setVisible(true);
        private static boolean isDuplicated(int elementIndex, int origIndex,
                                   int destIndex, List<String[]> StringElements) {
            // Look for cities in StringElements.get(elementIndex) located
            // at [origIndex] and [destIndex] in the other StringElement arrays.
            String[] elementCities = StringElements.get(elementIndex);
            String orig = elementCities[origIndex];
            //System.out.println("orig = " + orig);
            String dest = elementCities[destIndex];
            //System.out.println("dest = " + dest);
            // If we find both the orig and dest cities in any other
            // element of StringElements return true.
            for(int j = 0; j < StringElements.size(); j++) {
                if(j == elementIndex)
                    continue;
                String[] element = StringElements.get(j);
                if(contains(element, orig) && contains(element, dest))
                    return true;
            return false;
        private static boolean contains(String[] circuit, String city) {
            for(int j = 0; j < circuit.length; j++) {
                if(city.equals(circuit[j]))
                    return true;
            return false;
    }

  • How to find connecting line

    Hi,
    I have a spatial table with geom type as 2002.
    I have a set of line (for example lets say it is 5 rows) attach image.
    I need to find line that is inner connecting to these 5 rows. What I mean is a boundary line has inner line.
    I am unable to get inner lines of a boundary.
    If I query spatial table I get boundary line but i want inner lines.
    attach is snapshot for ref.
    thanks in advance
    saaz

    Thanks B Hall and Stefan Jager @@for your inputs.
    Actually, in my database that has spatial geometry information has SDO_GTYPE is 2002 for ids that are connected to each other.
    and I have a second table that has no spatial geometry by a polygon information (more than one line).
    so for example in my poly_tab and line_tab
    poly_tab
    poly_id     line_id
    46951     1001
    46951     1005
    46951     1009
    46951     1032
    46951     1036
    56102     1072
    56102     1079
    56102     1082
    39024     1050
    39024     1045
    ........ and so on (note no spatial geometry column here and line_id is fk to line_tab and this table has line geom)
    also to be noted here that 1002 and 1003 has no record in poly_tab table.
    line_tab
    line_id   mdsys.geometry(sdo_gtype
    1001        2002
    1005        2002
    1009        2002
    1032        2002
    1036        2002  
    1072        2002 
    1079        2002
    1082        2002  
    1050        2002  
    1045        2002
    1002        2002
    1003        2002
    1019        2002
    lets says if I query poly_tab where poly_id = 46951
    it should display
    line_id
    1001       
    1005       
    1009       
    1032       
    1036
    1002
    1003     
    note 1002 and 1003 are inner lines for this polygon but in poly_tab this line does not exits. (in poly table only boundary line exists)
    @Stefan Jager
    thanks in advance
    saaz

  • 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

  • [CS4] Poly.. lasso is nearly invisible

    What can I do to make the poly.. lasso (or the others) more visible while working?  Once the selection is complete, of course the `marching ants' are quite visible... but today  I'm finding it very hard to keep track of where my working line is going.
    I don't see any settings in the prefs that appear to handle that... but also I don't recall the darn thing being so hard to see in the past either so maybe I've nudged some setting?

    I don't know of any adjustment. The cursor is supposed to contrast with  the image but for some tones it doesn't work.
    I use the space bar to find a lost cursor and if it's really difficult I temporarily add a Levels adjustment layer to aid visibility.

  • Using SQVI to generate report of open and released delivery schedule lines

    All,
    I'm using SQVI  to generate an excel spreadsheet for some buyers to show open released schedule lines because they are a 1 line item per scheduling agreement company.
    I used the logical database MEPOLDB instead of a table joint and pulled fields from EKKO(vendor, SA #,&purchasing group), EKPO(Material Number), EKEH(schedule line type), and EKET(delivery date, scheduled qty,previous qty).
    Does this sound like I'll get the results I want on paper as long as I use the right selection criteria, because the report I'm getting isn't quite what I expect? I am unable to identify which lines are authorized to ship vs. trade-off zone, planning, etc. in the report thus far.

    Hi Mark,
                 I have faced same requirement. I am not sure about transporting to TST and PROD. I done by this way.
    After generating SQVI program in DEV , I assigned that program  to a transaction and tested in DEV. Later i have regenarated SQVI in Production. then I assigned the generated Program to same transaction in DEV. And transported the Tcode assignment of program to Production..
    About authorization , if its not sensitive report, BASIS can restrict at transaction level.
    Regards,
    Ravi.

  • Unable to capture field values in Master agreement  Line Items

    I am trying to get the field values from master agreement line items page. I have written the following code to get the line item details which is working fine to capture part number and quantity->
    agreementBean = doc.getRootParentIBean();
    lineItemCollection = agreementBean.getLineItems();
    collectionsize = lineItemCollection.size();
    for(i=0;i<collectionsize;i++){
         collectionbean = lineItemCollection.get(i);
         partNum = ""+collectionbean.getPartNumber() ;
         Quantity = ""+collectionbean.getQuantity();     
         throw doc.createApplicationException(null,partNum + " , " + Quantity );
    Now, my problem is that I am unable to capture the following field item values in the master agreement > line items page.
    1. Price Unit
    2. Unit Price
    3. Product Category
    4. Plant
    Please help me to find the values.
    Thankx in Advance.
    Su
    Edited by: subrataindra on Aug 10, 2010 11:11 AM

    This will return the name of the plant.
    .getExtensionField("PLANT").get().getDisplayName(session);
    Check if this returns the product category
    collectionbean.getExtensionField("ITEM_CAT").get().getDisplayName();
    This will Return the Price
    collectionbean.getExtensionField("PRICE").get().getPrice();
    (return type :BigDecimal)
    This will return the currency
    collectionbean.getExtensionField("PRICE").get().getCurrency;
    (Return type:String)
    Similarly to retrieve other fields for which there are no standard functions, use .getExtensionField("Field ID")
    Hope this helps
    Regards,
    Immanuel

  • IF Statement in Join Line

    Is it possible to use a IF statement (i.e. CASE, DECODE) in the Join Line?
    I need create a query that depending on the value of a column it will determine if I use a column A or column B in my join statement. I was thinking something like the following:
    Select a.Value1, a.Value2, b.ColumnA, b.ColumnB
    FROM Table1 a
    INNER JOIN Table2 b ON a.Value2 = (if b.ColumnZ='Dept' then b.ColumnA else b.ColumnB END)
    Oracle Version 10g
    OS Windows XP
    Thanks in advance!

    Hi,
    Remember what a CASE expression does: it returns a single value in one of the SQL data types (such as VARCHAR2, NUMBER or DATE).
    Each THEN (or ELSE) clause of a CASE expression references something that the CASE expression might return, so after each THEN (or ELSE) keyword there must be a single value in one of the SQL data types.
    So you can't say:
    case tdsi.level_code
         when  'L'  then  tdsid.privilege_code = tdlm.location_code
         when  'R'  then  tdsid.privilege_code = tdlm.region_code
         when  'C'  then  tdsid.privilege_code = tdlm.country_code
    endWhat is the data type being returned? "tdsid.privilege_code = tdlm.location_code" is not a single value in any of the SQL data types.
    If location_code, region_code, country_code and privilege_code all have the same data type, then you can do something like this:
    join      dirpipe.dirpipe_location_map      tdlm      on      case tdsi.level_code
                                            when 'L' then tdlm.location_code
                                            when 'R' then tdlm.region_code
                                            when 'C' then tdlm.country_code
                                       end     = tdsid.privilege_code

  • What is" LINE-COL2 = SY-INDEX ** 2."

    can u explain what is '' ** "
    FIELD-SYMBOLS <FS> LIKE LINE OF ITAB.
    DO 4 TIMES.
      LINE-COL1 = SY-INDEX.
      LINE-COL2 = SY-INDEX ** 2.  "what this will do
      APPEND LINE TO ITAB.
    ENDDO.

    Hi sunil,
    1 **   means "To the power of"
    2. eg. 5 ** 2  =  25
       (5 To the power of 2 = 25)
    regards,
    amit m.

  • Header information not getting displayed in the lines

    Hello Everyone
    I have a very basic question - its very simple but not working for me with so many attempts
    My XML structure looks like this . In the RTF , I have header information and then a table for line information looping through G_LINES.
    IN this lines table I need the SHIP_CUSTOMER_ID of the header to be displayed. I have tried all options like <?../SHIP_CUSTOMER_ID?> or <?../G_ORDERS/SHIP_CUSTOMER_ID?> , however nothing seems to be working and I am not getting the field to be displayed. Can someone please help?
    XML structure is as follows:
    <XXSTOL_29251_PICK_TKT>
    <LIST_G_ORDERS>
    <G_ORDERS>
    <CUSTOMER_NUMBER>1411</CUSTOMER_NUMBER>
    <SHIPPING_INSTRUCTIONS1></SHIPPING_INSTRUCTIONS1>
    <SHIP_CUSTOMER_ID>256</SHIP_CUSTOMER_ID>
    <G_LINES>
    </G_LINES>
    <G_LINES>
    </G_LINES>
    </G_ORDERS
    </LIST_G_ORDERS>
    </XXSTOL_29251_PICK_TKT>

    Are you grouping within G_LINES? If so, use ../../SHIP_CUSTOMER_ID
    or send me the xml and RTF template to [email protected] so that I can get a better look at the data structure and try to help.
    Thanks,
    Bipuser

  • ArrayList e .RangeCheck(int)line 546

    Hi guys I am working on this project
    in few word
    I have to draw different shape on a panel
    moreover when two similar shapes collide ( 2 circles ) they make a bigger circle
    when st change direction
    almost everything works
    import java.awt.Graphics;
    import java.awt.event.ActionEvent;
    import java.awt.event.ActionListener;
    import java.util.ArrayList;
    import java.util.Comparator;
    import java.util.Iterator;
    import javax.swing.JPanel;
    class ShapePanel extends JPanel implements ActionListener {
         private static final long serialVersionUID = 1L;
         public static ArrayList <Shape>shapes;
         private javax.swing.Timer animationTmr;
         int speed;
         PlaySound audioClip = new PlaySound();
         private float heigth;
         private float width;
         private int shape1;
         private int shape2;
         public ShapePanel() {
              shapes = new ArrayList<Shape>();
              animationTmr = new javax.swing.Timer(80, this); //interval, ActionListener
              animationTmr.start();
         public ArrayList<Shape> getShapes()
              return shapes;
         public void addSquare(int x, int y,int w,int h, int shapeType) {
              shapes.add(new Square(this,x, y,width, heigth, shapeType));
              repaint();
              System.out.println(shapes.size());
         public void addCircle(int x, int y,int w,int h, int shapeType) {
              shapes.add(new Circle(this, x, y,width, heigth, shapeType));
              repaint();
              System.out.println(shapes.size());
         public void addRectangle(int x, int y,int w,int h,  int shapeType) {
              shapes.add(new Rectangle(this, x, y,width, heigth, shapeType));
              repaint();
              System.out.println(shapes.size());
         public void addStar(int x, int y,int w,int h, int shapeType) {
              shapes.add(new Star(this, x, y,width, heigth, shapeType));
              repaint();
              System.out.println(shapes.size());
         public void paintComponent(Graphics g) { //called Whenever panel needs
              super.paintComponent(g); //re-displaying:
              Iterator<Shape> it = shapes.iterator(); //Iterate through Balls calling
              g.setColor(Menu.getColor());
              g.fillRect(0, 0, this.getWidth(), this.getHeight());
              while (it.hasNext()) { //each one's paint method
                   it.next().paint(g);
         public void actionPerformed(ActionEvent ev) {      
              //On timer tick,
              Iterator<Shape> it = shapes.iterator(); //Iterate through Balls calling
              while (it.hasNext()) { //each one's updatePos() method
                   it.next().updatePos();
              checkTypeCollision();
              handleCollision();
              repaint();
        private void checkTypeCollision()
              //we iterate through all the balls, checking for collision
              for(int i=0;i<shapes.size();i++)
                   for(int j=0;j<shapes.size();j++)
                             if(i!=j)
                                  if(collide(shapes.get(i), shapes.get(j)))
                                            shape1=shapes.get(i).shapeType;
                                            shape2=shapes.get(j).shapeType;
                                             if(shape1==shape2)
                                             /*     int     newX = (int) ((shapes.get(i).getCenterX() + (shapes.get(j).getCenterX()/2))/2);
                                                  int newY = (int) ((shapes.get(i).getCenterY() + (shapes.get(j).getCenterY() /2))/2);
                                                 float newWidth =   shapes.get(i).getWidth()+(shapes.get(j).getWidth()/2);
                                                 float newHeigth = shapes.get(i).getHeigth()+(shapes.get(j).getHeigth()/2);
                                                 int newShapeType = shapes.get(i).shapeType;
                                                       if(shapes.get(i).getShapeType()==1)
                                                            shapes.remove(j); //remove shape element at j
                                                            shapes.remove(i); //remove shape element at j
                                                            System.out.println("SIZE IS==="+     shapes.size());
                                                            System.out.println("newx====="+newX);
                                                            System.out.println("newy====="+newY);
                                                            System.out.println("newWidth====="+newWidth);
                                                            System.out.println("newx====="+newHeigth);
                                             //               shapes.add(new Rectangle(this,newX,newY,530,530,newShapeType));
                                                            System.out.println("SIZE IS==="+     shapes.size());
                                                       //     repaint();
                                                       if(shapes.get(i).getShapeType()==2)
                                                            shapes.remove(j); //remove shape element at j
                                                            shapes.remove(i); //remove shape element at j
                                                  //          shapes.add(new Circle(this,newX,newY,newWidth,newHeigth,newShapeType));
                                                       //     repaint();
                                                       if(shapes.get(i).getShapeType()==3)
                                                            shapes.remove(j); //remove shape element at j
                                                            shapes.remove(i); //remove shape element at j
                                                            shapes.add(new Square(this,newX,newY,newWidth,newHeigth,newShapeType));
                                                       if(shapes.get(i).getShapeType()==3)
                                                            shapes.remove(j); //remove shape element at j
                                                            shapes.remove(i); //remove shape element at j
                                                            //shapes.add(new Star(this,newX,newY,newWidth,newHeigth,newShapeType));
                                                       //     repaint();
         private void handleCollision()
              //we iterate through all the balls, checking for collision
              for(int i=0;i<shapes.size();i++)
                   for(int j=0;j<shapes.size();j++)
                             if(i!=j)
                                  if(collide(shapes.get(i), shapes.get(j)))
                                        shapes.get(i).hit(shapes.get(j));
                                       shapes.get(j).hit(shapes.get(i));                                   
         boolean collide(Shape b1, Shape b2)
              double wx=b1.getCenterX()-b2.getCenterX();
              double wy=b1.getCenterY()-b2.getCenterY();
              //we calculate the distance between the centers two
              //colliding balls (theorem of Pythagoras)
              double distance=Math.sqrt(wx*wx+wy*wy);
              if(distance<b1.shapeSize)     
                   audioClip.playRectangle();
                   return true;          
                   else return false;     
         public static int vectorSize()
              return shapes.size();
    }the drawing stops and
    i have this error after a while
    arrayList<e>.RangeCheck(int)line 546
    moreover it doesn t draw a bigger shape as i want with the line
    shapes.add(new Circle(this,newX,newY,newWidth,newHeigth,newShapeType));
                                                       help please the deadline is Tomorrow;

    Exception in thread "AWT-EventQueue-0" java.lang.IndexOutOfBoundsException: Index: 4, Size: 4
         at java.util.ArrayList.RangeCheck(ArrayList.java:546)
         at java.util.ArrayList.get(ArrayList.java:321)
         at ShapePanel.checkTypeCollision(ShapePanel.java:156)
         at ShapePanel.actionPerformed(ShapePanel.java:77)
         at javax.swing.Timer.fireActionPerformed(Timer.java:271)
         at javax.swing.Timer$DoPostEvent.run(Timer.java:201)
         at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:209)
         at java.awt.EventQueue.dispatchEvent(EventQueue.java:461)
         at java.awt.EventDispatchThread.pumpOneEventForHierarchy(EventDispatchThread.java:242)
         at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:163)
         at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:157)
         at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:149)
         at java.awt.EventDispatchThread.run(EventDispatchThread.java:110)
    it doesn t compile because is part of a bigger project

  • F4IF_INT_TABLE_VALUE_REQUEST - how can I return all values from the line?

    Hi,
    I'm using FM F4IF_INT_TABLE_VALUE_REQUEST to show a pop-up with my internal table values.  The internal table has 3 fields, ATINN, ATZHL and a description field ATWTB.  ATINN and ATZHL are needed to complete the unique table key, however this FM will only return the value of one field in any line I select.
    How can I see all the values in the line I select in the return table?
    My code is as follows:
      DATA: tbl_cawnt LIKE cawnt OCCURS 0,
            wa_cawnt LIKE cawnt,
            BEGIN OF tbl_list OCCURS 0,
              atinn LIKE cawnt-atinn,
              atzhl LIKE cawnt-atzhl,
              atwtb LIKE cawnt-atwtb,
            END OF tbl_list,
            wa_list LIKE tbl_list,
            tbl_return LIKE ddshretval OCCURS 0,
            wa_return LIKE ddshretval,
            tbl_fields LIKE dfies OCCURS 0,
            tbl_dynp LIKE dselc OCCURS 0.
      REFRESH: tbl_list, tbl_cawnt.
      SELECT atinn atzhl atwtb
        FROM cawnt
        INTO CORRESPONDING FIELDS OF TABLE tbl_cawnt
        WHERE spras EQ sy-langu.
      LOOP AT tbl_cawnt INTO wa_cawnt.
        CLEAR wa_list.
        MOVE: wa_cawnt-atwtb TO wa_list-atwtb,
              wa_cawnt-atinn TO wa_list-atinn,
              wa_cawnt-atzhl TO wa_list-atzhl.
        APPEND wa_list TO tbl_list.
      ENDLOOP.
      CALL FUNCTION 'F4IF_INT_TABLE_VALUE_REQUEST'
        EXPORTING
          retfield        = 'ATWTB'
          dynpprog        = sy-repid
          dynpnr          = sy-dynnr
          value_org       = 'S'
        TABLES
          value_tab       = tbl_list
          return_tab      = tbl_return
        EXCEPTIONS
          parameter_error = 1
          no_values_found = 2
          OTHERS          = 3.
      IF sy-subrc <> 0.
        MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
                WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
      ENDIF.
    Thanks!

    Hi,
      Use the structure DYNPFLD_MAPPING
    With this internal table you can easily define that you want to return
    other columns of the hit list in addition to field RETFIELD to the
    screen.
    In this IT you can MAP the screen fields to the serch help screen fields this has three fields
    FLDNAME this is the field anme from the search help
    FLDINH This has to be blank which would be field with the field value that you want to map
    DYFLDNAME THis is the screen field name.
    So here you can get the values for the other fields that you want which are on the search help just populate the name of the fields in FLDNAME.
    Regards,
    Himanshu

  • IMac 10.4.11 Because permanent vertical lines have appeared on my screen, I need to get a new monitor. The adapter apple sells goes from female VGA to mini-DVI. What kind of cable should I get as well:female to male?

    If I use an adapter (female VGA to mini-DVI) for my iMac 10.4.11 OSX, I also need a cable. Should that cable be female VGA to male VGA?
    Permanent vertical lines have appeared on my display, and connecting to another display (monitor) requires a cable and adapter. I want to be sure I am purchasing the correct cable for the Apple adapter. 

    What made me think I need to format if I upgrade the OS?
    I just presumed so really.
    What made me think I need to constantly format computer with my problem?
    Well, after many attempts to repair the drive, which fails, cannot even reach the log in screen, I am left with no other choice?
    And also, I have to note now, System Preferences keeps crashing without reason, it either takes ages to load, just by clicking it to open, or clicking something within it, or it just crashes.
    And temporarily, it freezes the computer totally, with no response.
    Seriously, am I missing a system file or something? Anyone experienced this problem before?
    My computer is literally a blank computer right now, installed VLC and Shades, updated Adobe Flash Player, installed Skype and Adium. I would say Growl from Adium caused it, but it has happened prior to Skype and Adium. Any ideas anyone?
    Thanks,
    From Lelouch

  • Vendor Line Item not cleared after F110

    Hi Gurus,
    We encountered an issue. The payment run was processed last April 18 and the vendor invoices were captured during the payment run and in the aging report, these invoices didn't appear as Open Item.
    In between April 19 until August 19, these invoices are not part of the proposal list until the when they run payment on August 20. The value is zero and in the proposal list, there is a value in the Reason to Print Advice "A".
    What is the reason for this?
    Thank you.

    Hi Dianne Obviar,
    For that invoice payment delete uncompleted payment
    proposal.
    U go through this path select F4 in run date field
    There check it any un completed proposal is there and delete
    that invoice line item will come for payable
    Regards
    Surya

Maybe you are looking for