You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by er...@apache.org on 2019/06/12 14:56:57 UTC

[commons-geometry] 02/02: Added a proposed fix for [GEOMETRY-58]

This is an automated email from the ASF dual-hosted git repository.

erans pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/commons-geometry.git

commit c184e3e16648cfdcbce52e3fcd3d6e9de0acd299
Author: Benjamin Krogh <be...@blipsystems.com>
AuthorDate: Wed Jun 12 16:22:48 2019 +0200

    Added a proposed fix for [GEOMETRY-58]
    
    The moveToFrontBall method will disregard any point if it is within
    (radius + precision.getMaxZero()) of current center.
    Therefore, we might end up with a resulting radius somewhat larger than
    the original author expected. To overcome this issue, we change the
    comparison to something that respects the configured precision.
---
 .../main/java/org/apache/commons/geometry/enclosing/WelzlEncloser.java  | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/commons-geometry-enclosing/src/main/java/org/apache/commons/geometry/enclosing/WelzlEncloser.java b/commons-geometry-enclosing/src/main/java/org/apache/commons/geometry/enclosing/WelzlEncloser.java
old mode 100644
new mode 100755
index b4b2876..4158245
--- a/commons-geometry-enclosing/src/main/java/org/apache/commons/geometry/enclosing/WelzlEncloser.java
+++ b/commons-geometry-enclosing/src/main/java/org/apache/commons/geometry/enclosing/WelzlEncloser.java
@@ -98,7 +98,7 @@ public class WelzlEncloser<P extends Point<P>> implements Encloser<P> {
             support.add(farthest);
             EnclosingBall<P> savedBall = ball;
             ball = moveToFrontBall(extreme, extreme.size(), support);
-            if (ball.getRadius() < savedBall.getRadius()) {
+            if (this.precision.lt(ball.getRadius(), savedBall.getRadius())) {
                 // this should never happen
                 throw new GeometryInternalError();
             }