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