class VC {
	
	static matrices = [
		//invalid
		[0,0,0,0],
		// SW
		[ 0, 1,
		 -1, 0],
		 // SE
		[ 1, 0,
		  0, 1],
		// NE
		[ 0,-1,
		  1, 0],
		// NW
		[-1, 0,
		  0,-1]
	];
	
	function VectorCoordinates(location, direction = Direction.SW) {
		return {location = location, direction = direction}
	}

	//base coordinates are given as a pair (location, direction)
	//delta coordinates are given as a pair (r, f). f = delta heading forward, r = delta to the right
	function GetTile(base, delta) {
		local matrix = VC.matrices[base["direction"]]
		local x = delta[0] * matrix[0] + delta[1] * matrix[1];
		local y = delta[0] * matrix[2] + delta[1] * matrix[3];
		return base["location"] + AIMap.GetTileIndex(x, y);
	}
	
	//base coordinates are given as a pair (location, direction)
	//delta coordinates are given as a pair (r, f). f = delta heading forward, r = delta to the right
	function GetDXY(base, delta) {
		local matrix = VC.matrices[base["direction"]]
		local x = delta[0] * matrix[0] + delta[1] * matrix[1];
		local y = delta[0] * matrix[2] + delta[1] * matrix[3];
		return AIMap.GetTileIndex(x, y);
	}
}