Fix bug in ShapeTestUtil (#12287)

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.
This commit is contained in:
Heemin Kim 2024-01-24 10:09:37 -08:00 committed by GitHub
parent f16007c3ec
commit 3a205feb27
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 9 additions and 7 deletions

View File

@ -228,6 +228,8 @@ Bug Fixes
* GITHUB#12885: Fixed the bug that JapaneseReadingFormFilter cannot convert some hiragana to romaji. (Takuma Kuramitsu)
* GITHUB#12287: Fix a bug in ShapeTestUtil. (Heemin Kim)
Build
---------------------

View File

@ -99,10 +99,10 @@ public class ShapeTestUtil {
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);
@ -142,12 +142,12 @@ public class ShapeTestUtil {
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);