pointInRingXY function
pointInRing of the point (x, y): the same test, taking no Vector2,
so a caller that offsets the point allocates nothing.
Implementation
bool pointInRingXY(double x, double y, List<Vector2> r) {
var inside = false;
for (var i = 0, j = r.length - 1; i < r.length; j = i++) {
final a = r[i], b = r[j];
if ((a.y > y) != (b.y > y) &&
x < (b.x - a.x) * (y - a.y) / (b.y - a.y) + a.x) {
inside = !inside;
}
}
return inside;
}