Skip to content

Commit dcee86c

Browse files
committed
mid x and y methods
1 parent e4153b4 commit dcee86c

1 file changed

Lines changed: 21 additions & 1 deletion

File tree

src/main/java/mil/nga/sf/GeometryEnvelope.java

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -464,14 +464,34 @@ public boolean isPoint() {
464464
&& Double.compare(minY, maxY) == 0;
465465
}
466466

467+
/**
468+
* Get the envelope mid x
469+
*
470+
* @return mid x
471+
* @since 2.0.7
472+
*/
473+
public double getMidX() {
474+
return (minX + maxX) / 2.0;
475+
}
476+
477+
/**
478+
* Get the envelope mid y
479+
*
480+
* @return mid y
481+
* @since 2.0.7
482+
*/
483+
public double getMidY() {
484+
return (minY + maxY) / 2.0;
485+
}
486+
467487
/**
468488
* Get the envelope centroid point
469489
*
470490
* @return centroid point
471491
* @since 2.0.5
472492
*/
473493
public Point getCentroid() {
474-
return new Point((minX + maxX) / 2.0, (minY + maxY) / 2.0);
494+
return new Point(getMidX(), getMidY());
475495
}
476496

477497
/**

0 commit comments

Comments
 (0)