From bb98d03e7fb86ea37d0e275a041420619a5ca521 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=A9my=20Zurcher?= Date: Mon, 11 Mar 2013 16:19:11 +0100 Subject: Algorithms-I : 3-Collinear: cosmetic --- Algorithms/Part-I/3-Collinear/Fast.java | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/Algorithms/Part-I/3-Collinear/Fast.java b/Algorithms/Part-I/3-Collinear/Fast.java index 5d6ad48..6d9dcac 100644 --- a/Algorithms/Part-I/3-Collinear/Fast.java +++ b/Algorithms/Part-I/3-Collinear/Fast.java @@ -41,7 +41,8 @@ public class Fast if (other == null) return false; if (other.getClass() != this.getClass()) return false; Segment s = (Segment) other; - if ((pts[0].compareTo(s.pts[0]) == 0) || (pts[pts.length - 1].compareTo(s.pts[s.pts.length - 1]) == 0)) + if ((pts[0].compareTo(s.pts[0]) == 0) + || (pts[pts.length - 1].compareTo(s.pts[s.pts.length - 1]) == 0)) return true; return false; } @@ -69,8 +70,6 @@ public class Fast Point ref = pts[i]; Point[] others = new Point[n]; - ref.draw(); - for (int j = 0, k = i + 1; j < n; j++, k++) others[j] = pts[k]; @@ -88,7 +87,8 @@ public class Fast { if ((start != -1) && ((j - start) > 2)) { - Segment seg = new Segment(ref, others, start, (j - start + 1)); + Segment seg = new Segment(ref, others, + start, (j - start + 1)); if (!segments.contains(seg)) segments.add(seg); } @@ -120,7 +120,9 @@ public class Fast for (int i = 0; i < n; i++) { pts[i] = new Point(in.readInt(), in.readInt()); + pts[i].draw(); } + Arrays.sort(pts); // Stopwatch w = new Stopwatch(); -- cgit v1.1-2-g2b99