Background: I work on a finite element program for rotating electrical machines. All the code is in Fotran. In the past I used Matlab for the graphics. At present I started with Clearwin (all new to me). The first thing to plot is the polygons used by the mesher and then later the mesh itself.
In the help I found an example (with some modification) to plot the mesh. For plotting the polygons/mesh it is necessary (a) to do some axis transformation since (1,1) is top left in the window (b) define som factor to get the axis ratio correct.
Question: If anyone has an working example of using DRAW_FILLED_POLYGON@ and some automatic axis tranformation this would be very helpful. SIMDEM will defininately work. However, I am still playing around with it (unfortunately the learning curve is not so easy as advertised). I would appreciate some tipps 😄
WINAPP
INTEGER i,winio@
EXTERNAL fill_cb,start_cb
i=winio@('%ww[no_border,no_maxminbox]&')
i=winio@('%sy[3d_depressed]&')
i=winio@('%^gr[black,rgb_colours]&',600,600,start_cb)
i=winio@('%sc',start_cb)
END
c------------------------------------------------------------
INTEGER FUNCTION start_cb()
INCLUDE <clearwin.ins>
INTEGER x,y,d,f,red,green,black,amber,white,colour,a
integer nseg_pol,i,nspnts_pol,nstype_pol,j
INTEGER i,white,ix(50),iy(50),n,icol
double precision x_ply(50),y_ply(50),xmax,ymin
integer iu
CALL get_mouse_info@(x,y,d)
CALL get_rgb_value@(x,y,colour)
red= get_matched_colour@(RGB@(255,0,0))
green=get_matched_colour@(RGB@(0,255,0))
amber=get_matched_colour@(RGB@(255,168,0))
white=get_matched_colour@(RGB@(200,200,200))
black=0
C READ THE FILE CONTAINING THE POLYGON INFORMATION
C Determine the min/max values for x and y
iu = 99
open(unit=iu,FILE='aa.pol')
rewind iu
read (iu,*) nseg_pol
xmin = 0.0
ymax = 0.0
do i=1,nseg_pol
read (iu,*) nspnts_pol,nstype_pol
do j=1,nspnts_pol
read (iu,*) x_ply(j),y_ply(j)
if (x_ply(j)<xmin) then
xmin = x_ply(j)
endif
if (y_ply(j)>ymax) then
ymax = y_ply(j)
endif
end do
end do
C Now plot the data
rewind iu
read (iu,*) nseg_pol
do i=1,nseg_pol
read (iu,*) nspnts_pol,nstype_pol
do j=1,nspnts_pol
read (iu,*) x_ply(j),y_ply(j)
ix(j) = abs(x_ply(j)/xmin)*600
iy(j) = abs(y_ply(j)/xmin)*600
end do
IF(nstype_pol.EQ.250)THEN
f=red
ELSEIF(nstype_pol.EQ.201)THEN
f=amber
ELSEIF(nstype_pol.eq.0)THEN
f=green
ELSE
f=black
ENDIF
call DRAW_FILLED_POLYGON@(ix,iy,nspnts_pol,f)
end do
close(unit=iu)
start_cb=1
END
An example of a polygon file is as follows:
2
3 250 2
-0.129912310687 7.500490754584E-02
-0.132363215957 7.641993836383E-02
-0.135452629966 7.098673400850E-02
3 250 3
-0.132363215957 7.641993836383E-02
-0.134814121228 7.783496918180E-02
-0.137867949246 7.238121924504E-02