Add files via upload
diff --git a/js/circle-mode.js b/js/circle-mode.js
index ea5f423..d5ecff3 100644
--- a/js/circle-mode.js
+++ b/js/circle-mode.js
@@ -1,9 +1,11 @@
+// *********** HERE STARTS circle-mode.js *************

+

 window.addEventListener("load", initCircleMode);

 

 circleMode = false;

 

 function initCircleMode() {

-	document.querySelector("#circle-mode").addEventListener('click', function() {

+	document.querySelector("#circle-mode").addEventListener('click', function() {		

 		if(circleMode) {

 			circleMode = false;

 			document.querySelector("#circle-mode i").innerText = "trip_origin";

@@ -29,4 +31,22 @@
 			s.refresh();

 		}

 	});

+}

+

+function isInRect (x, y, rect) {

+	if (x < -10000 || x > 10000) return true;

+	if (y < -10000 || y > 10000) return true;

+	

+	var ans = true;

+	var c = crossProd (rect[0], rect[1], x, y);

+	

+	for(var i=1; i<4; i++) {	

+		var temp = crossProd (rect[i], rect[(i+1)%4], x, y);

+		if (c*temp < 0) ans = false;

+	}

+	return ans;

+}

+

+function crossProd(r1, r2, x, y) {

+	return r1[0]*r2[1] + r2[0]*y + x*r1[1] - r1[0]*y - r2[0]*r1[1] - x*r2[1]; 

 }
\ No newline at end of file