Urgent.News

What's breaking now, across hundreds of outlets.

Tech

Healing Messy Hand-Drawn Floor Plan Graphs into Watertight CAD Geometry in TypeScript

If you ask a vision model to extract wall segments from a photograph of a hand-drawn floor plan — or let a human sketch walls freely with a mouse — the output looks plausible at a glance and fails catastrophically the moment you try to compute room polygons, square footage, 3D wall meshes, or layered AutoCAD .DXF files. The failures are always the same four geometric defects: Open corners: Two…

The healing process begins with connected-component vertex welding, using a disjoint-set (Union-Find) structure with path compression. This method ensures that vertices within a specified weldRadiusIn (default 8 inches) are grouped into components, preventing order-dependent errors during the welding process. Next, walls are snapped to angles within a 6-degree range, followed by re-welding vertices within the same weldRadiusIn.

Afterward, the algorithm splits X-intersections and T-junctions within a 6-inch range, deduplicating and culling any degenerate walls. Finally, all openings are clamped safely inside the host wall endpoints, ensuring a clean, watertight CAD geometry for further processing.

Rewritten by urgent.news; may contain errors — check the original.

Source: dev.to

Read the original at dev.to →

Report a problem with this story

More in Tech

Validate the Whole Quantity String Before Converting It to a Number

A warehouse import can receive a quantity as text. If its contract requires a non-negative whole number, parsing a numeric prefix is too permissive: parseInt("12pcs", 10) returns 12 rather than…

  • Validate quantity string before conversion to prevent invalid input issues
  • Check if input matches required pattern using regular expression
  • Throw TypeError if input is not a string or doesn't match pattern

How Water-Eject Sounds Work: Building a Speaker Cleaner with the Web Audio API

Press a button, hear a buzzing sweep, and droplets of water jump out of your phone's speaker grill. It looks like a trick, but it is just physics plus a few lines of JavaScript.

  • Water droplets emerge from speaker grille when button pressed
  • Low-frequency tones make speaker cone move most, pushing water out
  • Web Audio API creates oscillator, gain node, and frequency sweep

More from Thursday 26 November →