Merge branch 'master' of https://source.jalview.org/git/jalviewjs.git
[jalviewjs.git] / site / swingjs / j2s / jssun / awt / geom / Order3.js
index d36cabc..7797c1f 100644 (file)
-Clazz.declarePackage ("jssun.awt.geom");\r
-Clazz.load (["jssun.awt.geom.Curve"], "jssun.awt.geom.Order3", ["java.awt.geom.QuadCurve2D", "jssun.awt.geom.Order2"], function () {\r
-c$ = Clazz.decorateAsClass (function () {\r
-this.x0 = 0;\r
-this.y0 = 0;\r
-this.cx0 = 0;\r
-this.cy0 = 0;\r
-this.cx1 = 0;\r
-this.cy1 = 0;\r
-this.x1 = 0;\r
-this.y1 = 0;\r
-this.xmin = 0;\r
-this.xmax = 0;\r
-this.xcoeff0 = 0;\r
-this.xcoeff1 = 0;\r
-this.xcoeff2 = 0;\r
-this.xcoeff3 = 0;\r
-this.ycoeff0 = 0;\r
-this.ycoeff1 = 0;\r
-this.ycoeff2 = 0;\r
-this.ycoeff3 = 0;\r
-this.TforY1 = 0;\r
-this.YforT1 = 0;\r
-this.TforY2 = 0;\r
-this.YforT2 = 0;\r
-this.TforY3 = 0;\r
-this.YforT3 = 0;\r
-Clazz.instantialize (this, arguments);\r
-}, jssun.awt.geom, "Order3", jssun.awt.geom.Curve);\r
-c$.insert = Clazz.defineMethod (c$, "insert", \r
-function (curves, tmp, x0, y0, cx0, cy0, cx1, cy1, x1, y1, direction) {\r
-var numparams = jssun.awt.geom.Order3.getHorizontalParams (y0, cy0, cy1, y1, tmp);\r
-if (numparams == 0) {\r
-jssun.awt.geom.Order3.addInstance (curves, x0, y0, cx0, cy0, cx1, cy1, x1, y1, direction);\r
-return;\r
-}tmp[3] = x0;\r
-tmp[4] = y0;\r
-tmp[5] = cx0;\r
-tmp[6] = cy0;\r
-tmp[7] = cx1;\r
-tmp[8] = cy1;\r
-tmp[9] = x1;\r
-tmp[10] = y1;\r
-var t = tmp[0];\r
-if (numparams > 1 && t > tmp[1]) {\r
-tmp[0] = tmp[1];\r
-tmp[1] = t;\r
-t = tmp[0];\r
-}jssun.awt.geom.Order3.split (tmp, 3, t);\r
-if (numparams > 1) {\r
-t = (tmp[1] - t) / (1 - t);\r
-jssun.awt.geom.Order3.split (tmp, 9, t);\r
-}var index = 3;\r
-if (direction == -1) {\r
-index += numparams * 6;\r
-}while (numparams >= 0) {\r
-jssun.awt.geom.Order3.addInstance (curves, tmp[index + 0], tmp[index + 1], tmp[index + 2], tmp[index + 3], tmp[index + 4], tmp[index + 5], tmp[index + 6], tmp[index + 7], direction);\r
-numparams--;\r
-if (direction == 1) {\r
-index += 6;\r
-} else {\r
-index -= 6;\r
-}}\r
-}, "java.util.Vector,~A,~N,~N,~N,~N,~N,~N,~N,~N,~N");\r
-c$.addInstance = Clazz.defineMethod (c$, "addInstance", \r
-function (curves, x0, y0, cx0, cy0, cx1, cy1, x1, y1, direction) {\r
-if (y0 > y1) {\r
-curves.add ( new jssun.awt.geom.Order3 (x1, y1, cx1, cy1, cx0, cy0, x0, y0, -direction));\r
-} else if (y1 > y0) {\r
-curves.add ( new jssun.awt.geom.Order3 (x0, y0, cx0, cy0, cx1, cy1, x1, y1, direction));\r
-}}, "java.util.Vector,~N,~N,~N,~N,~N,~N,~N,~N,~N");\r
-c$.getHorizontalParams = Clazz.defineMethod (c$, "getHorizontalParams", \r
-function (c0, cp0, cp1, c1, ret) {\r
-if (c0 <= cp0 && cp0 <= cp1 && cp1 <= c1) {\r
-return 0;\r
-}c1 -= cp1;\r
-cp1 -= cp0;\r
-cp0 -= c0;\r
-ret[0] = cp0;\r
-ret[1] = (cp1 - cp0) * 2;\r
-ret[2] = (c1 - cp1 - cp1 + cp0);\r
-var numroots = java.awt.geom.QuadCurve2D.solveQuadratic (ret, ret);\r
-var j = 0;\r
-for (var i = 0; i < numroots; i++) {\r
-var t = ret[i];\r
-if (t > 0 && t < 1) {\r
-if (j < i) {\r
-ret[j] = t;\r
-}j++;\r
-}}\r
-return j;\r
-}, "~N,~N,~N,~N,~A");\r
-c$.split = Clazz.defineMethod (c$, "split", \r
-function (coords, pos, t) {\r
-var x0;\r
-var y0;\r
-var cx0;\r
-var cy0;\r
-var cx1;\r
-var cy1;\r
-var x1;\r
-var y1;\r
-coords[pos + 12] = x1 = coords[pos + 6];\r
-coords[pos + 13] = y1 = coords[pos + 7];\r
-cx1 = coords[pos + 4];\r
-cy1 = coords[pos + 5];\r
-x1 = cx1 + (x1 - cx1) * t;\r
-y1 = cy1 + (y1 - cy1) * t;\r
-x0 = coords[pos + 0];\r
-y0 = coords[pos + 1];\r
-cx0 = coords[pos + 2];\r
-cy0 = coords[pos + 3];\r
-x0 = x0 + (cx0 - x0) * t;\r
-y0 = y0 + (cy0 - y0) * t;\r
-cx0 = cx0 + (cx1 - cx0) * t;\r
-cy0 = cy0 + (cy1 - cy0) * t;\r
-cx1 = cx0 + (x1 - cx0) * t;\r
-cy1 = cy0 + (y1 - cy0) * t;\r
-cx0 = x0 + (cx0 - x0) * t;\r
-cy0 = y0 + (cy0 - y0) * t;\r
-coords[pos + 2] = x0;\r
-coords[pos + 3] = y0;\r
-coords[pos + 4] = cx0;\r
-coords[pos + 5] = cy0;\r
-coords[pos + 6] = cx0 + (cx1 - cx0) * t;\r
-coords[pos + 7] = cy0 + (cy1 - cy0) * t;\r
-coords[pos + 8] = cx1;\r
-coords[pos + 9] = cy1;\r
-coords[pos + 10] = x1;\r
-coords[pos + 11] = y1;\r
-}, "~A,~N,~N");\r
-Clazz.makeConstructor (c$, \r
-function (x0, y0, cx0, cy0, cx1, cy1, x1, y1, direction) {\r
-Clazz.superConstructor (this, jssun.awt.geom.Order3, [direction]);\r
-if (cy0 < y0) cy0 = y0;\r
-if (cy1 > y1) cy1 = y1;\r
-this.x0 = x0;\r
-this.y0 = y0;\r
-this.cx0 = cx0;\r
-this.cy0 = cy0;\r
-this.cx1 = cx1;\r
-this.cy1 = cy1;\r
-this.x1 = x1;\r
-this.y1 = y1;\r
-this.xmin = Math.min (Math.min (x0, x1), Math.min (cx0, cx1));\r
-this.xmax = Math.max (Math.max (x0, x1), Math.max (cx0, cx1));\r
-this.xcoeff0 = x0;\r
-this.xcoeff1 = (cx0 - x0) * 3.0;\r
-this.xcoeff2 = (cx1 - cx0 - cx0 + x0) * 3.0;\r
-this.xcoeff3 = x1 - (cx1 - cx0) * 3.0 - x0;\r
-this.ycoeff0 = y0;\r
-this.ycoeff1 = (cy0 - y0) * 3.0;\r
-this.ycoeff2 = (cy1 - cy0 - cy0 + y0) * 3.0;\r
-this.ycoeff3 = y1 - (cy1 - cy0) * 3.0 - y0;\r
-this.YforT1 = this.YforT2 = this.YforT3 = y0;\r
-}, "~N,~N,~N,~N,~N,~N,~N,~N,~N");\r
-Clazz.overrideMethod (c$, "getOrder", \r
-function () {\r
-return 3;\r
-});\r
-Clazz.overrideMethod (c$, "getXTop", \r
-function () {\r
-return this.x0;\r
-});\r
-Clazz.overrideMethod (c$, "getYTop", \r
-function () {\r
-return this.y0;\r
-});\r
-Clazz.overrideMethod (c$, "getXBot", \r
-function () {\r
-return this.x1;\r
-});\r
-Clazz.overrideMethod (c$, "getYBot", \r
-function () {\r
-return this.y1;\r
-});\r
-Clazz.overrideMethod (c$, "getXMin", \r
-function () {\r
-return this.xmin;\r
-});\r
-Clazz.overrideMethod (c$, "getXMax", \r
-function () {\r
-return this.xmax;\r
-});\r
-Clazz.overrideMethod (c$, "getX0", \r
-function () {\r
-return (this.direction == 1) ? this.x0 : this.x1;\r
-});\r
-Clazz.overrideMethod (c$, "getY0", \r
-function () {\r
-return (this.direction == 1) ? this.y0 : this.y1;\r
-});\r
-Clazz.defineMethod (c$, "getCX0", \r
-function () {\r
-return (this.direction == 1) ? this.cx0 : this.cx1;\r
-});\r
-Clazz.defineMethod (c$, "getCY0", \r
-function () {\r
-return (this.direction == 1) ? this.cy0 : this.cy1;\r
-});\r
-Clazz.defineMethod (c$, "getCX1", \r
-function () {\r
-return (this.direction == -1) ? this.cx0 : this.cx1;\r
-});\r
-Clazz.defineMethod (c$, "getCY1", \r
-function () {\r
-return (this.direction == -1) ? this.cy0 : this.cy1;\r
-});\r
-Clazz.overrideMethod (c$, "getX1", \r
-function () {\r
-return (this.direction == -1) ? this.x0 : this.x1;\r
-});\r
-Clazz.overrideMethod (c$, "getY1", \r
-function () {\r
-return (this.direction == -1) ? this.y0 : this.y1;\r
-});\r
-Clazz.overrideMethod (c$, "TforY", \r
-function (y) {\r
-if (y <= this.y0) return 0;\r
-if (y >= this.y1) return 1;\r
-if (y == this.YforT1) return this.TforY1;\r
-if (y == this.YforT2) return this.TforY2;\r
-if (y == this.YforT3) return this.TforY3;\r
-if (this.ycoeff3 == 0.0) {\r
-return jssun.awt.geom.Order2.TforY (y, this.ycoeff0, this.ycoeff1, this.ycoeff2);\r
-}var a = this.ycoeff2 / this.ycoeff3;\r
-var b = this.ycoeff1 / this.ycoeff3;\r
-var c = (this.ycoeff0 - y) / this.ycoeff3;\r
-var Q = (a * a - 3.0 * b) / 9.0;\r
-var R = (2.0 * a * a * a - 9.0 * a * b + 27.0 * c) / 54.0;\r
-var R2 = R * R;\r
-var Q3 = Q * Q * Q;\r
-var a_3 = a / 3.0;\r
-var t;\r
-if (R2 < Q3) {\r
-var theta = Math.acos (R / Math.sqrt (Q3));\r
-Q = -2.0 * Math.sqrt (Q);\r
-t = this.refine (a, b, c, y, Q * Math.cos (theta / 3.0) - a_3);\r
-if (t < 0) {\r
-t = this.refine (a, b, c, y, Q * Math.cos ((theta + 6.283185307179586) / 3.0) - a_3);\r
-}if (t < 0) {\r
-t = this.refine (a, b, c, y, Q * Math.cos ((theta - 6.283185307179586) / 3.0) - a_3);\r
-}} else {\r
-var neg = (R < 0.0);\r
-var S = Math.sqrt (R2 - Q3);\r
-if (neg) {\r
-R = -R;\r
-}var A = Math.pow (R + S, 0.3333333333333333);\r
-if (!neg) {\r
-A = -A;\r
-}var B = (A == 0.0) ? 0.0 : (Q / A);\r
-t = this.refine (a, b, c, y, (A + B) - a_3);\r
-}if (t < 0) {\r
-var t0 = 0;\r
-var t1 = 1;\r
-while (true) {\r
-t = (t0 + t1) / 2;\r
-if (t == t0 || t == t1) {\r
-break;\r
-}var yt = this.YforT (t);\r
-if (yt < y) {\r
-t0 = t;\r
-} else if (yt > y) {\r
-t1 = t;\r
-} else {\r
-break;\r
-}}\r
-}if (t >= 0) {\r
-this.TforY3 = this.TforY2;\r
-this.YforT3 = this.YforT2;\r
-this.TforY2 = this.TforY1;\r
-this.YforT2 = this.YforT1;\r
-this.TforY1 = t;\r
-this.YforT1 = y;\r
-}return t;\r
-}, "~N");\r
-Clazz.defineMethod (c$, "refine", \r
-function (a, b, c, target, t) {\r
-if (t < -0.1 || t > 1.1) {\r
-return -1;\r
-}var y = this.YforT (t);\r
-var t0;\r
-var t1;\r
-if (y < target) {\r
-t0 = t;\r
-t1 = 1;\r
-} else {\r
-t0 = 0;\r
-t1 = t;\r
-}var origt = t;\r
-var origy = y;\r
-var useslope = true;\r
-while (y != target) {\r
-if (!useslope) {\r
-var t2 = (t0 + t1) / 2;\r
-if (t2 == t0 || t2 == t1) {\r
-break;\r
-}t = t2;\r
-} else {\r
-var slope = this.dYforT (t, 1);\r
-if (slope == 0) {\r
-useslope = false;\r
-continue;\r
-}var t2 = t + ((target - y) / slope);\r
-if (t2 == t || t2 <= t0 || t2 >= t1) {\r
-useslope = false;\r
-continue;\r
-}t = t2;\r
-}y = this.YforT (t);\r
-if (y < target) {\r
-t0 = t;\r
-} else if (y > target) {\r
-t1 = t;\r
-} else {\r
-break;\r
-}}\r
-var verbose = false;\r
-if (false && t >= 0 && t <= 1) {\r
-y = this.YforT (t);\r
-var tdiff = jssun.awt.geom.Curve.diffbits (t, origt);\r
-var ydiff = jssun.awt.geom.Curve.diffbits (y, origy);\r
-var yerr = jssun.awt.geom.Curve.diffbits (y, target);\r
-if (yerr > 0 || (verbose && tdiff > 0)) {\r
-System.out.println ("target was y = " + target);\r
-System.out.println ("original was y = " + origy + ", t = " + origt);\r
-System.out.println ("final was y = " + y + ", t = " + t);\r
-System.out.println ("t diff is " + tdiff);\r
-System.out.println ("y diff is " + ydiff);\r
-System.out.println ("y error is " + yerr);\r
-var tlow = jssun.awt.geom.Curve.prev (t);\r
-var ylow = this.YforT (tlow);\r
-var thi = jssun.awt.geom.Curve.next (t);\r
-var yhi = this.YforT (thi);\r
-if (Math.abs (target - ylow) < Math.abs (target - y) || Math.abs (target - yhi) < Math.abs (target - y)) {\r
-System.out.println ("adjacent y's = [" + ylow + ", " + yhi + "]");\r
-}}}return (t > 1) ? -1 : t;\r
-}, "~N,~N,~N,~N,~N");\r
-Clazz.overrideMethod (c$, "XforY", \r
-function (y) {\r
-if (y <= this.y0) {\r
-return this.x0;\r
-}if (y >= this.y1) {\r
-return this.x1;\r
-}return this.XforT (this.TforY (y));\r
-}, "~N");\r
-Clazz.overrideMethod (c$, "XforT", \r
-function (t) {\r
-return (((this.xcoeff3 * t) + this.xcoeff2) * t + this.xcoeff1) * t + this.xcoeff0;\r
-}, "~N");\r
-Clazz.overrideMethod (c$, "YforT", \r
-function (t) {\r
-return (((this.ycoeff3 * t) + this.ycoeff2) * t + this.ycoeff1) * t + this.ycoeff0;\r
-}, "~N");\r
-Clazz.overrideMethod (c$, "dXforT", \r
-function (t, deriv) {\r
-switch (deriv) {\r
-case 0:\r
-return (((this.xcoeff3 * t) + this.xcoeff2) * t + this.xcoeff1) * t + this.xcoeff0;\r
-case 1:\r
-return ((3 * this.xcoeff3 * t) + 2 * this.xcoeff2) * t + this.xcoeff1;\r
-case 2:\r
-return (6 * this.xcoeff3 * t) + 2 * this.xcoeff2;\r
-case 3:\r
-return 6 * this.xcoeff3;\r
-default:\r
-return 0;\r
-}\r
-}, "~N,~N");\r
-Clazz.overrideMethod (c$, "dYforT", \r
-function (t, deriv) {\r
-switch (deriv) {\r
-case 0:\r
-return (((this.ycoeff3 * t) + this.ycoeff2) * t + this.ycoeff1) * t + this.ycoeff0;\r
-case 1:\r
-return ((3 * this.ycoeff3 * t) + 2 * this.ycoeff2) * t + this.ycoeff1;\r
-case 2:\r
-return (6 * this.ycoeff3 * t) + 2 * this.ycoeff2;\r
-case 3:\r
-return 6 * this.ycoeff3;\r
-default:\r
-return 0;\r
-}\r
-}, "~N,~N");\r
-Clazz.overrideMethod (c$, "nextVertical", \r
-function (t0, t1) {\r
-var eqn =  Clazz.newDoubleArray (-1, [this.xcoeff1, 2 * this.xcoeff2, 3 * this.xcoeff3]);\r
-var numroots = java.awt.geom.QuadCurve2D.solveQuadratic (eqn, eqn);\r
-for (var i = 0; i < numroots; i++) {\r
-if (eqn[i] > t0 && eqn[i] < t1) {\r
-t1 = eqn[i];\r
-}}\r
-return t1;\r
-}, "~N,~N");\r
-Clazz.overrideMethod (c$, "enlarge", \r
-function (r) {\r
-r.add (this.x0, this.y0);\r
-var eqn =  Clazz.newDoubleArray (-1, [this.xcoeff1, 2 * this.xcoeff2, 3 * this.xcoeff3]);\r
-var numroots = java.awt.geom.QuadCurve2D.solveQuadratic (eqn, eqn);\r
-for (var i = 0; i < numroots; i++) {\r
-var t = eqn[i];\r
-if (t > 0 && t < 1) {\r
-r.add (this.XforT (t), this.YforT (t));\r
-}}\r
-r.add (this.x1, this.y1);\r
-}, "java.awt.geom.Rectangle2D");\r
-Clazz.defineMethod (c$, "getSubCurve", \r
-function (ystart, yend, dir) {\r
-if (ystart <= this.y0 && yend >= this.y1) {\r
-return this.getWithDirection (dir);\r
-}var eqn =  Clazz.newDoubleArray (14, 0);\r
-var t0;\r
-var t1;\r
-t0 = this.TforY (ystart);\r
-t1 = this.TforY (yend);\r
-eqn[0] = this.x0;\r
-eqn[1] = this.y0;\r
-eqn[2] = this.cx0;\r
-eqn[3] = this.cy0;\r
-eqn[4] = this.cx1;\r
-eqn[5] = this.cy1;\r
-eqn[6] = this.x1;\r
-eqn[7] = this.y1;\r
-if (t0 > t1) {\r
-var t = t0;\r
-t0 = t1;\r
-t1 = t;\r
-}if (t1 < 1) {\r
-jssun.awt.geom.Order3.split (eqn, 0, t1);\r
-}var i;\r
-if (t0 <= 0) {\r
-i = 0;\r
-} else {\r
-jssun.awt.geom.Order3.split (eqn, 0, t0 / t1);\r
-i = 6;\r
-}return  new jssun.awt.geom.Order3 (eqn[i + 0], ystart, eqn[i + 2], eqn[i + 3], eqn[i + 4], eqn[i + 5], eqn[i + 6], yend, dir);\r
-}, "~N,~N,~N");\r
-Clazz.overrideMethod (c$, "getReversedCurve", \r
-function () {\r
-return  new jssun.awt.geom.Order3 (this.x0, this.y0, this.cx0, this.cy0, this.cx1, this.cy1, this.x1, this.y1, -this.direction);\r
-});\r
-Clazz.overrideMethod (c$, "getSegment", \r
-function (coords) {\r
-if (this.direction == 1) {\r
-coords[0] = this.cx0;\r
-coords[1] = this.cy0;\r
-coords[2] = this.cx1;\r
-coords[3] = this.cy1;\r
-coords[4] = this.x1;\r
-coords[5] = this.y1;\r
-} else {\r
-coords[0] = this.cx1;\r
-coords[1] = this.cy1;\r
-coords[2] = this.cx0;\r
-coords[3] = this.cy0;\r
-coords[4] = this.x0;\r
-coords[5] = this.y0;\r
-}return 3;\r
-}, "~A");\r
-Clazz.overrideMethod (c$, "controlPointString", \r
-function () {\r
-return (("(" + jssun.awt.geom.Curve.round (this.getCX0 ()) + ", " + jssun.awt.geom.Curve.round (this.getCY0 ()) + "), ") + ("(" + jssun.awt.geom.Curve.round (this.getCX1 ()) + ", " + jssun.awt.geom.Curve.round (this.getCY1 ()) + "), "));\r
-});\r
-});\r
+Clazz.declarePackage ("jssun.awt.geom");
+Clazz.load (["jssun.awt.geom.Curve"], "jssun.awt.geom.Order3", ["java.awt.geom.QuadCurve2D", "jssun.awt.geom.Order2"], function () {
+c$ = Clazz.decorateAsClass (function () {
+this.x0 = 0;
+this.y0 = 0;
+this.cx0 = 0;
+this.cy0 = 0;
+this.cx1 = 0;
+this.cy1 = 0;
+this.x1 = 0;
+this.y1 = 0;
+this.xmin = 0;
+this.xmax = 0;
+this.xcoeff0 = 0;
+this.xcoeff1 = 0;
+this.xcoeff2 = 0;
+this.xcoeff3 = 0;
+this.ycoeff0 = 0;
+this.ycoeff1 = 0;
+this.ycoeff2 = 0;
+this.ycoeff3 = 0;
+this.TforY1 = 0;
+this.YforT1 = 0;
+this.TforY2 = 0;
+this.YforT2 = 0;
+this.TforY3 = 0;
+this.YforT3 = 0;
+Clazz.instantialize (this, arguments);
+}, jssun.awt.geom, "Order3", jssun.awt.geom.Curve);
+c$.insert = Clazz.defineMethod (c$, "insert", 
+function (curves, tmp, x0, y0, cx0, cy0, cx1, cy1, x1, y1, direction) {
+var numparams = jssun.awt.geom.Order3.getHorizontalParams (y0, cy0, cy1, y1, tmp);
+if (numparams == 0) {
+jssun.awt.geom.Order3.addInstance (curves, x0, y0, cx0, cy0, cx1, cy1, x1, y1, direction);
+return;
+}tmp[3] = x0;
+tmp[4] = y0;
+tmp[5] = cx0;
+tmp[6] = cy0;
+tmp[7] = cx1;
+tmp[8] = cy1;
+tmp[9] = x1;
+tmp[10] = y1;
+var t = tmp[0];
+if (numparams > 1 && t > tmp[1]) {
+tmp[0] = tmp[1];
+tmp[1] = t;
+t = tmp[0];
+}jssun.awt.geom.Order3.split (tmp, 3, t);
+if (numparams > 1) {
+t = (tmp[1] - t) / (1 - t);
+jssun.awt.geom.Order3.split (tmp, 9, t);
+}var index = 3;
+if (direction == -1) {
+index += numparams * 6;
+}while (numparams >= 0) {
+jssun.awt.geom.Order3.addInstance (curves, tmp[index + 0], tmp[index + 1], tmp[index + 2], tmp[index + 3], tmp[index + 4], tmp[index + 5], tmp[index + 6], tmp[index + 7], direction);
+numparams--;
+if (direction == 1) {
+index += 6;
+} else {
+index -= 6;
+}}
+}, "java.util.Vector,~A,~N,~N,~N,~N,~N,~N,~N,~N,~N");
+c$.addInstance = Clazz.defineMethod (c$, "addInstance", 
+function (curves, x0, y0, cx0, cy0, cx1, cy1, x1, y1, direction) {
+if (y0 > y1) {
+curves.add ( new jssun.awt.geom.Order3 (x1, y1, cx1, cy1, cx0, cy0, x0, y0, -direction));
+} else if (y1 > y0) {
+curves.add ( new jssun.awt.geom.Order3 (x0, y0, cx0, cy0, cx1, cy1, x1, y1, direction));
+}}, "java.util.Vector,~N,~N,~N,~N,~N,~N,~N,~N,~N");
+c$.getHorizontalParams = Clazz.defineMethod (c$, "getHorizontalParams", 
+function (c0, cp0, cp1, c1, ret) {
+if (c0 <= cp0 && cp0 <= cp1 && cp1 <= c1) {
+return 0;
+}c1 -= cp1;
+cp1 -= cp0;
+cp0 -= c0;
+ret[0] = cp0;
+ret[1] = (cp1 - cp0) * 2;
+ret[2] = (c1 - cp1 - cp1 + cp0);
+var numroots = java.awt.geom.QuadCurve2D.solveQuadratic (ret, ret);
+var j = 0;
+for (var i = 0; i < numroots; i++) {
+var t = ret[i];
+if (t > 0 && t < 1) {
+if (j < i) {
+ret[j] = t;
+}j++;
+}}
+return j;
+}, "~N,~N,~N,~N,~A");
+c$.split = Clazz.defineMethod (c$, "split", 
+function (coords, pos, t) {
+var x0;
+var y0;
+var cx0;
+var cy0;
+var cx1;
+var cy1;
+var x1;
+var y1;
+coords[pos + 12] = x1 = coords[pos + 6];
+coords[pos + 13] = y1 = coords[pos + 7];
+cx1 = coords[pos + 4];
+cy1 = coords[pos + 5];
+x1 = cx1 + (x1 - cx1) * t;
+y1 = cy1 + (y1 - cy1) * t;
+x0 = coords[pos + 0];
+y0 = coords[pos + 1];
+cx0 = coords[pos + 2];
+cy0 = coords[pos + 3];
+x0 = x0 + (cx0 - x0) * t;
+y0 = y0 + (cy0 - y0) * t;
+cx0 = cx0 + (cx1 - cx0) * t;
+cy0 = cy0 + (cy1 - cy0) * t;
+cx1 = cx0 + (x1 - cx0) * t;
+cy1 = cy0 + (y1 - cy0) * t;
+cx0 = x0 + (cx0 - x0) * t;
+cy0 = y0 + (cy0 - y0) * t;
+coords[pos + 2] = x0;
+coords[pos + 3] = y0;
+coords[pos + 4] = cx0;
+coords[pos + 5] = cy0;
+coords[pos + 6] = cx0 + (cx1 - cx0) * t;
+coords[pos + 7] = cy0 + (cy1 - cy0) * t;
+coords[pos + 8] = cx1;
+coords[pos + 9] = cy1;
+coords[pos + 10] = x1;
+coords[pos + 11] = y1;
+}, "~A,~N,~N");
+Clazz.makeConstructor (c$, 
+function (x0, y0, cx0, cy0, cx1, cy1, x1, y1, direction) {
+Clazz.superConstructor (this, jssun.awt.geom.Order3, [direction]);
+if (cy0 < y0) cy0 = y0;
+if (cy1 > y1) cy1 = y1;
+this.x0 = x0;
+this.y0 = y0;
+this.cx0 = cx0;
+this.cy0 = cy0;
+this.cx1 = cx1;
+this.cy1 = cy1;
+this.x1 = x1;
+this.y1 = y1;
+this.xmin = Math.min (Math.min (x0, x1), Math.min (cx0, cx1));
+this.xmax = Math.max (Math.max (x0, x1), Math.max (cx0, cx1));
+this.xcoeff0 = x0;
+this.xcoeff1 = (cx0 - x0) * 3.0;
+this.xcoeff2 = (cx1 - cx0 - cx0 + x0) * 3.0;
+this.xcoeff3 = x1 - (cx1 - cx0) * 3.0 - x0;
+this.ycoeff0 = y0;
+this.ycoeff1 = (cy0 - y0) * 3.0;
+this.ycoeff2 = (cy1 - cy0 - cy0 + y0) * 3.0;
+this.ycoeff3 = y1 - (cy1 - cy0) * 3.0 - y0;
+this.YforT1 = this.YforT2 = this.YforT3 = y0;
+}, "~N,~N,~N,~N,~N,~N,~N,~N,~N");
+Clazz.overrideMethod (c$, "getOrder", 
+function () {
+return 3;
+});
+Clazz.overrideMethod (c$, "getXTop", 
+function () {
+return this.x0;
+});
+Clazz.overrideMethod (c$, "getYTop", 
+function () {
+return this.y0;
+});
+Clazz.overrideMethod (c$, "getXBot", 
+function () {
+return this.x1;
+});
+Clazz.overrideMethod (c$, "getYBot", 
+function () {
+return this.y1;
+});
+Clazz.overrideMethod (c$, "getXMin", 
+function () {
+return this.xmin;
+});
+Clazz.overrideMethod (c$, "getXMax", 
+function () {
+return this.xmax;
+});
+Clazz.overrideMethod (c$, "getX0", 
+function () {
+return (this.direction == 1) ? this.x0 : this.x1;
+});
+Clazz.overrideMethod (c$, "getY0", 
+function () {
+return (this.direction == 1) ? this.y0 : this.y1;
+});
+Clazz.defineMethod (c$, "getCX0", 
+function () {
+return (this.direction == 1) ? this.cx0 : this.cx1;
+});
+Clazz.defineMethod (c$, "getCY0", 
+function () {
+return (this.direction == 1) ? this.cy0 : this.cy1;
+});
+Clazz.defineMethod (c$, "getCX1", 
+function () {
+return (this.direction == -1) ? this.cx0 : this.cx1;
+});
+Clazz.defineMethod (c$, "getCY1", 
+function () {
+return (this.direction == -1) ? this.cy0 : this.cy1;
+});
+Clazz.overrideMethod (c$, "getX1", 
+function () {
+return (this.direction == -1) ? this.x0 : this.x1;
+});
+Clazz.overrideMethod (c$, "getY1", 
+function () {
+return (this.direction == -1) ? this.y0 : this.y1;
+});
+Clazz.overrideMethod (c$, "TforY", 
+function (y) {
+if (y <= this.y0) return 0;
+if (y >= this.y1) return 1;
+if (y == this.YforT1) return this.TforY1;
+if (y == this.YforT2) return this.TforY2;
+if (y == this.YforT3) return this.TforY3;
+if (this.ycoeff3 == 0.0) {
+return jssun.awt.geom.Order2.TforY (y, this.ycoeff0, this.ycoeff1, this.ycoeff2);
+}var a = this.ycoeff2 / this.ycoeff3;
+var b = this.ycoeff1 / this.ycoeff3;
+var c = (this.ycoeff0 - y) / this.ycoeff3;
+var Q = (a * a - 3.0 * b) / 9.0;
+var R = (2.0 * a * a * a - 9.0 * a * b + 27.0 * c) / 54.0;
+var R2 = R * R;
+var Q3 = Q * Q * Q;
+var a_3 = a / 3.0;
+var t;
+if (R2 < Q3) {
+var theta = Math.acos (R / Math.sqrt (Q3));
+Q = -2.0 * Math.sqrt (Q);
+t = this.refine (a, b, c, y, Q * Math.cos (theta / 3.0) - a_3);
+if (t < 0) {
+t = this.refine (a, b, c, y, Q * Math.cos ((theta + 6.283185307179586) / 3.0) - a_3);
+}if (t < 0) {
+t = this.refine (a, b, c, y, Q * Math.cos ((theta - 6.283185307179586) / 3.0) - a_3);
+}} else {
+var neg = (R < 0.0);
+var S = Math.sqrt (R2 - Q3);
+if (neg) {
+R = -R;
+}var A = Math.pow (R + S, 0.3333333333333333);
+if (!neg) {
+A = -A;
+}var B = (A == 0.0) ? 0.0 : (Q / A);
+t = this.refine (a, b, c, y, (A + B) - a_3);
+}if (t < 0) {
+var t0 = 0;
+var t1 = 1;
+while (true) {
+t = (t0 + t1) / 2;
+if (t == t0 || t == t1) {
+break;
+}var yt = this.YforT (t);
+if (yt < y) {
+t0 = t;
+} else if (yt > y) {
+t1 = t;
+} else {
+break;
+}}
+}if (t >= 0) {
+this.TforY3 = this.TforY2;
+this.YforT3 = this.YforT2;
+this.TforY2 = this.TforY1;
+this.YforT2 = this.YforT1;
+this.TforY1 = t;
+this.YforT1 = y;
+}return t;
+}, "~N");
+Clazz.defineMethod (c$, "refine", 
+function (a, b, c, target, t) {
+if (t < -0.1 || t > 1.1) {
+return -1;
+}var y = this.YforT (t);
+var t0;
+var t1;
+if (y < target) {
+t0 = t;
+t1 = 1;
+} else {
+t0 = 0;
+t1 = t;
+}var origt = t;
+var origy = y;
+var useslope = true;
+while (y != target) {
+if (!useslope) {
+var t2 = (t0 + t1) / 2;
+if (t2 == t0 || t2 == t1) {
+break;
+}t = t2;
+} else {
+var slope = this.dYforT (t, 1);
+if (slope == 0) {
+useslope = false;
+continue;
+}var t2 = t + ((target - y) / slope);
+if (t2 == t || t2 <= t0 || t2 >= t1) {
+useslope = false;
+continue;
+}t = t2;
+}y = this.YforT (t);
+if (y < target) {
+t0 = t;
+} else if (y > target) {
+t1 = t;
+} else {
+break;
+}}
+var verbose = false;
+if (false && t >= 0 && t <= 1) {
+y = this.YforT (t);
+var tdiff = jssun.awt.geom.Curve.diffbits (t, origt);
+var ydiff = jssun.awt.geom.Curve.diffbits (y, origy);
+var yerr = jssun.awt.geom.Curve.diffbits (y, target);
+if (yerr > 0 || (verbose && tdiff > 0)) {
+System.out.println ("target was y = " + target);
+System.out.println ("original was y = " + origy + ", t = " + origt);
+System.out.println ("final was y = " + y + ", t = " + t);
+System.out.println ("t diff is " + tdiff);
+System.out.println ("y diff is " + ydiff);
+System.out.println ("y error is " + yerr);
+var tlow = jssun.awt.geom.Curve.prev (t);
+var ylow = this.YforT (tlow);
+var thi = jssun.awt.geom.Curve.next (t);
+var yhi = this.YforT (thi);
+if (Math.abs (target - ylow) < Math.abs (target - y) || Math.abs (target - yhi) < Math.abs (target - y)) {
+System.out.println ("adjacent y's = [" + ylow + ", " + yhi + "]");
+}}}return (t > 1) ? -1 : t;
+}, "~N,~N,~N,~N,~N");
+Clazz.overrideMethod (c$, "XforY", 
+function (y) {
+if (y <= this.y0) {
+return this.x0;
+}if (y >= this.y1) {
+return this.x1;
+}return this.XforT (this.TforY (y));
+}, "~N");
+Clazz.overrideMethod (c$, "XforT", 
+function (t) {
+return (((this.xcoeff3 * t) + this.xcoeff2) * t + this.xcoeff1) * t + this.xcoeff0;
+}, "~N");
+Clazz.overrideMethod (c$, "YforT", 
+function (t) {
+return (((this.ycoeff3 * t) + this.ycoeff2) * t + this.ycoeff1) * t + this.ycoeff0;
+}, "~N");
+Clazz.overrideMethod (c$, "dXforT", 
+function (t, deriv) {
+switch (deriv) {
+case 0:
+return (((this.xcoeff3 * t) + this.xcoeff2) * t + this.xcoeff1) * t + this.xcoeff0;
+case 1:
+return ((3 * this.xcoeff3 * t) + 2 * this.xcoeff2) * t + this.xcoeff1;
+case 2:
+return (6 * this.xcoeff3 * t) + 2 * this.xcoeff2;
+case 3:
+return 6 * this.xcoeff3;
+default:
+return 0;
+}
+}, "~N,~N");
+Clazz.overrideMethod (c$, "dYforT", 
+function (t, deriv) {
+switch (deriv) {
+case 0:
+return (((this.ycoeff3 * t) + this.ycoeff2) * t + this.ycoeff1) * t + this.ycoeff0;
+case 1:
+return ((3 * this.ycoeff3 * t) + 2 * this.ycoeff2) * t + this.ycoeff1;
+case 2:
+return (6 * this.ycoeff3 * t) + 2 * this.ycoeff2;
+case 3:
+return 6 * this.ycoeff3;
+default:
+return 0;
+}
+}, "~N,~N");
+Clazz.overrideMethod (c$, "nextVertical", 
+function (t0, t1) {
+var eqn =  Clazz.newDoubleArray (-1, [this.xcoeff1, 2 * this.xcoeff2, 3 * this.xcoeff3]);
+var numroots = java.awt.geom.QuadCurve2D.solveQuadratic (eqn, eqn);
+for (var i = 0; i < numroots; i++) {
+if (eqn[i] > t0 && eqn[i] < t1) {
+t1 = eqn[i];
+}}
+return t1;
+}, "~N,~N");
+Clazz.overrideMethod (c$, "enlarge", 
+function (r) {
+r.add (this.x0, this.y0);
+var eqn =  Clazz.newDoubleArray (-1, [this.xcoeff1, 2 * this.xcoeff2, 3 * this.xcoeff3]);
+var numroots = java.awt.geom.QuadCurve2D.solveQuadratic (eqn, eqn);
+for (var i = 0; i < numroots; i++) {
+var t = eqn[i];
+if (t > 0 && t < 1) {
+r.add (this.XforT (t), this.YforT (t));
+}}
+r.add (this.x1, this.y1);
+}, "java.awt.geom.Rectangle2D");
+Clazz.defineMethod (c$, "getSubCurve", 
+function (ystart, yend, dir) {
+if (ystart <= this.y0 && yend >= this.y1) {
+return this.getWithDirection (dir);
+}var eqn =  Clazz.newDoubleArray (14, 0);
+var t0;
+var t1;
+t0 = this.TforY (ystart);
+t1 = this.TforY (yend);
+eqn[0] = this.x0;
+eqn[1] = this.y0;
+eqn[2] = this.cx0;
+eqn[3] = this.cy0;
+eqn[4] = this.cx1;
+eqn[5] = this.cy1;
+eqn[6] = this.x1;
+eqn[7] = this.y1;
+if (t0 > t1) {
+var t = t0;
+t0 = t1;
+t1 = t;
+}if (t1 < 1) {
+jssun.awt.geom.Order3.split (eqn, 0, t1);
+}var i;
+if (t0 <= 0) {
+i = 0;
+} else {
+jssun.awt.geom.Order3.split (eqn, 0, t0 / t1);
+i = 6;
+}return  new jssun.awt.geom.Order3 (eqn[i + 0], ystart, eqn[i + 2], eqn[i + 3], eqn[i + 4], eqn[i + 5], eqn[i + 6], yend, dir);
+}, "~N,~N,~N");
+Clazz.overrideMethod (c$, "getReversedCurve", 
+function () {
+return  new jssun.awt.geom.Order3 (this.x0, this.y0, this.cx0, this.cy0, this.cx1, this.cy1, this.x1, this.y1, -this.direction);
+});
+Clazz.overrideMethod (c$, "getSegment", 
+function (coords) {
+if (this.direction == 1) {
+coords[0] = this.cx0;
+coords[1] = this.cy0;
+coords[2] = this.cx1;
+coords[3] = this.cy1;
+coords[4] = this.x1;
+coords[5] = this.y1;
+} else {
+coords[0] = this.cx1;
+coords[1] = this.cy1;
+coords[2] = this.cx0;
+coords[3] = this.cy0;
+coords[4] = this.x0;
+coords[5] = this.y0;
+}return 3;
+}, "~A");
+Clazz.overrideMethod (c$, "controlPointString", 
+function () {
+return (("(" + jssun.awt.geom.Curve.round (this.getCX0 ()) + ", " + jssun.awt.geom.Curve.round (this.getCY0 ()) + "), ") + ("(" + jssun.awt.geom.Curve.round (this.getCX1 ()) + ", " + jssun.awt.geom.Curve.round (this.getCY1 ()) + "), "));
+});
+});