Mercurial > dive4elements > river
comparison flys-artifacts/src/main/java/de/intevation/flys/artifacts/geom/VectorUtils.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 |
---|---|
52 } | 52 } |
53 | 53 |
54 public static final Point2D normalize(Point2D a) { | 54 public static final Point2D normalize(Point2D a) { |
55 double length = length(a); | 55 double length = length(a); |
56 return length != 0d | 56 return length != 0d |
57 ? scale(a, 1d/length) | 57 ? scale(a, 1d/length) |
58 : new Point2D.Double(X(a), Y(a)); | 58 : new Point2D.Double(X(a), Y(a)); |
59 } | 59 } |
60 | 60 |
61 public static final double L1(Point2D a, Point2D b) { | 61 public static final double L1(Point2D a, Point2D b) { |
62 return Math.abs(X(a)-X(b)) + Math.abs(Y(a)-Y(b)); | 62 return Math.abs(X(a)-X(b)) + Math.abs(Y(a)-Y(b)); |
72 | 72 |
73 return Math.abs((x2-x1)*(y3-y1)-(y2-y1)*(x3-x1)) < EPSILON; | 73 return Math.abs((x2-x1)*(y3-y1)-(y2-y1)*(x3-x1)) < EPSILON; |
74 } | 74 } |
75 | 75 |
76 public static boolean epsilonEquals(Point2D a, Point2D b) { | 76 public static boolean epsilonEquals(Point2D a, Point2D b) { |
77 return Math.abs(X(a)-X(b)) < EPSILON | 77 return Math.abs(X(a)-X(b)) < EPSILON |
78 && Math.abs(Y(a)-Y(b)) < EPSILON; | 78 && Math.abs(Y(a)-Y(b)) < EPSILON; |
79 } | 79 } |
80 | 80 |
81 public static final Point2D intersection( | 81 public static final Point2D intersection( |
82 Point2D p1, Point2D p2, | 82 Point2D p1, Point2D p2, |
144 | 144 |
145 return new Point2D.Double(x, y); | 145 return new Point2D.Double(x, y); |
146 } | 146 } |
147 | 147 |
148 } | 148 } |
149 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 : | 149 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 : |