discontinuedPackage jet_cad_floor_plan has been discontinued and replaced by jet_cad_2d_plan.

pointInRingXY function

bool pointInRingXY(
  1. double x,
  2. double y,
  3. List<Vector2> r
)

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;
}