dernier commit avant le Gers
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
module julias
|
||||
|
||||
use fraktals
|
||||
implicit none
|
||||
contains
|
||||
|
||||
@@ -50,31 +51,40 @@ subroutine simple_julia(pic, cx, cy, maxiter)
|
||||
|
||||
end subroutine simple_julia
|
||||
!===============================================================
|
||||
|
||||
subroutine julia_colormapped(pic, cx, cy, maxiter)
|
||||
!-
|
||||
! this code is nor really finished
|
||||
!-
|
||||
subroutine julia_colormapped(pic, cx, cy, mag, maxiter)
|
||||
use pixrgb
|
||||
type(t_pixrgb), intent(inout), dimension (:,:) :: pic
|
||||
real, intent(in) :: cx, cy
|
||||
real, intent(in) :: cx, cy, mag
|
||||
integer, intent(in) :: maxiter
|
||||
|
||||
integer :: ix, iy, width, height
|
||||
real :: fx, fy
|
||||
integer :: ix, iy, width, height, iter
|
||||
real :: fx, fy, div, off
|
||||
complex :: Z, C
|
||||
integer :: iter
|
||||
logical :: over_iter
|
||||
integer :: under, over
|
||||
|
||||
pic = t_pixrgb(0, 0, 0)
|
||||
|
||||
width = ubound(pic, 1)
|
||||
height = ubound(pic, 2)
|
||||
C = complex(cx, cy)
|
||||
|
||||
div = mag * 10.0 ; off = mag * 2.5
|
||||
under = 0 ; over = 0
|
||||
print *, "mag:", mag, " -> ", div, off
|
||||
|
||||
! print *, "Color julia, const = ", C
|
||||
do ix = 1, width
|
||||
fx = (float(ix) / (float(width*2)/10.0) - 2.5)
|
||||
fx = (float(ix) / (float(width*2)/div) - off)
|
||||
do iy = 1, height
|
||||
fy = (float(iy) / (float(height*2)/10.0) - 2.5)
|
||||
fy = (float(iy) / (float(height*2)/div) - off)
|
||||
! ------ traitement du pixel
|
||||
iter = 0 ; over_iter = .FALSE.
|
||||
Z = complex(fx, fy)
|
||||
do while ((real(Z)*real(Z) + imag(Z)*imag(Z)) .LT. 4.0)
|
||||
do while ((real(Z)*real(Z) + (imag(Z)*imag(Z))) .LT. 4.0)
|
||||
Z = (Z * Z) + C
|
||||
iter = iter + 1
|
||||
if (iter .GE. maxiter) then
|
||||
@@ -83,17 +93,22 @@ subroutine julia_colormapped(pic, cx, cy, maxiter)
|
||||
endif
|
||||
end do
|
||||
if (over_iter) then
|
||||
pic(ix, iy)%r = 0
|
||||
pic(ix, iy)%g = mod(abs(int(real(Z) *140)), 255)
|
||||
pic(ix, iy)%b = mod(abs(int(aimag(Z)*140)), 255)
|
||||
pic(ix, iy)%r = mod(int(modulus2(Z)*2000.0), 255)
|
||||
pic(ix, iy)%g = mod(abs(int(real(Z) *11.0)), 255)
|
||||
pic(ix, iy)%b = mod(abs(int(aimag(Z)*11.0)), 255)
|
||||
print *, ix, iy, Z, modulus2(Z)
|
||||
over = over + 1
|
||||
else
|
||||
pic(ix, iy)%r = mod(iter*22, 255)
|
||||
pic(ix, iy)%g = mod(iter*59, 255)
|
||||
pic(ix, iy)%b = mod(iter*21, 255)
|
||||
pic(ix, iy)%r = mod(iter*11, 255)
|
||||
pic(ix, iy)%g = mod(iter*14, 255)
|
||||
pic(ix, iy)%b = mod(iter*17, 255)
|
||||
under = under + 1
|
||||
endif
|
||||
enddo ! iy
|
||||
enddo ! ix
|
||||
|
||||
print *, "under", under, "over", over
|
||||
|
||||
end subroutine
|
||||
!===============================================================
|
||||
end module
|
||||
|
||||
Reference in New Issue
Block a user