Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed MinimumBoundingCircle.getMaximumDiameter() to handle case where extremalPts[2]-[0] is longest #533

Merged
merged 2 commits into from
Apr 27, 2020

Conversation

tink-expo
Copy link
Contributor

Hello,

It seemed that MinimumBoundingCircle.getMaximumDiameter() returns farther pair only among extremalPts[0]-[1] and extremalPts[1]-[2] if extremalPts.length == 3.

I thought this can cause unexpected result when extremalPts consists of 3 points forming acute triangle, and the longest segment is extremalPts[2]-[0].
(Please take a look at the case added at MinimumBoundingCircleTest.testMinDiameterPolygon().)

So I'm suggesting a change for farthestPoints() to handle this case as well by checking all three segment length.

Maybe I have misunderstood the purpose of getMaximumDiameter(), but if I have understood the method description comments correctly, this fix could be helpful.
Thank you :)

…angle

Signed-off-by: tink-expo <whhan8485@gmail.com>
@dr-jts
Copy link
Contributor

dr-jts commented Apr 27, 2020

This is great, thanks.

Would you be able to fix the test file to say maxDiameter in the method names instead of minDiameter ?

Signed-off-by: tink-expo <whhan8485@gmail.com>
@tink-expo
Copy link
Contributor Author

Fix applied :)

@dr-jts
Copy link
Contributor

dr-jts commented Apr 27, 2020

Great, thanks.

@dr-jts dr-jts merged commit 14ad8f8 into locationtech:master Apr 27, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants