Look at the WuLines functions in turbopixels. This is what you need, and I`ve yet to find any faster