ixfx
    Preparing search index...

    Function distanceFromExterior

    • Returns the distance from the perimeter of rect to pt. If the point is within the rectangle, 0 is returned.

      If rect does not have an x,y it's assumed to be 0,0

      import { Rects } from "https://unpkg.com/ixfx/dist/geometry.js";
      const rect = { width: 100, height: 100, x: 0, y: 0 };
      Rects.distanceFromExterior(rect, { x: 20, y: 20 });

      Parameters

      Returns number

      Distance