Mercurial > dive4elements > river
comparison flys-artifacts/src/main/java/de/intevation/flys/artifacts/geom/Polygon2D.java @ 3076:5642a83420f2
FLYS artifacts: Removed trailing whitespace.
flys-artifacts/trunk@4670 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author | Sascha L. Teichmann <sascha.teichmann@intevation.de> |
---|---|
date | Fri, 15 Jun 2012 09:30:07 +0000 |
parents | 6f83d9d434f2 |
children | ed07dd55f487 |
comparison
equal
deleted
inserted
replaced
3075:db9e2bb34707 | 3076:5642a83420f2 |
---|---|
249 Line line = new Line(); | 249 Line line = new Line(); |
250 | 250 |
251 while (ai < as.length && bi < bs.length) { | 251 while (ai < as.length && bi < bs.length) { |
252 double xan = X(as[ai]); | 252 double xan = X(as[ai]); |
253 double xbn = X(bs[bi]); | 253 double xbn = X(bs[bi]); |
254 if (xan == xbn) { | 254 if (xan == xbn) { |
255 double yan = Y(as[ai]); | 255 double yan = Y(as[ai]); |
256 double ybn = Y(bs[ai]); | 256 double ybn = Y(bs[ai]); |
257 | 257 |
258 if (neg) { | 258 if (neg) { |
259 if (yan > ybn) { // intersection | 259 if (yan > ybn) { // intersection |
303 ++bi; | 303 ++bi; |
304 } | 304 } |
305 else if (xan > xbn) { | 305 else if (xan > xbn) { |
306 line.set(apoints.get(apoints.size()-1), as[ai]); | 306 line.set(apoints.get(apoints.size()-1), as[ai]); |
307 double dir = neg ? -1d: 1d; // XXX: correct sign? | 307 double dir = neg ? -1d: 1d; // XXX: correct sign? |
308 while (bi < bs.length | 308 while (bi < bs.length |
309 && X(bs[bi]) < xan | 309 && X(bs[bi]) < xan |
310 && line.eval(bs[bi])*dir > EPSILON) | 310 && line.eval(bs[bi])*dir > EPSILON) |
311 ++bi; | 311 ++bi; |
312 if (bi == bs.length) { | 312 if (bi == bs.length) { |
313 // b run out of points | 313 // b run out of points |
314 // calculate Y(last_a, as[ai]) for X(bs[bi-1]) | 314 // calculate Y(last_a, as[ai]) for X(bs[bi-1]) |
315 double ay1 = Linear.linear( | 315 double ay1 = Linear.linear( |
351 public Line(Point2D p1, Point2D p2) { | 351 public Line(Point2D p1, Point2D p2) { |
352 set(p1, p2); | 352 set(p1, p2); |
353 } | 353 } |
354 | 354 |
355 public void set(Point2D p1, Point2D p2) { | 355 public void set(Point2D p1, Point2D p2) { |
356 Point2D p3 = | 356 Point2D p3 = |
357 VectorUtils.normalize( | 357 VectorUtils.normalize( |
358 VectorUtils.sub(p1, p2)); | 358 VectorUtils.sub(p1, p2)); |
359 | 359 |
360 Point2D n = VectorUtils.ortho(p3); | 360 Point2D n = VectorUtils.ortho(p3); |
361 | 361 |
413 Point2D [] p2 = splBs.get(splBs.size()-1); | 413 Point2D [] p2 = splBs.get(splBs.size()-1); |
414 | 414 |
415 // Sort out the ranges that are not intersecting | 415 // Sort out the ranges that are not intersecting |
416 // the ranges in the other series. | 416 // the ranges in the other series. |
417 // We are going to merge them anyway | 417 // We are going to merge them anyway |
418 // so this is not strictly required. | 418 // so this is not strictly required. |
419 // Keep it to recude cases. | 419 // Keep it to recude cases. |
420 if (removeNoneIntersecting(splAs, splBs) | 420 if (removeNoneIntersecting(splAs, splBs) |
421 || removeNoneIntersecting(splBs, splAs) | 421 || removeNoneIntersecting(splBs, splAs) |
422 ) { | 422 ) { |
423 // They do not intersect at all. | 423 // They do not intersect at all. |