[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: help with graphics
From: |
John W. Eaton |
Subject: |
Re: help with graphics |
Date: |
Wed, 26 Oct 2011 11:32:38 -0400 |
On 26-Oct-2011, Michael Goffioul wrote:
| On Wed, Oct 26, 2011 at 8:15 AM, John W. Eaton <address@hidden> wrote:
| > +static bool
| > +all_negative (const MArray<double>& m)
| > +{
| > + bool retval = true;
| > + const double *data = m.data ();
| > + for (octave_idx_type i = 0; i < m.numel (); i++)
| > + {
| > + if (data[i] >= 0)
| > + {
| > + retval = false;
| > + break;
| > + }
| > + }
| > + return retval;
| > +}
|
| Wouldn't this better located in the MArray class, or more generally
| somewhere in liboctave?
Yes, that's why I said my solution was just a temporary hack to test
the idea and that I'd fix it later before committing.
| > @@ -248,6 +270,11 @@
| > for (int i = 0; i < n; i++)
| > dest[i] = log10(src[i]);
| > }
| > + void do_neg_scale (const double *src, double *dest, int n) const
| > + {
| > + for (int i = 0; i < n; i++)
| > + dest[i] = log10(-src[i]);
| > + }
| > };
| >
| > class scaler
| >
| >
| > The tick marks are displaced so that they are on top of the axis
| > lines. Not sure yet why that is happening. I'll take a look at it
| > later. First I need to get some sleep...
|
| This is probably because the new scaler flips the axis, so after
| scaling the min and max values are swapped. You might want to try to
| re-flips after log-scaling, like:
|
| dest[i] = -log10(-src[i]);
Nice, that seems to fix it. The scaler class looks like a good
solution to this problem. Thanks for these pointers. I would have
screwed things up horribly if I had continued down the path I was on.
So it would probably help a lot if we had some comments in the
graphics code that explained the overall design and the intent/purpose
of some of the variables. (I know, likewise for other parts of Octave
as well...)
jwe
- help with graphics, John W. Eaton, 2011/10/25
- Re: help with graphics, Michael Goffioul, 2011/10/25
- Re: help with graphics, John W. Eaton, 2011/10/25
- Re: help with graphics, Michael Goffioul, 2011/10/26
- Re: help with graphics, John W. Eaton, 2011/10/26
- Re: help with graphics, Michael Goffioul, 2011/10/26
- Re: help with graphics, John W. Eaton, 2011/10/26
- Re: help with graphics, Michael Goffioul, 2011/10/26
- Re: help with graphics,
John W. Eaton <=
- Re: help with graphics, John W. Eaton, 2011/10/26