Fortraneries/BloubWorld/bloubspace.f90

57 lines
1.3 KiB
Fortran
Raw Normal View History

2022-02-07 09:45:08 +11:00
!
! fonctions de base de gestion des bloubs
!
module bloubspace
implicit none
! ----------------------------------------------------------------
type t_bloubs
character(8) :: nick
logical :: alive
integer :: num
real :: px, py, pz
real :: vx, vy, vz
real :: radius
integer :: seq
end type t_bloubs
contains ! -----------------------------------------
subroutine random_pv (blb)
type(t_bloubs), intent (inout) :: blb
blb%px = rand() - 0.50
blb%py = rand() * 0.25
blb%pz = rand() - 0.50
2022-02-07 12:08:17 +11:00
blb%vx = (rand() - 0.5) / 4.000
blb%vy = (rand() - 0.5) / 4.000
blb%vz = (rand() - 0.5) / 4.000
2022-02-07 09:45:08 +11:00
end subroutine
! ----------------------------------------------------------------
subroutine move_bloub (blb, coef)
type(t_bloubs), intent (inout) :: blb
real, intent (in) :: coef
2022-02-07 12:08:17 +11:00
! we must check that this bloub is alive ?
2022-02-07 09:45:08 +11:00
blb%px = blb%px + (blb%vx * coef)
blb%py = blb%py + (blb%vy * coef)
blb%pz = blb%pz + (blb%vz * coef)
blb%seq = blb%seq + 1
end subroutine
! ----------------------------------------------------------------
end module