Vector2.js 633 B

123456789101112131415161718192021222324252627282930
  1. function Vector2() {
  2. }
  3. Vector2.prototype.set = function(x,y) {
  4. Polycode.Vector2_set(this.__ptr, x,y)
  5. }
  6. Vector2.prototype.distance = function(vec2) {
  7. Polycode.Vector2_distance(this.__ptr, vec2)
  8. }
  9. Vector2.prototype.length = function() {
  10. Polycode.Vector2_length(this.__ptr)
  11. }
  12. Vector2.prototype.dot = function(u) {
  13. Polycode.Vector2_dot(this.__ptr, u)
  14. }
  15. Vector2.prototype.crossProduct = function(vec2) {
  16. Polycode.Vector2_crossProduct(this.__ptr, vec2)
  17. }
  18. Vector2.prototype.angle = function(vec2) {
  19. Polycode.Vector2_angle(this.__ptr, vec2)
  20. }
  21. Vector2.prototype.Normalize = function() {
  22. Polycode.Vector2_Normalize(this.__ptr)
  23. }