Zero-size test
64-bitSays whether a line has no length or a circle or arc no radius.
line: |p₂ − p₁| ≤ 1e-9; circle or arc: r ≤ 1e-9
The limit 1e-9 is in drawing units and is not scaled to the drawing: in a drawing whose real features are that small, real objects would be reported. Only x and y are measured for a line. A negative radius also counts as zero-size.
/** Is this entity a zero-length line / zero-radius circle or arc? */
export function isEmpty(e) {
if (!e || typeof e !== 'object') return false;
if (e.type === 'line') return num(e.x1) && num(e.y1) && num(e.x2) && num(e.y2) && Math.hypot(e.x2 - e.x1, e.y2 - e.y1) <= tol;
if (e.type === 'circle' || e.type === 'arc') return num(e.r) && e.r <= tol;
return false;
}