Skip to content

Commit

Permalink
Correct use of xy array
Browse files Browse the repository at this point in the history
  • Loading branch information
bjornharrtell committed Jan 21, 2021
1 parent ee085ea commit 6ea7a4b
Showing 1 changed file with 4 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -464,9 +464,8 @@ public Double2(Coordinate[] coordinates, int dimension, int measures) {

xy = new double[coordinates.length];
for (int i = 0; i < coordinates.length; i++) {
int offset = i * 2;
xy[offset] = coordinates[i].x;
xy[offset + 1] = coordinates[i].y;
xy[i * 2] = coordinates[i].x;
xy[i * 2 + 1] = coordinates[i].y;
if (dimension == 3)
z[i] = coordinates[i].getOrdinate(2);
if (measures == 1)
Expand Down Expand Up @@ -502,8 +501,8 @@ public Double2(int size, int dimension, int measures) {
* @see PackedCoordinateSequence#getCoordinate(int)
*/
public Coordinate getCoordinateInternal(int i) {
double x = xy[i * dimension];
double y = xy[i * dimension + 1];
double x = xy[i * 2];
double y = xy[i * 2 + 1];
if( dimension == 2 && measures == 0 ) {
return new CoordinateXY(x,y);
}
Expand Down

0 comments on commit 6ea7a4b

Please sign in to comment.