Rotated Ellipse Bounding Box Calculator

Enter an ellipse, a centered rectangular opening, and two directions for the major axis. See where each orientation fits, meets a wall, or extends beyond it. The worksheet gives exact dimensions and scale limits using a signed direction pair.

Analytic geometry

Check a rotated ellipse against a box

Compare two orientations in the same centered opening. See the clearance at each wall, the smallest box, and the maximum scale at each direction.

Ellipse, opening and directions

Semiaxes
Centered opening
Major-axis direction A
Major-axis direction B

Use the same length unit throughout. Enter nonzero direction pairs such as (3, 4) or (4, −3).

Fit comparison

A: Fits with contact · B: Does not fit
Ellipse and box clearance
Centered ellipse and box in direction ADirection A. Fits with contact. Width touches. Height clear. Scale limit: width.Height axisWidth axis
  • Entered box
  • Ellipse
  • Smallest box
  • Farthest points

Direction A · Fits with contact

Maximum scale 1× · Width binds

Width · Touches
Minimum width
34/5
Squared half-extent
289/25
Clearance per side
0
Height · Clear
Minimum height
√(1744/25)
Squared half-extent
436/25
Clearance per side
21/5 − √(436/25) ≈ 0.023877396

Direction B · Does not fit

Maximum scale √(289/436)× · Width binds

Width · Interferes
Minimum width
√(1744/25)
Squared half-extent
436/25
Clearance per side
17/5 − √(436/25) ≈ -0.7761226
Height · Clear
Minimum height
34/5
Squared half-extent
289/25
Clearance per side
4/5

Each wall’s clearance is its distance from the center minus the ellipse’s reach in that direction. Negative clearance means interference. A scale of 1 preserves the original size.

View CSV text

How to use this calculator

  1. Enter the major and minor semiaxes and the full width and height of the centered box.
  2. Enter signed x and y components for each major-axis direction. Use the same pair twice to check a single direction.
  3. Read the two fit results and their independent wall clearances. Compare their smallest box dimensions and maximum uniform scale.
  4. Select a direction on the plot and optionally show its maximum-scale outline. Download the audit for both directions.

The Formula

The mathematical logic powering this calculation is:

Let a ≥ b > 0 be the major and minor semiaxes. For nonzero direction (u, v) define D = u² + v². The rotation has cosine u/√D and sine v/√D. Rotating the local ellipse (a cos t, b sin t) makes its x coordinate a u cos(t)/√D − b v sin(t)/√D and y coordinate a v cos(t)/√D + b u sin(t)/√D. The largest projection of a cosine and sine combination is the square root of the sum of its squared coefficients.

The squared half-width is Rx = (a²u² + b²v²)/D. The squared half-height is Ry = (a²v² + b²u²)/D. The smallest axis-aligned box has full dimensions 2√Rx by 2√Ry. For entered full width W and height H, compare (W/2)² to Rx and (H/2)² to Ry exactly. Equality means contact with both opposite walls. The signed clearance per side is W/2 − √Rx or H/2 − √Ry. Positive clearance leaves space and negative clearance indicates interference.

The maximum uniform scale is √min(W²/(4Rx), H²/(4Ry)). The smaller ratio binds, and both bind when the ratios are equal. The outline preserves the selected direction and both centers. The dotted bounding rectangle encloses the original ellipse, and the four marked points are its axis extrema.

Enter lengths using one common unit. Lengths must be positive, and all magnitudes are capped at 1,000,000 with up to 12 decimal places. Both direction components may have either sign. Inputs and fit comparisons use exact rational arithmetic. Dimensions and scale are shown in exact radical form unless the root is rational. The graphic and approximate margins are numerical.

Worked Example

If you input:

  • Semiaxes: 5 and 2
  • Direction A: 3:4
  • Direction B: 4:−3
  • Centered box: 6.8 × 8.4

Result:

Direction A fits exactly at width 6.8, with height clearance. Direction B extends past the width walls. Changing the width to 6.799999 makes A interfere as well.

Frequently Asked Questions

Do the direction components have to form a unit vector?

Any nonzero pair works. Multiplying both components by the same nonzero value keeps the same major-axis line and dimensions.

Can I enter a circle?

Yes. Equal semiaxes give the same minimum width and height for both directions.

Does a zero clearance count as fitting?

Yes. The ellipse touches both opposite walls on that axis. Positive clearance on both axes is required for a fit with clearance.

What is the smallest box in this worksheet?

It is the tightest axis-aligned box for the orientation you entered. Changing the orientation can change both dimensions.

Similar Calculators