Browse Source

Create the point data structure and distance function

DricomDragon 5 years ago
parent
commit
35f1d8d5d4
1 changed files with 6 additions and 0 deletions
  1. 6 0
      geometry.hs

+ 6 - 0
geometry.hs

@@ -0,0 +1,6 @@
+data Point = Point Float Float
+
+distance p1 p2 = 
+	let (Point a b) = p1 in
+		let (Point c d) = p2 in
+			sqrt ((a - c) * (a - c) + (b - d) * (b - d))