function B = Calc_Basal_Constant_Volume(A, Xin, Yin, Vo)

B = zeros(size(A));
S = size(A, 1);

back_max = 5000;

B(ceil(S/2), 1) = Xin(end/2); B(ceil(S/2), 2) = Yin(end/2);
id_left = length(Xin)/2;
for i = ceil(S/2):-1:2,
   
    V1x = A(i, 1) - A(i-1, 1);
    V1y = A(i, 2) - A(i-1, 2);
    id_tmp = id_left - back_max;
    if id_tmp < 1, id_tmp = 1;end
        
    V2x = A(i, 1) - Xin(id_tmp:id_left);
    V2y = A(i, 2) - Yin(id_tmp:id_left);
        
    V3x = A(i, 1) - B(i, 1);
    V3y = A(i, 2) - B(i, 2);
    
    V_tmp = abs(V1x*V3y - V1y*V3x) + abs(V2x.*V3y - V2y.*V3x);
    [~, id_left] = min((V_tmp - Vo).^2);
    id_left = id_left + id_tmp;
    B(i-1, 1) = Xin(id_left); B(i-1, 2) = Yin(id_left);
    
end

for i=1:S/2,
    B(S-i+1, 1) = -B(i, 1);B(S-i+1, 2) = B(i, 2);
end


end

