Skip to content

Instantly share code, notes, and snippets.

@weepy
Created September 8, 2011 10:25
Show Gist options
  • Select an option

  • Save weepy/1203095 to your computer and use it in GitHub Desktop.

Select an option

Save weepy/1203095 to your computer and use it in GitHub Desktop.
vector maths with coffee script (plus operators)
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