summaryrefslogtreecommitdiff
path: root/assets/javascripts/math/point.js
diff options
context:
space:
mode:
authorJules Laplace <jules@okfoc.us>2014-11-17 15:46:39 -0500
committerJules Laplace <jules@okfoc.us>2014-11-17 15:46:39 -0500
commit5fa235a556d384117840b7088575012dcd1787dd (patch)
tree2e819d13093cd446bdb32a2885c068da4ab94cf0 /assets/javascripts/math/point.js
parent548ef92e8157f1ae0b594d0fd2c609438d748222 (diff)
polygonal lasso
Diffstat (limited to 'assets/javascripts/math/point.js')
-rw-r--r--assets/javascripts/math/point.js9
1 files changed, 9 insertions, 0 deletions
diff --git a/assets/javascripts/math/point.js b/assets/javascripts/math/point.js
index 354be00..5a5d0db 100644
--- a/assets/javascripts/math/point.js
+++ b/assets/javascripts/math/point.js
@@ -5,6 +5,15 @@
this.a = a
this.b = b
}
+
+ point.prototype.distanceTo = function(p){
+ return Math.sqrt(this.dot(p))
+ }
+ point.prototype.dot = function(p){
+ return Math.pow(this.a - p.a, 2) + Math.pow(this.b - p.b, 2)
+ }
+
+
point.prototype.magnitude = function(){
return this.b-this.a
}