making a circle looking like a circle

Hi there,

Apologise if this has been answered. didn't find yet anything that relates to my issue. Do not hesitate to point me to the right place in case...
I'm new to scilab.
Actually I just need to make circles of different radius moving on a plane defined by specific boundaries.
By now, the graphical window keep resizing and stretching the circles !!!
Any thing that allows to simply provide the dimensions of the plane surface and ask to make that freezed ?
Help appreciated.

Scilab Not Spam 16-11-16, 5:56 p.m. moon61
Could you share the code you have right now?
Not Spam 16-11-16, 6:13 p.m. shamika

yep.
Please notice that the code is not performing what I really need. Anyway. you'll see the issue if you run that.
M
// CODE
```function draw_circle(x0, y0, r, col)
alpha=-%pi:0.1:%pi
x=x0+r*cos(alpha);
y=y0+r*sin(alpha);
plot(x,y,col)
endfunction

function [X, Y, nhits]=bouncing(xa0, xb0, va0, vb0, m1, m2, r1, r2)
nhits=0;
maxtime=200;
U(1)=va0; X(1)=xa0;
V(1)=vb0; Y(1)=xb0;
for j=2:maxtime
U(j)=(m2*(2*V(j-1)-U(j-1))+U(j-1)*m1)/(m1+m2); // Compute speed of ball 1
V(j)=(m1*(2*U(j-1)-V(j-1))+V(j-1)*m2)/(m1+m2); // Compute speed of ball 2
X(j)=j*U(j); // Compute position of ball 1
Y(j)=j*V(j); // Compute position of ball 2
draw_circle(X(j-1),r1,r1,'w') // Erasing the previous ball 1
draw_circle(X(j),r1,r1,'r') // Ploting current position of ball 1

draw_circle(Y(j-1),r2,r2,'w') // Erasing the previous ball 2
draw_circle(Y(j),r2,r2,'b') // Ploting current position of ball 2
if(X(j)<r1)
nhits=nhits+1;
U(j)=-U(j);
end
if(abs(X(j)-U(j))<(r1+r2))
nhits=nhits+1;
U(j)=-U(j);
end
//sleep(1000) //For debugging purpose
end
endfunction

// Some initialisations
m1=1;
xa0=1;
xb0=8.696;
va0=0;
vb0=-1.5;
r1=1;
r2=0.5;
for r=0:4
m2=16.0*100.0^r;
[x,y,sol]=bouncing(xa0,xb0,va0,vb0,m1,m2,r1,r2)
disp([sol])
figure(r)
xs2png(0,sprintf('bounce_final_%02d.jpg',r));
end```
Not Spam 16-11-16, 6:20 p.m. moon61