add inpoly.m from Daren Engwirda. Necessary for 2D test.