correctOutOfRangeRadii function
Implementation
List<double> correctOutOfRangeRadii(
double rx, double ry, double x1p, double y1p) {
rx = rx.abs();
ry = ry.abs();
var lambda = (x1p * x1p) / (rx * rx) + (y1p * y1p) / (ry * ry);
if (lambda > 1) {
var sqrtLambda = sqrt(lambda);
rx *= sqrtLambda;
ry *= sqrtLambda;
}
return [rx, ry];
}