Returns the distance from the perimeter of rect to pt. If the point is within the rectangle, 0 is returned.
rect
pt
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 }); Copy
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 });
Rectangle
Point
Distance
Returns the distance from the perimeter of
rect
topt
. 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