Advanced maths

Largest inscribed ball calculator from linear inequalities

Find the largest Euclidean ball contained in a bounded low-dimensional polytope described by linear inequalities.

Your numbers

Rows separated by semicolons; values by commas.

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

Find the largest Euclidean ball contained in a bounded low-dimensional polytope described by linear inequalities. The page reports a center, radius and active constraints under a floating-point LP vertex search. It is an inscribed-ball problem, distinct from a smallest enclosing sphere and from reconstructing the polytope’s vertices alone.

THE FORMULAmax r subject to a_i·c+||a_i||r≤b_i and r≥0.

A worked example

The square −1 ≤ x ≤ 1, −1 ≤ y ≤ 1 has its largest inscribed disk centered at (0,0), with radius 1. Its four halfspace constraints all become active at tangency. Distances to the square's corners do not determine the inscribed radius.

Good to know

Bounded full-dimensional polytope dimension1–3,≤20halfspaces. Floating-point LP vertex enumeration and recession checks; infeasibility/degeneracy not comprehensively classified.

Write every inequality in the same direction

Each row contains coefficients a1 through ad followed by b and means a dot x less than or equal to b. The normal vector a must be nonzero. A constraint written in the opposite direction must be multiplied through by minus one before entering it.

Dimension is inferred from row length and must be one through three. Every row uses that same dimension. The form assumes a bounded full-dimensional intersection, not a general unbounded feasible region or a flat polygon embedded in a higher-dimensional ambient space.

The largest inscribed disk touches all four sides of a square0−1 ≤ x,y ≤ 1Center: (0,0)Radius: 1
The square −1 ≤ x ≤ 1, −1 ≤ y ≤ 1 has its largest inscribed disk centered at (0,0), with radius 1. Its four halfspace constraints all become active at tangency. Distances to the square's corners do not determine the inscribed radius. Diagram is schematic; labels specify the numerical values.

The Minimum annulus calculator with bounded center coordinates minimizes the thickness of an enclosing circular band. An inscribed ball must stay inside every halfspace, so constraints with different normal lengths must be scaled by their Euclidean norms.

Derive the ball-containment inequality

A ball centered at c with radius r reaches furthest along normal a at a dot c plus norm(a) times r. It stays inside that halfspace exactly when this quantity is at most b. Adding r nonnegative turns the largest-ball problem into a linear program in the center coordinates and radius.

The normal length factor is essential. Omitting it would make equivalent rescalings of one inequality change the result. Multiplying a row and its right side by a positive constant preserves the halfspace and must preserve the contained-ball problem. The Euclidean norm convention is part of that invariance.

Verify the centered square

The default inequalities bound both coordinates between minus one and one. A disk centered at zero with radius one touches all four sides and remains inside. A larger radius cannot fit between either pair of parallel sides separated by two, so one is maximum.

The smallest enclosing circle of the square instead has radius sqrt(2) because it must reach the corners. Confusing enclosing and inscribed objectives would give the wrong answer despite using the same polygon. The page’s radius describes clearance to limiting halfspaces, not distance to the farthest vertex.

Read active constraints as a local witness

At a candidate optimum, active inequalities satisfy the ball-containment equation at equality within numerical tolerance. The solver enumerates candidate vertices of the augmented center-radius linear feasible set and tests feasibility against every inequality, retaining the largest positive radius.

The returned active indices refer to input rows, with the radius nonnegativity constraint available internally. Multiple active subsets can describe the same center, and a maximum ball center need not be unique. The selected witness should not be interpreted as a unique set of physically important walls under every tie.

Respect boundedness and full dimension

An unbounded region can have no finite maximum radius, or can have a finite radius with an unbounded family of centers, depending on its geometry. This interface deliberately requires a bounded polytope and checks for recession directions rather than presenting every feasible halfspace system as the same problem.

A lower-dimensional feasible set has no positive ambient ball. If a positive full-dimensional candidate is not found, the error does not comprehensively distinguish infeasibility from degeneracy or numerical conditioning. Do not label every rejected system impossible without a separate feasibility analysis.

Understand numerical rather than rational certification

Input coefficients are finite decimals, but normalized wall lengths can involve irrational square roots. The LP search therefore uses floating-point equations and feasibility tolerances. The result is not an exact rational optimality certificate just because the original inequalities happened to contain integers.

Near-parallel walls and vastly different scales can make active systems ill-conditioned. Rescale meaningful units and compare independent solvers when a tiny clearance difference matters. The page does not attach a rigorous interval enclosure to every coordinate or certify a manufacturing tolerance from finite decimal output.

Use the Chebyshev-center interpretation carefully

The largest-inscribed-ball center is often called a Chebyshev center of the polytope under the Euclidean norm. Other norms give different balls and center problems. No alternate norm is inferred from unequal coordinate scales; the coordinates must represent a justified common Euclidean metric.

The calculator supports at most twenty halfspaces and does not reconstruct obstacles, holes or curved boundaries. A physical object with thickness or safety margins may need offset inequalities before this calculation. Keep the original constraints, metric, radius and numerical scope with any downstream placement decision.

A few questions, answered

Is this a smallest enclosing sphere?

No. It finds a largest ball inside all halfspaces.

Why does each normal use its Euclidean length?

That factor converts radius into the maximum halfspace projection and makes positive row scaling invariant.

Does rejection prove the constraints infeasible?

Not always. Degeneracy or numerical conditioning can also prevent a supported positive-ball result.

Can an optimal center be nonunique?

Yes. Several centers or active sets can attain the same maximum radius.

Find your calculator

Start typing to explore the library.