function [arr_orr arr_head] = arrow_position(positions, board_detect, to,from)
% function used for computing the positions of origin of the arrow 
% and the arrow head on the image based on the suggested position

% arrow origin - get the center of the piece to move
for i=1 :1: length(positions)
    if ((positions(i,3) == from(2)) && (positions(i,4) == from (1)))
        arr_orr = [positions(i,2) positions(i,1)];
    end
end

% arrow head - get the center of the table square where to move 

up_left_corner = [board_detect(to(1),1) board_detect(to(2),2)];
low_right_corner = [board_detect( to(1)+1,1) board_detect( to(2)+1,2)];

arr_head = (up_left_corner+low_right_corner)/2;

arr_head = double(arr_head);
arr_orr = double (arr_orr);
end