lib/annlat/plot.rb
def normalize_vector(v)
    d = v[0]*v[0] + v[1]*v[1]
    if d != 1
      root = Math.sqrt(d)
      v[0] /= root
      v[1] /= root
    end
    v
  end
# normalize vector to 1 unit length
normalize vector to 1 unit length
normalize vector to 1 unit length
def normalize_vector(v)
    d = v[0]*v[0] + v[1]*v[1]
    if d != 1
      root = Math.sqrt(d)
      v[0] /= root
      v[1] /= root
    end
    v
  end
def normalize_vector ( v ) d = v [ 0 ] * v [ 0 ] + v [ 1 ] * v [ 1 ] if d != 1 root = Math . sqrt ( d ) v [ 0 ] /= root v [ 1 ] /= root end v end
normalize vector to 1 unit length
normalize vector to 1 unit length
v