replica nfl jerseysreplica nfl jerseyssoccer jerseyreplica nfl jerseys forums.silverfrost.com :: View topic - Avoiding flicker with rapid %pl updates
forums.silverfrost.com Forum Index forums.silverfrost.com
Welcome to the Silverfrost forums
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Avoiding flicker with rapid %pl updates
Goto page Previous  1, 2, 3
 
Post new topic   Reply to topic    forums.silverfrost.com Forum Index -> ClearWin+
View previous topic :: View next topic  
Author Message
Kenneth_Smith



Joined: 18 May 2012
Posts: 801
Location: Hamilton, Lanarkshire, Scotland.

PostPosted: Tue Feb 04, 2025 4:03 pm    Post subject: Reply with quote

Here is another fractal - the Barnsley fern.

There a few tricks with the %pl margin, frame, etched, external_ticks and x_min etc, options, which along with an offset in the x axis values passed to %pl which combine to hide all axis annotations.

Not a good example to ask the %pl[external,buffered] to update on each iteration however.

Code:
options (optimise)
program bfern
use clrwin
implicit none
integer, parameter :: n = 100000
integer :: i, current, iw, control, idx, gh
real*8 :: temp_x, temp_y, r, x_shift = 5.5d0   
real*8, allocatable, dimension(:) :: x, y
real*8, dimension(4, 6) :: coeffs
data coeffs/0.0d0, 0.2d0, -0.15d0, 0.84d0, 0.0d0, -0.26d0, 0.28d0, 0.04d0, &
            0.0d0, 0.23d0, 0.26d0,-0.04d0, 0.16d0, 0.22d0, 0.24d0, 0.85d0, &
            0.0d0, 0.0d0,  0.0d0,  0.0d0,  0.0d0,  1.6d0,  0.44d0, 1.6d0 /
  write(*,'(a)') 'Initialising'             
  allocate(x(n),y(n))
  gh = 0.80*clearwin_info@('screen_depth')
  iw = winio@('%mn[Exit]&','Exit')
  iw = winio@('%gr[grey]%lw',gh,gh,control)
  x(1) = 0.d0
  y(1) = 0.d0
  current = 1
  write(*,'(a,f6.2)') '% complete ',0.d0
  do i = 2, n
    call random_number(r)
    temp_x = x(current)
    temp_y = y(current)
    if (r .le. 0.01d0) then
      idx = 1
    else if (r .le. 0.08d0) then
      idx = 2
    else if (r .le. 0.15d0) then
      idx = 3
    else
      idx = 4
    end if
    x(i) = coeffs(idx, 1) * temp_x + coeffs(idx, 2) * temp_y + coeffs(idx, 5)
    y(i) = coeffs(idx, 3) * temp_x + coeffs(idx, 4) * temp_y + coeffs(idx, 6)
    current = i
    if ( mod(i,1000) .eq. 0 ) call temporary_yield@()
    if ( mod(i,n/20) .eq. 0  ) then
      iw = winio@('%`bg[grey]&')
      call winop_int@('%pl[n_graphs]',1)
      call winop_clr@('%pl[colour]', rgb@(1,130,32))
      call winop@('%pl[x_array,independent,link=none,symbol=11,symbol_size=1]')
      call winop@('%pl[frame,etched,external_ticks,margin=2]')
      call winop@('%pl[x_min=0,x_max=11,y_min=0,y_max=11]')
      iw = winio@('%pl[external,buffered]', i, x + x_shift, y)
     
      call perform_graphics_update@()
      call temporary_yield@()
      write(*,'(a,f6.2)') '% complete ',dble(i)/n*100
    end if
  end do
  write(*,'(a)') 'all done'
end program bfern
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    forums.silverfrost.com Forum Index -> ClearWin+ All times are GMT + 1 Hour
Goto page Previous  1, 2, 3
Page 3 of 3

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group