From: Darren D. <dd...@co...> - 2006-03-20 22:45:43
|
On Monday 20 March 2006 16:45, you wrote: > Darren Dale wrote: > >Thank you, Andrew (Baker's Dozen) Straw. > > Hey, stop thanking me! ;) Seriously, it's me who should be thanking you > for all the work you're doing on the PS and latex fronts. I'm just glad > I can do a couple of minor things to help you along the way. > > >Does this look about right? > > > > > >def isnan(a): > > return reshape(array([isnan64(i) for i in ravel(a)],'b'), shape(a)) > > It looks fine to me -- it matches the behavior of numpy's isnan. I modified _nc_imports.py and numerix/__init__.py. As of svn 2179, we have an isnan for every numerix flavor (numpy and numarray use their own). That means that the postscript backend can use nan's to mask points, if you use the new API. I also found a way to patch _backend_agg.cpp to make it break lines around nan's. I havent modified extension code before, and this change would affect all the *agg backends, so I dont want to commit before checking. Here's the diff: Index: src/_backend_agg.cpp =================================================================== --- src/_backend_agg.cpp (revision 2178) +++ src/_backend_agg.cpp (working copy) @@ -23,6 +23,7 @@ #include "_backend_agg.h" #include "_transforms.h" #include "mplutils.h" +#include "MPL_isnan.h" #include "swig_runtime.h" @@ -1324,6 +1325,7 @@ double thisx, thisy; bool moveto = true; + bool skippoint = false; double heightd = height; double lastx(-2.0), lasty(-2.0); @@ -1339,9 +1341,15 @@ } catch (...) { moveto = true; + skippoint = true; continue; } - + else + if (MPL_isnan64(thisx) || MPL_isnan64(thisy)) { + moveto = true; + skippoint = true; + } + //use agg's transformer? xytrans.transform(&thisx, &thisy); thisy = heightd - thisy; //flipy @@ -1367,8 +1375,9 @@ path.move_to(thisx, thisy); else path.line_to(thisx, thisy); - - moveto = false; + if (!skippoint) + moveto = false; + skippoint = false; //std::cout << "draw lines " << thisx << " " << thisy << std::endl; } |