mirror of
https://github.com/UpsilonNumworks/Upsilon.git
synced 2026-01-19 00:37:25 +01:00
[poincare/zoom] Handle NAN in ExpandSparseWindow
This commit is contained in:
committed by
EmilieNumworks
parent
35bfb8ec16
commit
185c780215
@@ -470,8 +470,13 @@ void Zoom::ExpandSparseWindow(float * sample, int length, float * xMin, float *
|
||||
for (int i = 0; i < length; i++) {
|
||||
float x = *xMin + i * step;
|
||||
float y = sample[i];
|
||||
float r = 2 * std::max(std::fabs(x - xCenter) / xRange, std::fabs(y - yCenter) / yRange);
|
||||
emptyCenter = std::min(emptyCenter, r);
|
||||
if (std::isfinite(y)) {
|
||||
/* r is the ratio between the window and the largest rectangle (with same
|
||||
* center and shape as the window) that does not contain (x,y).
|
||||
* i.e. the smallest zoom-in for which (x,y) is not visible. */
|
||||
float r = 2 * std::max(std::fabs(x - xCenter) / xRange, std::fabs(y - yCenter) / yRange);
|
||||
emptyCenter = std::min(emptyCenter, r);
|
||||
}
|
||||
}
|
||||
|
||||
if (emptyCenter > emptyCenterMaxSize) {
|
||||
|
||||
Reference in New Issue
Block a user