module steering { # Bob Clapp's steering filter
  use helix
  integer, private :: n       # helix period
  real,    private :: hw, dc  # triangle half-width, filter d.c.
contains
  subroutine steer_init( hwidth, amp, n1) {
    real,    intent( in) :: hwidth, amp
    integer, intent( in) :: n1
    hw = hwidth; dc = amp; n = n1 
  }
  subroutine steering2( slope, aa) {
    type( filter)     :: aa
    real, intent( in) :: slope
    integer           :: h, nh
    real              :: p0,center    
    nh = size( aa%lag);  center=n+slope
    do h = 1, nh {		
       aa%lag(h) = ceiling(center- real(nh)/2.)-1+h
			 aa%flt(h) = abs(hw-abs(real(aa%lag(h))-center))/hw
   }
   aa%flt = -dc/sum( aa%flt)*aa%flt
  }
}
