Repository navigation
Update the widths and the area in GeneralizedTrapezoid::extend_left - #148
Merged
Merged
Conversation
extend_left moved the left side of the generalized trapezoid and updated its smallest x and its left slope, but not its widths and its area, which the constructor computes from the corners. So after extend_left, width_top, width_bottom and area returned the values of the generalized trapezoid before it was extended: for a trapezoid of area 6 extended to an area of 11, area still returned 6. extend_left now recomputes them like the constructor.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Cause
extend_leftmoved the left side of the generalized trapezoid and updated its smallest x and its left slope, but not its widths and its area, which the constructor computes from the corners. So afterextend_left,width_top,width_bottomandareareturned the values of the trapezoid before it was extended: for the trapezoid(0, 2, 2, 6, 3, 5)of area 6,extend_left(0)gives an area of 11, butarea()still returned 6 andwidth_bottom()4 instead of 6.Fix
extend_leftrecomputeswidth_top_,width_bottom_andarea_like the constructor (the height doesn't change).PackingSolver calls
extend_leftinsrc/irregular/tree_search.cpp, but only readsheight()and the corners of the extended trapezoids, which were already right, so its behaviour doesn't change.Tests
New
GeneralizedTrapezoidExtendLeftTest: the extended trapezoid is compared, including all its computed attributes, with the trapezoid built directly with its left side atx = l, for a left side going right, going left, a vertical left side and a triangle. The four cases fail before the fix; the full suite passes after it (697 tests).