fix something

add ref http://mrl.nyu.edu/~dzorin/ig06/lecture20/lecture20.pdf

some problem with boudary edge handling