Skip to content

Commit

Permalink
Restructure index finding
Browse files Browse the repository at this point in the history
  • Loading branch information
svengoldberg committed Jun 5, 2024
1 parent adaeb87 commit 0db139a
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions src/geometry/CTiglBSplineAlgorithms.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -361,12 +361,11 @@ namespace
[&u](double v){ return u <= v; }
);

int paramsIdx;
// Catch case u=0, since distance would be 0 which causes in illegal vector access with subtraction of 1
if (*it == 0)
paramsIdx = 1;
else
paramsIdx = std::distance(paramsOld.begin(), it);
int paramsIdx = std::distance(paramsOld.begin(), it);
// Catch case u=0, since distance would be 0 which causes illegal vector access by subtraction of 1
if (paramsIdx == 0) {
++paramsIdx;
}

a_x = paramsOld[paramsIdx - 1];
b_x = paramsOld[paramsIdx];
Expand Down

0 comments on commit 0db139a

Please sign in to comment.