code cleanup
This commit is contained in:
@@ -1,47 +1,41 @@
|
|||||||
|
!
|
||||||
|
! BUILD A STAR FIELD
|
||||||
|
!
|
||||||
program starfield
|
program starfield
|
||||||
use genplotting
|
use genplotting
|
||||||
implicit none
|
implicit none
|
||||||
|
|
||||||
write (0, '(A)') "----[ genplotting starfield ]----"
|
write (0, '(A)') "----[ genplotting starfield ]----"
|
||||||
|
|
||||||
call genp_init (0, 'starfield.scratch')
|
call genp_init (0, 'starfield.scratch')
|
||||||
call do_starfield (105)
|
call do_starfield (451)
|
||||||
call genp_end (0)
|
call genp_end (0)
|
||||||
|
|
||||||
contains
|
contains
|
||||||
! ---------------------------------------------------------
|
! ---------------------------------------------------------
|
||||||
subroutine plot_a_star(at_x, at_y, sz, col)
|
subroutine plot_a_star(at_x, at_y, sz, color)
|
||||||
real, intent(in) :: at_x, at_y, sz
|
real, intent(in) :: at_x, at_y, sz
|
||||||
integer, intent(in) :: col
|
integer, intent(in) :: color
|
||||||
integer :: idx
|
integer :: idx
|
||||||
real :: rad, xv, yv
|
real :: rad, xv, yv
|
||||||
|
|
||||||
write(0, '("plot a star ", 2F8.3)') at_x, at_y
|
write(0, '("plot a star ", 2F8.3)') at_x, at_y
|
||||||
call genp_set_offset(at_x, at_y)
|
call genp_set_offset(at_x, at_y)
|
||||||
|
do idx=0, 360, 36
|
||||||
do idx=0, 360, 30
|
rad = 0.042 + (real(idx) * (3.14159 / 180))
|
||||||
rad = 0.04 + (real(idx) * (3.14159 / 180))
|
|
||||||
xv = sz * sin(rad) ; yv = sz * cos(rad)
|
xv = sz * sin(rad) ; yv = sz * cos(rad)
|
||||||
call genp_move(0.0, 0.0)
|
call genp_move(0.0, 0.0)
|
||||||
call genp_draw(xv, yv, col)
|
call genp_draw(xv, yv, color)
|
||||||
enddo
|
enddo
|
||||||
|
|
||||||
end subroutine
|
end subroutine
|
||||||
! ---------------------------------------------------------
|
! ---------------------------------------------------------
|
||||||
subroutine do_starfield (nbstar)
|
subroutine do_starfield (nbstar)
|
||||||
integer, intent(in) :: nbstar
|
integer, intent(in) :: nbstar
|
||||||
|
|
||||||
integer idx, color
|
integer idx, color
|
||||||
real px, py, sz
|
real px, py, sz
|
||||||
|
|
||||||
do idx=0, nbstar
|
do idx=0, nbstar
|
||||||
px = (rand(0) * 10.00) - 5.00
|
px = (rand(0) * 10.00) - 5.00
|
||||||
py = (rand(0) * 10.00) - 5.00
|
py = (rand(0) * 10.00) - 5.00
|
||||||
sz = (rand(0) * 0.16) + 0.19
|
sz = (rand(0) * 0.16) + 0.16
|
||||||
color = 1 + mod(idx, 7)
|
color = 1 + mod(idx, 7)
|
||||||
call plot_a_star(px, py, sz, color)
|
call plot_a_star(px, py, sz, color)
|
||||||
end do
|
end do
|
||||||
end subroutine
|
end subroutine
|
||||||
! ---------------------------------------------------------
|
! ---------------------------------------------------------
|
||||||
! ---------------------------------------------------------
|
|
||||||
end program
|
end program
|
||||||
|
|||||||
Reference in New Issue
Block a user