Skip to content

Document the last undocumented functions of trapezoid and simplification - #143

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

fontanf merged 1 commit into
mainfrom
document-trapezoid-simplify-leftovers

Conversation

@fontanf

@fontanf fontanf commented Oct 17, 2026

Copy link
Copy Markdown
Owner

Problem

GeneralizedTrapezoid::compute_top_right_shift, GeneralizedTrapezoid::to_svg and simplify_export_inputs were the last public functions of the library without documentation.

Change

  • compute_top_right_shift: documented as compute_right_shift along the direction of slope a, towards increasing x: it returns by how much the x of the trapezoid must increase (its y increasing by a times as much) for it to be right next to the other one, i.e. the largest shift at which a vertex of one of them meets a side of the other; 0 if there is none. a must be non-zero.
  • to_svg: y-axis going up, coordinates multiplied by factor, filled with color.
  • simplify_export_inputs: writes the inputs of simplify to a JSON file.

The contract of compute_top_right_shift is inferred from its code and from GeneralizedTrapezoidComputeTopRightShiftTest (two rectangles side by side, moved along slope 1, touch at a corner after an x shift of 2); it isn't used elsewhere in the library.

Tests

Comments only; the library builds and the trapezoid and simplification tests pass.

compute_top_right_shift is documented like compute_right_shift, whose
move it generalizes to a direction of slope 'a': it returns by how much
the x of the generalized trapezoid must increase, moving along this
direction, for it to be right next to the other one. GeneralizedTrapezoid
::to_svg and simplify_export_inputs are documented too.
@fontanf
fontanf merged commit 687244c into main Oct 17, 2026
3 checks passed
@fontanf
fontanf deleted the document-trapezoid-simplify-leftovers branch October 17, 2026 23:14
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