update util
This commit is contained in:
parent
06aefa538a
commit
a5931eb9ec
2 changed files with 10 additions and 2 deletions
|
@ -1277,7 +1277,7 @@ inline size_t convexHullImpl(const MultiPoint<T>& a, size_t p1, size_t p2,
|
|||
for (const auto& p : a) {
|
||||
double tmpDist = distToSegment((*h)[p1], (*h)[p2], p);
|
||||
double cp = crossProd(p, LineSegment<T>((*h)[p1], (*h)[p2]));
|
||||
if ((cp > 0) && tmpDist > maxDist) {
|
||||
if ((cp > 0 + EPSILON) && tmpDist > maxDist) {
|
||||
pa = p;
|
||||
found = true;
|
||||
maxDist = tmpDist;
|
||||
|
|
|
@ -499,17 +499,23 @@ SharedSegments<T> PolyLine<T>::getSharedSegments(const PolyLine<T>& pl,
|
|||
|
||||
double totalDist = dist(s, e);
|
||||
while (curSegDist <= totalDist) {
|
||||
const Point<T>& curPointer = interpolate(s, e, curSegDist);
|
||||
const auto& curPointer = interpolate(s, e, curSegDist);
|
||||
|
||||
if (pl.distTo(curPointer) <= dmax) {
|
||||
LinePoint<T> curCmpPointer = pl.projectOn(curPointer);
|
||||
LinePoint<T> curBackProjectedPointer = projectOn(curCmpPointer.p);
|
||||
|
||||
|
||||
skips = 0;
|
||||
|
||||
if (in) {
|
||||
curEndCand = curBackProjectedPointer;
|
||||
curEndCandCmp = curCmpPointer;
|
||||
|
||||
if (curEndCand.totalPos < curStartCand.totalPos) {
|
||||
curEndCand = curStartCand;
|
||||
}
|
||||
|
||||
single = false;
|
||||
|
||||
comp = fabs(curStartCand.totalPos * length -
|
||||
|
@ -530,6 +536,7 @@ SharedSegments<T> PolyLine<T>::getSharedSegments(const PolyLine<T>& pl,
|
|||
curEndCand.totalPos * length) > MIN_SEG_LENGTH &&
|
||||
fabs(curStartCandCmp.totalPos * plLength -
|
||||
curEndCandCmp.totalPos * plLength) > MIN_SEG_LENGTH)) {
|
||||
assert(curStartCand.totalPos < curEndCand.totalPos);
|
||||
ret.segments.push_back(
|
||||
SharedSegment<T>(std::pair<LinePoint<T>, LinePoint<T>>(
|
||||
curStartCand, curStartCandCmp),
|
||||
|
@ -566,6 +573,7 @@ SharedSegments<T> PolyLine<T>::getSharedSegments(const PolyLine<T>& pl,
|
|||
MIN_SEG_LENGTH &&
|
||||
fabs(curStartCandCmp.totalPos * plLength -
|
||||
curEndCandCmp.totalPos * plLength) > MIN_SEG_LENGTH)) {
|
||||
assert(curStartCand.totalPos < curEndCand.totalPos);
|
||||
ret.segments.push_back(SharedSegment<T>(
|
||||
std::pair<LinePoint<T>, LinePoint<T>>(curStartCand, curStartCandCmp),
|
||||
std::pair<LinePoint<T>, LinePoint<T>>(curEndCand, curEndCandCmp)));
|
||||
|
|
Loading…
Reference in a new issue