Skip to content

Commit

Permalink
Fix bug in ShapeTestUtil
Browse files Browse the repository at this point in the history
boxPolygon and trianglePolygon only uses minX and minY value of give XY Rectangle which results in a polygon with points in single place. With this changes, both methods generate correct polygons.
  • Loading branch information
heemin32 committed Jan 24, 2024
1 parent 223e28e commit ad1bcfe
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 7 deletions.
2 changes: 2 additions & 0 deletions lucene/CHANGES.txt
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,8 @@ Bug Fixes

* GITHUB#12220: Hunspell: disallow hidden title-case entries from compound middle/end

* GITHUB#12287: Fix a bug in ShapeTestUtil. (Heemin Kim)

Other
---------------------

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -99,10 +99,10 @@ private static XYPolygon trianglePolygon(XYRectangle box) {
final float[] polyY = new float[4];
polyX[0] = box.minX;
polyY[0] = box.minY;
polyX[1] = box.minX;
polyX[1] = box.maxX;
polyY[1] = box.minY;
polyX[2] = box.minX;
polyY[2] = box.minY;
polyX[2] = box.maxX;
polyY[2] = box.maxY;
polyX[3] = box.minX;
polyY[3] = box.minY;
return new XYPolygon(polyX, polyY);
Expand Down Expand Up @@ -142,12 +142,12 @@ private static XYPolygon boxPolygon(XYRectangle box) {
final float[] polyY = new float[5];
polyX[0] = box.minX;
polyY[0] = box.minY;
polyX[1] = box.minX;
polyX[1] = box.maxX;
polyY[1] = box.minY;
polyX[2] = box.minX;
polyY[2] = box.minY;
polyX[2] = box.maxX;
polyY[2] = box.maxY;
polyX[3] = box.minX;
polyY[3] = box.minY;
polyY[3] = box.maxY;
polyX[4] = box.minX;
polyY[4] = box.minY;
return new XYPolygon(polyX, polyY);
Expand Down

0 comments on commit ad1bcfe

Please sign in to comment.