Fill up area between 2 circles

70 views
Skip to first unread message

Bapak Ireng

unread,
Jul 10, 2023, 9:19:28 AM7/10/23
to dislin-users
Dear Helmut,
after a long time I do have again a question on how to achieve filling up the area between 2 circles - only 180 degree.  To be able to achive this task with one call of a subroutine, will there be a special subroutine availble or do I have to create the intermediate points with means of a special routine ?

Regards, Bapak ireng

Helmut Michels

unread,
Jul 14, 2023, 6:05:43 AM7/14/23
to dislin-users
Dear Bapak,

sorry, there is no routine for doing this automatically. You have to calculate the area between the circles
and plot it with a polygon filling routine of Dislin. For example with areaf.

With best regards,

Helmut

Bapak Ireng

unread,
Jul 17, 2023, 3:16:18 AM7/17/23
to dislin-users
Hello and good morning dear helmut,

many thanks for your kind and valuable answer.
My programs are in F90.
I used the subroutine circle  to draw 2 circles perfectly from -90 to +90 degree with radius1 < radius2.
With xm and ym as being the centre of the circle, i was able to calculate the coordinates of the inner and outer circle and used a polygon filling routine in a second run, as suggested by you.
However, the results looks very weird. Only at the horizontal line ( 0 Degree) is a match, all other of my coordinates are far below the circles drawn by the subroutine circle.

Real, Parameter :: wd0=-90.
do i=0,179
wd=(wd0+float(i))
x1(i+1)=xm+(rad1*cos(wd))
y1(i+1)=ym+(rad1*sin(wd))
x2(i+1)=xm+(rad2*cos(wd))
y2(i+1)=ym+(rad2*sin(wd))
end do

Does the subroutine circle uses degree or polar coordinates ?

Best regards, Bapak Ireng

Bapak Ireng

unread,
Jul 17, 2023, 3:32:15 AM7/17/23
to dislin-users
Dear Helmut,

is there any way to access the calculated coordinates of the subroutine circle ?

best regards, BApak Ireng

Helmut Michels

unread,
Jul 17, 2023, 6:22:19 AM7/17/23
to dislin-users
Hi,

no, but the circle is calculated in the same way as in your example above. Note, that the
origin of the page is in the upper left corner if you are using plot coordinates, and not world
coordinates in an axis system.

With best regards,

Helmut

Helmut Michels

unread,
Jul 17, 2023, 6:22:32 AM7/17/23
to dislin-users
Hi Bapak,

the Fortran functions cos and sin use radian instead of degree.

With best regards,

Helmut

Bapak Ireng

unread,
Jul 17, 2023, 6:31:26 AM7/17/23
to dislin-users
Hi,
thanks for your answer.
I am using an axis system (0,1000, 0, 1000) to be able to construct the image. 
Therefore all coordinates are in between these values.
best regards,

Bapak Ireng

Bapak Ireng

unread,
Jul 17, 2023, 7:00:15 AM7/17/23
to dislin-users
Bildschirmfoto vom 2023-07-17 12-57-36.png

Thats what the result of the calculated coordinates look like.

Best regards, Bapak ireng

Bapak Ireng

unread,
Jul 18, 2023, 5:57:34 AM7/18/23
to dislin-users
Any suggestion what happened and why it looks like this ?

Helmut Michels

unread,
Jul 18, 2023, 10:03:12 AM7/18/23
to dislin-users
Dear Bapak,

the size axis system is not quadratic I think. Dislin plots circles in axis systems by converting world 
coordinates to plot coordinates, so that a circle everytime looks like a circle. The x scaling is used for
caculating the radius of a circle. You can take a look at the attached example code, that does nearly what
you want.

With best regards,

Helmut
t1.f90
dislin.png

Bapak Ireng

unread,
Jul 19, 2023, 3:54:11 AM7/19/23
to dislin-users
dear Helmut,
thank you very much for your valubale input and contribution. I am still in the process of debugging my coding.
As son as I resolved my issue, i will come back to you.

Best regards, Bapak Ireng

Bapak Ireng

unread,
Jul 21, 2023, 9:05:01 AM7/21/23
to dislin-users
Dear Helmut,

your sample program works perfect. However as soon as i incorporate your calculation of IXM, IYm, nr1 and nt2 into my progam it is still a complete mess..sayind data out of range.

call graf(0.,1000.,0.,100.,0.,1000.,0.,100.)

xm=530
YM=560

Rad1=30
Rad2=40

with this data

im=nxosn(xm)
iym=nyposn(ym)

IXM=        1543 
IYM=        1016
Nrad1=          59
Nrad2=         79
which is far beyond the limits of the plot data.

Best regards,

Bapak Ireng

Bapak Ireng

unread,
Jul 21, 2023, 9:37:39 AM7/21/23
to dislin-users
Typo:

ixm=nxposn(xm)

Bapak Ireng

unread,
Jul 21, 2023, 10:44:31 AM7/21/23
to dislin-users
Bildschirmfoto vom 2023-07-21 16-41-27.png
That show it loks like withe the adjusted radius and orginal Xm, Ym. The values of the adjusted Xm,Ym are out of range.

Bapak Ireng

unread,
Sep 24, 2023, 11:26:23 PM9/24/23
to dislin-users
Dear Helmut,

sorry that I am getting back to you now. I was very busy lately and I had no time to continue on my project. 
However, I would like to tell you, that your sample presents the perfect solution and I finally found out my mistake, by usin the wrong plotting subroutine.

Again, I would like to thak you very much for your continous help and support.

Best regards, Bapak ireng
Reply all
Reply to author
Forward
0 new messages