Created
February 13, 2017 03:55
-
-
Save psiphi75/ec7ba8b3a44199373ec6918a5686b4cc to your computer and use it in GitHub Desktop.
Vector using the classic prototypical object.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function Vector(x, y, z) { | |
this.x = x; | |
this.y = y; | |
this.z = z; | |
} | |
Vector.prototype.dot = function(w) { | |
return this.x * w.x + this.y * w.y + this.z * w.z; | |
}; | |
// ... more vector functions |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment