File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -482,18 +482,37 @@ Bbox::update_numerix(const Py::Tuple &args) {
482482 double thisx, thisy;
483483 int ignore = Py::Int (args[2 ]);
484484 if (ignore) {
485- thisx = *(double *)(x->data );
486- thisy = *(double *)(y->data );
487- minx=thisx;
488- maxx=thisx;
489- miny=thisy;
490- maxy=thisy;
485+ int xok=0 ;
486+ int yok=0 ;
487+ // loop through values until we find some nans...
488+ for (size_t i=0 ; i< Nx; ++i) {
489+ thisx = *(double *)(x->data + i*x->strides [0 ]);
490+ thisy = *(double *)(y->data + i*y->strides [0 ]);
491+
492+ if (!xok) {
493+ if (!isnan (thisx)) {
494+ minx=thisx;
495+ maxx=thisx;
496+ xok=1 ;
497+ }
498+ }
499+
500+ if (!yok) {
501+ if (!isnan (thisy)) {
502+ miny=thisy;
503+ maxy=thisx;
504+ yok=1 ;
505+ }
506+ }
507+
508+ if (xok && yok) break ;
509+ }
491510 }
492511
493512 for (size_t i=0 ; i< Nx; ++i) {
494-
495513 thisx = *(double *)(x->data + i*x->strides [0 ]);
496514 thisy = *(double *)(y->data + i*y->strides [0 ]);
515+
497516 _posx.update (thisx);
498517 _posy.update (thisy);
499518 if (thisx<minx) minx=thisx;
You can’t perform that action at this time.
0 commit comments