Mercurial > dive4elements > river
comparison flys-artifacts/src/main/java/de/intevation/flys/jfree/StableXYDifferenceRenderer.java @ 4704:115afdaf3e85
Changed naming of variables (i & j -> i & k) for readability.
author | Felix Wolfsteller <felix.wolfsteller@intevation.de> |
---|---|
date | Wed, 19 Dec 2012 11:35:51 +0100 |
parents | 22cd60315e08 |
children |
comparison
equal
deleted
inserted
replaced
4703:38ec171544de | 4704:115afdaf3e85 |
---|---|
1585 | 1585 |
1586 public static double calculateArea(Object [] xValues, Object [] yValues) { | 1586 public static double calculateArea(Object [] xValues, Object [] yValues) { |
1587 double area = 0d; | 1587 double area = 0d; |
1588 | 1588 |
1589 for (int i = 0, N = xValues.length; i < N; ++i) { | 1589 for (int i = 0, N = xValues.length; i < N; ++i) { |
1590 int j = (i + 1) % N; | 1590 int k = (i + 1) % N; |
1591 double xi = ((Double)xValues[i]).doubleValue(); | 1591 double xi = ((Double)xValues[i]).doubleValue(); |
1592 double yi = ((Double)yValues[i]).doubleValue(); | 1592 double yi = ((Double)yValues[i]).doubleValue(); |
1593 double xj = ((Double)xValues[j]).doubleValue(); | 1593 double xk = ((Double)xValues[k]).doubleValue(); |
1594 double yj = ((Double)yValues[j]).doubleValue(); | 1594 double yk = ((Double)yValues[k]).doubleValue(); |
1595 | 1595 |
1596 area += xi*yj; | 1596 area += xi*yk; |
1597 area -= xj*yi; | 1597 area -= xk*yi; |
1598 // TODO centroid calculation here? | 1598 // TODO centroid calculation here? |
1599 } | 1599 } |
1600 | 1600 |
1601 return 0.5d*area; | 1601 return 0.5d*area; |
1602 } | 1602 } |