# Parametric distance of a line in a grid (Line Integral Convolution)

## Main Question or Discussion Point

Hi, the above image is from the Line Integral Convolution paper by Cabral and Leedom. However, I am having a hard time implementing it, and I am quite certain I am misreading it. It is supposed to give me the distances of the lines like in the example below, but I am not sure how it can. First of all, it looks like sbottom=stopsbottom=stop and sright=sleftsright=sleft. Also, it looks like the answer will always be zero since ⌊Pi⌋−Pi⌊Pi⌋−Pi will always be negative for an image. Any advice on how I can make progress?

My current implementation is:

def ds(x,y): Vxy = V(x,y) s_top=max((floor(y)-y)/Vxy[1],0) s_bottom=max((floor(y)-y)/Vxy[1],0) s_right= max((floor(x)-x)/Vxy[0],0) s_left =max((floor(x)-x)/Vxy[0],0) return(min([s_top,s_bottom,s_right,s_left]))

And, it always returns 0 (yes, I know I have ignored the instance in which V is parallel to e, but first I have to fix the issues I wrote about above).