use 3d algorithm
add last edge