Skip to content

Preserve ellipse size when constructing from polynomial coefficients - #290

Open
xixihaha-ha wants to merge 1 commit into
rai-opensource:masterfrom
xixihaha-ha:fix/ellipse-polynomial-size
Open

xixihaha-ha wants to merge 1 commit into
rai-opensource:masterfrom
xixihaha-ha:fix/ellipse-polynomial-size

Conversation

@xixihaha-ha

Copy link
Copy Markdown
Contributor

Ellipse.Polynomial([1, 1, 0, 0, 0, -4]) currently returns a unit circle, although the equation is x**2 + y**2 = 4 and the radius should be 2. The constant coefficient is ignored unless a perimeter point is supplied.

Normalize the ellipse matrix after completing the square, using the constant term and the computed centre. Preserve the optional perimeter-point override and clarify that both supported coefficient formats determine the ellipse size.

Regression tests cover circles at the origin and translated circles, coefficient rescaling, rotated ellipses, and the five-coefficient form. Against unchanged master (25b19b3), five new subcases fail; all seven pass with the fix. Full suite on Windows/Python 3.11.14: 567 passed, 4 skipped, 106 subtests passed. Black 23.10.0 and git diff --check pass.

Implementation and tests prepared and validated with OpenAI Codex assistance.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant