Skip to content

Commit 6ea7a4b

Browse files
committed
Correct use of xy array
1 parent ee085ea commit 6ea7a4b

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

modules/core/src/main/java/org/locationtech/jts/geom/impl/PackedCoordinateSequence.java

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -464,9 +464,8 @@ public Double2(Coordinate[] coordinates, int dimension, int measures) {
464464

465465
xy = new double[coordinates.length];
466466
for (int i = 0; i < coordinates.length; i++) {
467-
int offset = i * 2;
468-
xy[offset] = coordinates[i].x;
469-
xy[offset + 1] = coordinates[i].y;
467+
xy[i * 2] = coordinates[i].x;
468+
xy[i * 2 + 1] = coordinates[i].y;
470469
if (dimension == 3)
471470
z[i] = coordinates[i].getOrdinate(2);
472471
if (measures == 1)
@@ -502,8 +501,8 @@ public Double2(int size, int dimension, int measures) {
502501
* @see PackedCoordinateSequence#getCoordinate(int)
503502
*/
504503
public Coordinate getCoordinateInternal(int i) {
505-
double x = xy[i * dimension];
506-
double y = xy[i * dimension + 1];
504+
double x = xy[i * 2];
505+
double y = xy[i * 2 + 1];
507506
if( dimension == 2 && measures == 0 ) {
508507
return new CoordinateXY(x,y);
509508
}

0 commit comments

Comments
 (0)