Created
September 8, 2011 10:25
-
-
Save weepy/1203095 to your computer and use it in GitHub Desktop.
vector maths with coffee script (plus operators)
This file contains hidden or 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
| v1 = Vector 3,4,5 | |
| v2 = Vector 9,-3,0 | |
| v3 = v1.+ v2 | |
| cross_product = v1.x v2 | |
| dot_product = v1.* v2 | |
| n = Matrix [ | |
| [1,7,3] | |
| [9,4,0] | |
| [2,7,1] ] | |
| m = Matrix [ | |
| [6,2,8] | |
| [9,1,3] | |
| [0,7,6] ] | |
| o = n.* m | |
| // o is the matrix | |
| // 69 30 47 | |
| // 90 22 84 | |
| // 75 18 43 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment