This fix was originally discussed in this thread.
The following is a patch file for the maptool trunk.
Code: Select all
Index: src/net/rptools/maptool/client/ui/zone/vbl/AreaMeta.java
===================================================================
--- src/net/rptools/maptool/client/ui/zone/vbl/AreaMeta.java (revision 5862)
+++ src/net/rptools/maptool/client/ui/zone/vbl/AreaMeta.java (working copy)
@@ -87,7 +87,7 @@
// TODO: This works ... in concept, but in practice it can create holes that pop outside of their parent bounds
// for really thin diagonal lines. At some point this could be moved to a post processing step, after the
// islands have been placed into their oceans. But that's an optimization for another day
-// if (lastPointNode != null && GeometryUtil.getDistance(lastPointNode.point, new Point2D.Float(x, y)) < 1.5) {
+// if (lastPointNode != null && lastPointNode.point.distance(new Point2D.Float(x, y)) < 1.5) {
// skippedPoints++;
// return;
// }
Index: src/net/rptools/maptool/client/ui/zone/vbl/VisibleAreaSegment.java
===================================================================
--- src/net/rptools/maptool/client/ui/zone/vbl/VisibleAreaSegment.java (revision 5862)
+++ src/net/rptools/maptool/client/ui/zone/vbl/VisibleAreaSegment.java (working copy)
@@ -18,7 +18,6 @@
import java.util.LinkedList;
import java.util.List;
-import net.rptools.lib.GeometryUtil;
import net.rptools.maptool.util.GraphicsUtil;
public class VisibleAreaSegment implements Comparable<VisibleAreaSegment> {
@@ -40,7 +39,7 @@
}
public double getDistanceFromOrigin() {
- return GeometryUtil.getDistance(getCenterPoint(), origin);
+ return origin.distance(getCenterPoint());
}
public Point2D getCenterPoint() {
@@ -115,8 +114,9 @@
throw new NullPointerException("compareTo() parameter is null");
double odist = o.getDistanceFromOrigin();
+ double dist = getDistanceFromOrigin();
// FJE Wouldn't it work to just use the following?
- // return getDistanceFromOrigin() - odist;
- return getDistanceFromOrigin() < odist ? -1 : getDistanceFromOrigin() == odist ? 0 : 1;
+ // return dist - odist;
+ return dist < odist ? -1 : dist == odist ? 0 : 1;
}
}
Code: Select all
Index: src/net/rptools/lib/GeometryUtil.java
===================================================================
--- src/net/rptools/lib/GeometryUtil.java (revision 5862)
+++ src/net/rptools/lib/GeometryUtil.java (working copy)
@@ -95,12 +95,6 @@
}
}
- public static double getDistance(Point2D p1, Point2D p2) {
- double a = p2.getX() - p1.getX();
- double b = p2.getY() - p1.getY();
- return Math.abs(Math.sqrt(a+b));
- }
-
public static Set<Line2D> getFrontFaces(PointNode nodeList, Point2D origin) {
Set<Line2D> frontFaces = new HashSet<Line2D>();
I will also send these patch files to Azhrei.