Created
September 11, 2014 10:13
-
-
Save henryscala/a6b9eb272276e97e78fa to your computer and use it in GitHub Desktop.
vector operations
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
import 'dart:math'; | |
addv(v1, v2){ | |
return [v1[0]+v2[0],v1[1]+v2[1]]; | |
} | |
subv(v1,v2){ | |
return [v1[0]-v2[0],v1[1]-v2[1]]; | |
} | |
absv(v){ | |
return sqrt(v[0]*v[0]+v[1]*v[1]); | |
} | |
void main() { | |
var u=[4,3]; | |
var v=[-7,2]; | |
print('${atan(1/11)/PI*180}'); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment