Vector positions are now relative

This commit is contained in:
Devine Lu Linvega
2017-01-25 16:21:27 -07:00
parent 450aee4f72
commit 6dba090b1f
3 changed files with 31 additions and 13 deletions

View File

@@ -24,6 +24,11 @@ function Position(position_str = "0,0",y = null)
if(!target){ return 0; }
return Math.sqrt( (this.x-target.x)*(this.x-target.x) + (this.y-target.y)*(this.y-target.y) );
}
this.offset = function(position = new Position(0,0))
{
return new Position(this.x - position.x,this.y - position.y);
}
this.normalize = function(rect)
{