I tried with your triloc function. Is it correct that this keeps track of the previous found triangle ?
So assuming i go to the next point in the grid and when this is inside of the same triangle, this one is tested first ?
What triloc does is always start from the last triangle it found.
Then tested if points lies to the left of first edge of triangle,
if true we test the second edge and the third. If all three
test are true means we found the triangle.
If at any of the test we find that the point lies to the right
we go to the triangle that has a common edge with the
edge we were testing.
However in a triangulation with constraints the function
is not guaranteed to find it's way, it could enter in a loop.
To fix that we can use the so called "Remembering Stochastic Walk".
This one start testing on a random edge of the triangle under test
and proceed with the same kind of test as above.
This way one is certain that eventually it will find its way. However
in some degenerate case the walk could be long.
ymg