Skip to content

Honor the requested ellipse polygon vertex count - #308

Open
kaushikgunasekaren wants to merge 2 commits into
rai-opensource:masterfrom
kaushikgunasekaren:fix-ellipse-polygon-count-nov16
Open

kaushikgunasekaren wants to merge 2 commits into
rai-opensource:masterfrom
kaushikgunasekaren:fix-ellipse-polygon-count-nov16

Conversation

@kaushikgunasekaren

Copy link
Copy Markdown

Bug

Ellipse.polygon(resolution=N) returns N-1 vertices despite documenting N polygon vertices. For example, resolution=4 produces a triangle, and resolution=3 produces only two vertices with zero area.

Fix

Pass the requested resolution to the ellipse sampler. Polygon2 already adds its closing vertex internally; subtracting one was unnecessary. Correct the documented default to match the existing value of 10.

Validation

  • 19 regression cases cover resolutions 3, 4, 5, 10, 20 and 51, a circle and two translated/rotated ellipses, and the default resolution.
  • Check the unique and closed vertex counts, exact closing vertex, agreement with Ellipse.points(), the ellipse equation and regular-inscribed-polygon area.
  • Before: all 19 cases fail. After: all 19 pass.
  • Full local suite on Python 3.12: 585 passed, 3 skipped, 99 subtests passed; 21 existing warnings. Pristine master25b19b3: 566 passed with the same skips/subtests/warnings.
  • Black23.10.0, fatal-error flake8 checks and git diff --check on the change pass.

AI assistance was used for investigation, implementation and tests. Validated locally without robot hardware.

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