1 Clazz.declarePackage ("jssun.awt.geom");
2 Clazz.load (["jssun.awt.geom.Curve"], "jssun.awt.geom.Order1", ["java.lang.InternalError"], function () {
3 c$ = Clazz.decorateAsClass (function () {
10 Clazz.instantialize (this, arguments);
11 }, jssun.awt.geom, "Order1", jssun.awt.geom.Curve);
12 Clazz.makeConstructor (c$,
13 function (x0, y0, x1, y1, direction) {
14 Clazz.superConstructor (this, jssun.awt.geom.Order1, [direction]);
25 }}, "~N,~N,~N,~N,~N");
26 Clazz.overrideMethod (c$, "getOrder",
30 Clazz.overrideMethod (c$, "getXTop",
34 Clazz.overrideMethod (c$, "getYTop",
38 Clazz.overrideMethod (c$, "getXBot",
42 Clazz.overrideMethod (c$, "getYBot",
46 Clazz.overrideMethod (c$, "getXMin",
50 Clazz.overrideMethod (c$, "getXMax",
54 Clazz.overrideMethod (c$, "getX0",
56 return (this.direction == 1) ? this.x0 : this.x1;
58 Clazz.overrideMethod (c$, "getY0",
60 return (this.direction == 1) ? this.y0 : this.y1;
62 Clazz.overrideMethod (c$, "getX1",
64 return (this.direction == -1) ? this.x0 : this.x1;
66 Clazz.overrideMethod (c$, "getY1",
68 return (this.direction == -1) ? this.y0 : this.y1;
70 Clazz.overrideMethod (c$, "XforY",
72 if (this.x0 == this.x1 || y <= this.y0) {
76 }return (this.x0 + (y - this.y0) * (this.x1 - this.x0) / (this.y1 - this.y0));
78 Clazz.overrideMethod (c$, "TforY",
84 }return (y - this.y0) / (this.y1 - this.y0);
86 Clazz.overrideMethod (c$, "XforT",
88 return this.x0 + t * (this.x1 - this.x0);
90 Clazz.overrideMethod (c$, "YforT",
92 return this.y0 + t * (this.y1 - this.y0);
94 Clazz.overrideMethod (c$, "dXforT",
98 return this.x0 + t * (this.x1 - this.x0);
100 return (this.x1 - this.x0);
105 Clazz.overrideMethod (c$, "dYforT",
106 function (t, deriv) {
109 return this.y0 + t * (this.y1 - this.y0);
111 return (this.y1 - this.y0);
116 Clazz.overrideMethod (c$, "nextVertical",
120 Clazz.overrideMethod (c$, "accumulateCrossings",
122 var xlo = c.getXLo ();
123 var ylo = c.getYLo ();
124 var xhi = c.getXHi ();
125 var yhi = c.getYHi ();
126 if (this.xmin >= xhi) {
133 if (this.y1 <= ylo) {
136 xstart = this.XforY (ylo);
138 if (this.y0 >= yhi) {
142 }if (this.y1 > yhi) {
144 xend = this.XforY (yhi);
148 }if (xstart >= xhi && xend >= xhi) {
150 }if (xstart > xlo || xend > xlo) {
152 }c.record (ystart, yend, this.direction);
154 }, "jssun.awt.geom.Crossings");
155 Clazz.overrideMethod (c$, "enlarge",
157 r.add (this.x0, this.y0);
158 r.add (this.x1, this.y1);
159 }, "java.awt.geom.Rectangle2D");
160 Clazz.defineMethod (c$, "getSubCurve",
161 function (ystart, yend, dir) {
162 if (ystart == this.y0 && yend == this.y1) {
163 return this.getWithDirection (dir);
164 }if (this.x0 == this.x1) {
165 return new jssun.awt.geom.Order1 (this.x0, ystart, this.x1, yend, dir);
166 }var num = this.x0 - this.x1;
167 var denom = this.y0 - this.y1;
168 var xstart = (this.x0 + (ystart - this.y0) * num / denom);
169 var xend = (this.x0 + (yend - this.y0) * num / denom);
170 return new jssun.awt.geom.Order1 (xstart, ystart, xend, yend, dir);
172 Clazz.overrideMethod (c$, "getReversedCurve",
174 return new jssun.awt.geom.Order1 (this.x0, this.y0, this.x1, this.y1, -this.direction);
176 Clazz.defineMethod (c$, "compareTo",
177 function (other, yrange) {
178 if (!(Clazz.instanceOf (other, jssun.awt.geom.Order1))) {
179 return Clazz.superCall (this, jssun.awt.geom.Order1, "compareTo", [other, yrange]);
181 if (yrange[1] <= yrange[0]) {
182 throw new InternalError ("yrange already screwed up...");
183 }yrange[1] = Math.min (Math.min (yrange[1], this.y1), c1.y1);
184 if (yrange[1] <= yrange[0]) {
185 throw new InternalError ("backstepping from " + yrange[0] + " to " + yrange[1]);
186 }if (this.xmax <= c1.xmin) {
187 return (this.xmin == c1.xmax) ? 0 : -1;
188 }if (this.xmin >= c1.xmax) {
190 }var dxa = this.x1 - this.x0;
191 var dya = this.y1 - this.y0;
192 var dxb = c1.x1 - c1.x0;
193 var dyb = c1.y1 - c1.y0;
194 var denom = dxb * dya - dxa * dyb;
197 var num = ((this.x0 - c1.x0) * dya * dyb - this.y0 * dxa * dyb + c1.y0 * dxb * dya);
199 if (y <= yrange[0]) {
200 y = Math.min (this.y1, c1.y1);
204 }y = Math.max (this.y0, c1.y0);
206 y = Math.max (this.y0, c1.y0);
207 }return jssun.awt.geom.Curve.orderof (this.XforY (y), c1.XforY (y));
208 }, "jssun.awt.geom.Curve,~A");
209 Clazz.overrideMethod (c$, "getSegment",
211 if (this.direction == 1) {