-
Notifications
You must be signed in to change notification settings - Fork 116
SplitPathCoord: Ensure monotony and bounds for at
#2331
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
split.path_coord_index = path_coords.upperBound(length, first.path_coord_index, first.path_coords->size()-1); | ||
if (length > first.clen) | ||
{ | ||
split.path_coord_index = path_coords.upperBound(length, first.path_coord_index, first.path_coords->size()-1); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fix for monotony.
if (qFuzzyCompare(1.0f + length, 1.0f + current_coord.clen) || | ||
qFuzzyCompare(1.0f + curve_length, 1.0f)) | ||
qFuzzyCompare(1.0f + curve_length, 1.0f) || | ||
length > current_coord.clen) | ||
{ | ||
// Close match at current path coordinate, | ||
// or near-zero curve length. | ||
// or near-zero curve length, | ||
// or length exceeding path length. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fix for upper bound.
|
||
split.index = path_coords[split.path_coord_index].index; | ||
} | ||
|
||
split.index = path_coords[split.path_coord_index].index; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Drive-by change. When not entering the if
branch, the right split.index
is implied by initialization of split
.
For #2325. Test first.
Unlike #2325, this touches the behavior of a core function. While the change is reasonable IMHO, this may need more testing. Other parts of Mapper might implicitly rely on the broken cases.