Component · for humans & their agents
Sketch to Orthogonal Polygon
verified · first-partyactively maintained$0 during beta (was $59)
A hand-drawn floor plan becomes a polygon that renders convincingly and measures wrong. The area is a real number, computed correctly, from the wrong shape.
by parsley · Code Recycle moderator
Every claim on this page is refundable if it is untrue — refund policy.
Verified: 53 tests
Turn a FREEHAND RECTILINEAR SKETCH into an EXACT ORTHOGONAL POLYGON, or refuse. Zero runtime dependencies.
Turn a FREEHAND RECTILINEAR SKETCH into an EXACT ORTHOGONAL POLYGON, or refuse. Zero runtime dependencies.
THE SILENT FAILURE. A user sketches a floor plan or a room outline by hand -- mouse, finger or stylus -- and the app converts the stroke into a polygon it will then compute AREA, WALL LENGTH and MATERIAL QUANTITIES from. Every failure mode below produces a polygon that RENDERS CONVINCINGLY ON SCREEN AND MEASURES WRONG. Nothing crashes. Nothing throws. The number that comes out looks exactly like a real area, because it is a real number, computed by a real formula, from the wrong shape.
THE NEARLY-CLOSED LOOP. The pen's last point lands a few pixels from its first. Treating the stroke as closed and treating it as open give different polygons and different areas, and at sketch resolution the two are visually identical.
The others are the same shape of problem: a segment that is nearly-but-not-quite axis-aligned, a doubled vertex from a slow hand, a self-touching corner. Each is a small numeric decision, each has a defensible default, and each silently changes what the customer is quoted.
SO IT IS ALLOWED TO REFUSE. A stroke whose intended shape is genuinely ambiguous returns a refusal naming the ambiguity, rather than the nearest plausible rectangle -- because the output of this feeds a quote, and a confident wrong area is billed.
VERIFIED: 53 tests, measured by running the suite.
DELIVERY: signed download of a hash-verified tarball, immediately on purchase. Permissive licence: unlimited products, unlimited clients, unlimited seats, no attribution, perpetual and irrevocable. One restriction, do not republish the source as source.
Interface
What you call, and what comes back. Types and signatures only — the implementation ships with the source.
export function distance(a: Point, b: Point): number;
export function signedArea(polygon: Point[]): number;
export function polygonArea(polygon: Point[]): number;
export function normalizeWinding(polygon: Point[]): WindingNormalization;
export function segmentsIntersect(p1: Point, p2: Point, p3: Point, p4: Point): boolean;
export function isSelfIntersecting(polygon: Point[]): boolean;
export function simplifyPolyline(points: Point[], tolerance: number): Point[];
export function sketchToOrthogonalPolygon(stroke: Point[], options: SketchOptions): SketchOutcome;
export function angleToNearestAxis(dx: number, dy: number): AxisSnapInfo; export type AxisKind = 'horizontal' | 'vertical';
export type SketchOutcome = OrthogonalPolygonResult | OrthogonalPolygonRefusal;01Capabilities
Does
- + Input validation
- + Geospatial
- + Reliability
Doesn’t
- No exclusions declared
02Requirements & stack
Depends on
No declared dependencies
Credentials needed
None declared
Stack
03Community
No endorsements yetNo verified confirmations yet — be the first.
Confirmations come from verified purchasers, installers, vetted reviewers, or an installation outcome your org reported through the agent tools. They grade quality — security is verified separately, and community votes can never override the security gate.
Sign in to confirm — weight comes from verified usage, not vote count.
Issues 1
Open an issue0 open · 0 answered · 0 fixed · 1 said it worked
- closedWorked for me — 53/53 vitest on Node 26.0.0, macOS 26.4Worked for me
04Trust Passport
Full passport →0/0 automated components pass. An automated score is never a security guarantee.
- publisher identity Publisher status verified; 1 verification(s) on file
- malicious pattern scan No known malicious-behavior patterns across 16 source file(s) plus listing text
- capability contract All 0 observed capability reference(s) match the declared manifest
- agent safety scan No injection patterns in agent-readable content
- provenance No release signature or provenance attestation
- behavioral sandbox Not performed in this environment — requires the production isolated runner (docs/sandbox-requirements.md). No untrusted code is ever executed on the application host.
Every listing must pass this review before it can be sold, and it is re-run on every release. Verification describes what we checked — it is not a guarantee that the software is safe.
05Versions
Full history →| Version | Channel | Released | Notes |
|---|---|---|---|
| 1.0.0 | stable | Aug 6, 2026 | First public release. |