From 83d36fe04b6c83e3a92644b344b9976d3c342293 Mon Sep 17 00:00:00 2001 From: Hannes Janetzek Date: Fri, 7 Feb 2014 14:13:41 +0100 Subject: [PATCH] add Point.distance() --- vtm/src/org/oscim/core/Point.java | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/vtm/src/org/oscim/core/Point.java b/vtm/src/org/oscim/core/Point.java index 9e40a856..3601ad83 100644 --- a/vtm/src/org/oscim/core/Point.java +++ b/vtm/src/org/oscim/core/Point.java @@ -36,6 +36,14 @@ public class Point { return y; } + public double distance(Point other) { + return Math.sqrt((x - other.x) * (x - other.x) + (y - other.y) + (y - other.y)); + } + + public double distanceSq(Point other) { + return (x - other.x) * (x - other.x) + (y - other.y) + (y - other.y); + } + @Override public String toString() { return x + " " + y;