Added Vector2.normalizeRightHand

This commit is contained in:
Richard Davey 2017-09-21 02:03:37 +01:00
parent 1439144fae
commit 9ec7a52dcc

View file

@ -168,6 +168,19 @@ var Vector2 = new Class({
return this;
},
/**
* Right-hand normalize (make unit length) this Vector
*/
normalizeRightHand: function ()
{
var x = this.x;
this.x = this.y * -1;
this.y = x;
return this;
},
dot: function (src)
{
return this.x * src.x + this.y * src.y;