approximatelyEqual static method

bool approximatelyEqual(
  1. Vec2D a,
  2. Vec2D b, {
  3. double threshold = 0.001,
})

Implementation

static bool approximatelyEqual(Vec2D a, Vec2D b, {double threshold = 0.001}) {
  var a0 = a.x, a1 = a.y;
  var b0 = b.x, b1 = b.y;
  return (a0 - b0).abs() <=
          threshold * math.max(1.0, math.max(a0.abs(), b0.abs())) &&
      (a1 - b1).abs() <=
          threshold * math.max(1.0, math.max(a1.abs(), b1.abs()));
}