Partial revert of cubic curve distance

This commit is contained in:
Chlumsky 2025-06-20 16:40:02 +02:00
parent 15833154b3
commit 9e7901aa7c
1 changed files with 5 additions and 5 deletions

View File

@ -255,13 +255,13 @@ SignedDistance CubicSegment::signedDistance(Point2 origin, double &param) const
break; break;
qe = qa+3*t*ab+3*t*t*br+t*t*t*as; qe = qa+3*t*ab+3*t*t*br+t*t*t*as;
d1 = 3*ab+6*t*br+3*t*t*as; d1 = 3*ab+6*t*br+3*t*t*as;
}
double distance = qe.length(); double distance = qe.length();
if (distance < fabs(minDistance)) { if (distance < fabs(minDistance)) {
minDistance = nonZeroSign(crossProduct(d1, qe))*distance; minDistance = nonZeroSign(crossProduct(d1, qe))*distance;
param = t; param = t;
} }
} }
}
if (param >= 0 && param <= 1) if (param >= 0 && param <= 1)
return SignedDistance(minDistance, 0); return SignedDistance(minDistance, 0);