Skip to content

Document GeneralizedTrapezoid and remove its unused covered flags - #147

Merged
fontanf merged 1 commit into
mainfrom
document-generalized-trapezoid
Oct 17, 2026
Merged

fontanf merged 1 commit into
mainfrom
document-generalized-trapezoid

Conversation

@fontanf

@fontanf fontanf commented Oct 17, 2026

Copy link
Copy Markdown
Owner

Problem

About 20 methods of GeneralizedTrapezoid, written on a single line, had no documentation, and its top / bottom "covered" flags were used neither by the library nor by PackingSolver.

Change

  • Documented: shift_top, shift_right, extend_left, a_left / a_right (variation of x for a unit increase of y: 0 for a vertical side, positive if the side goes to the right going up), the *_increasing/decreasing_not_vertical directions, area(x_left) (area on the right of a vertical line), clean (sides whose slope is below 1e-2 or above 1e2 in absolute value are made vertical through their outermost corner, so that the result contains the trapezoid), operator== (y exact, x within tolerance), the symmetries, to_shape and the JSON functions.
  • The comment of width_top_, which said "Bottom height", is fixed.
  • set_top_covered, set_bottom_covered, top_covered, bottom_covered and their members are removed. They were added for the trapezoidal insertions of PackingSolver ("Implement trapezoidal insertions"), whose last uses were removed in "Re-write irregular branching scheme (#199)": neither PackingSolver's master nor the library uses them.

extend_left is documented with its intended behaviour: it currently doesn't update the cached widths and area. This will be fixed in a separate PR.

Tests

The slopes, their directions, both cases of area(x_left) and the area of to_shape were checked by running them. The library builds and the full suite passes (693 tests).

The remaining methods of GeneralizedTrapezoid are documented: the
moves, the slopes of the sides (the variation of x for a unit increase
of y) and their directions, the partial area on the right of a vertical
line, clean, which makes the almost vertical sides vertical so that the
result contains the generalized trapezoid, operator==, the symmetries,
to_shape and the JSON functions. The comment of width_top_ is fixed.

The top and bottom covered flags were added to optimize the trapezoidal
insertions of PackingSolver, but PackingSolver doesn't use them anymore
since its irregular branching scheme was rewritten, and the library
never used them. They are removed.
@fontanf
fontanf merged commit c343c87 into main Oct 17, 2026
3 checks passed
@fontanf
fontanf deleted the document-generalized-trapezoid branch October 17, 2026 23:57
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