From 2f611919d5b9689319d95a0ed7ae200fc6f88471 Mon Sep 17 00:00:00 2001 From: willer <1003961499@qq.com> Date: Thu, 27 Apr 2023 17:02:51 +0800 Subject: [PATCH] Update geometry.py MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit euclidean_distance取消round,避免geo_avg_curve_len出现零值 --- shapesimilarity/geometry.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/shapesimilarity/geometry.py b/shapesimilarity/geometry.py index 5daf501..d89b73e 100644 --- a/shapesimilarity/geometry.py +++ b/shapesimilarity/geometry.py @@ -11,7 +11,7 @@ def euclidean_distance(point1, point2): Calculate Euclidian distance of two points in Euclidian space ''' - return round(math.sqrt((point1[0]-point2[0])**2 + (point1[1]-point2[1])**2), 2) + return math.sqrt((point1[0]-point2[0])**2 + (point1[1]-point2[1])**2) def curve_length(curve): ''' @@ -60,4 +60,4 @@ def rotate_curve(curve, thetaRad): x_cord = math.cos(-1 * thetaRad) * curve[i][0] - math.sin(-1 * thetaRad) * curve[i][1] y_cord = math.sin(-1 * thetaRad) * curve[i][0] + math.cos(-1 * thetaRad) * curve[i][1] rot_curve.append([x_cord, y_cord]) - return rot_curve \ No newline at end of file + return rot_curve