Shapes & spaces

Polygon medial axis calculator with segment and parabolic branches

Construct the interior Euclidean medial axis from polygon boundary segments and vertices, with actual line or parabola branch descriptions and nearest-boundary radii.

Your numbers

Calculated on your device. Your inputs aren’t sent to us.

Your result

Ready when you are

Enter your inputs and select Calculate.

Report an issue

Behind the numbers

How this calculation works

Construct the interior Euclidean medial axis from polygon boundary segments and vertices, with actual line or parabola branch descriptions and nearest-boundary radii.

THE FORMULAM = {x inside P : at least two distinct boundary points minimize distance to x}.

A worked example

For a 4 by 2 rectangle, the medial axis has a central segment from (1,1) to (3,1), with radius 1, and four diagonal branches to the corners.

Good to know

Simple polygon≤10 vertices, integer coordinates, no holes or unresolved degeneracies. Segment-site Voronoi construction clipped to the interior, with edge/vertex nearest-site verification and maximal-disk radii. Return actual line/parabola branch descriptions; no sampled ridgeline presented as an exact medial axis.

What the medial axis represents

Imagine expanding a disk inside a room until its boundary touches the walls in more than one place. Centers of maximal such disks form the Euclidean medial axis. The radius attached to each center records its clearance from the polygon boundary, so the result carries both a skeletal shape and a local width measurement.

A medial branch is more than a line drawn through the middle of a picture. Its points must have competing nearest boundary locations. For a nonconvex polygon those locations may include a reflex corner, producing curved branches. This page distinguishes these Euclidean distance constructions from a straight skeleton generated by moving supporting lines inward.

Polygon medial axis calculator with segment and parabolic branches worked example4 × 2 rectangleCentral radius = 1Five medial branches
Scroll across to see the full diagram.
For a 4 by 2 rectangle, the medial axis has a central segment from (1,1) to (3,1), with radius 1, and four diagonal branches to the corners.

Compare this with the Polygon straight skeleton calculator with inward offset events. Construct the locus of centers having multiple nearest boundary points; the straight skeleton traces inward moving-edge intersections and differs at reflex-corner parabolic branches.

Entering the boundary reliably

List the polygon vertices in their boundary order, with one coordinate pair on each row. The final vertex is connected back to the first automatically. Repeating the first row creates an unnecessary zero-length edge. Integer coordinates keep geometric predicates easier to interpret, but the branch coordinates and radii can still contain square roots.

The polygon must be simple, with no holes or crossing sides. Consecutive collinear vertices should be removed before calculation because splitting one straight wall into several sites adds artificial boundary descriptions. If a geometric degeneracy cannot be resolved, the correct outcome is an explicit unresolved result rather than an arbitrary choice of branches.

Why some branches are parabolas

Two distinct straight walls give angle-bisector branches when perpendicular feet lie within both segments. A wall and a corner instead give points equally distant from a line and a focus. That locus is a parabola. A pair of corner sites gives a straight perpendicular bisector, subject to each corner actually being a nearest point.

Each algebraic bisector must therefore be restricted to the valid domains of its sites. Continuing a wall beyond its endpoint can create a convincing but false branch. The construction also clips candidate arcs to the polygon interior and compares their distance with every other boundary feature before accepting a positive-length branch.

Reading branch endpoints and radii

The branch description identifies its supporting boundary features and its parameter interval. Endpoints occur where another feature becomes equally near, where a site-domain condition changes, or where the closure reaches a polygon corner. Adjacent branches can meet at a center with three or more nearest boundary contacts; such a junction should appear only once.

The radius is distance from the center to the actual boundary, not distance to an infinite supporting line unless its perpendicular projection lies on the segment. Twice the radius describes the diameter of the associated inscribed disk. It does not automatically describe a traversable corridor width for an object with a different shape.

A rectangle that can be checked by hand

For the default rectangle with vertices (0,0), (4,0), (4,2) and (0,2), the largest inscribed disks have radius one. Their centers occupy the horizontal segment from (1,1) to (3,1). Each disk on that segment touches both horizontal sides, and the endpoint disks also touch a vertical side.

Four diagonal branches connect those two junctions to the corners in the closure of the axis. Their radii shrink to zero at the corners. Thus the rectangle has five positive-length branches when the central segment is counted once. The diagram is a worked reference, while a nonconvex boundary may require genuinely parabolic pieces.

Checking the geometric certificate

A useful branch check selects interior parameter values, computes all boundary distances and confirms that the declared sites tie for the smallest distance. That check supplements the analytic clipping; it cannot replace it with a dense image grid. Endpoint incidence and continuity of the radius provide additional ways to find a missed junction or an incorrectly trimmed arc.

Translation and rigid rotation preserve radii and branch adjacency. Multiplying all coordinates by a positive factor multiplies lengths and radii by that factor. These tests can expose accidental dependence on screen pixels. Reflecting a polygon reverses its orientation but should produce the reflected axis with the same clearance data and connectivity.

Choosing an appropriate downstream use

Use the result to understand shape, clearance or the center locations of maximal inscribed disks. The axis can have small branches created by small boundary features, so an application may need a separate, explicit pruning policy. Removing those branches changes the result and should not be described as the exact unpruned medial axis.

A navigation system still needs robot geometry, obstacle margins and a path-planning method. This page does not prove a chosen route is collision-free or shortest. Similarly, an unresolved input does not mean that the mathematical polygon lacks a medial axis; it means the supported construction did not establish an acceptable branch certificate.

A few questions, answered

Is this the straight skeleton?

No. Euclidean nearest-boundary distance can produce parabolic arcs, whereas a straight skeleton follows a different moving-edge construction.

Why are corner branches included?

The closure includes centers whose maximal-disk radii approach zero at convex corners.

Can I submit a polygon with a hole?

No. This bounded construction accepts one simple boundary only.

Does sampling many centers certify the axis?

No. Sampling can check a constructed branch, but it does not prove that all branches were found or clipped correctly.

Find your calculator

Start typing to explore the library.