octave-maintainers
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Help with image()


From: Rik
Subject: Re: Help with image()
Date: Fri, 30 Sep 2016 10:42:29 -0700

On 09/30/2016 09:15 AM, Daniel J Sebald wrote:
> On 09/30/2016 10:43 AM, Rik wrote:
>> Could someone run the following code under Matlab and post the png output?
>>
>> colormap (jet (8))
>> x = 0.7:1:7.7;
>> image (x)
>> print -dpng tst.png
>>
>> According to the documentation, I believe Matlab uses "fix (x)" before
>> plotting, but Octave's OpenGl toolkits appear to use "round (x)".
>>
>> --Rik
>
> I recall just a few days ago seeing the formula in a C file (can't
> remember the file though), and there was no "1 +" but I assumed it was
> zero-start internally rather than 1-start.  If you know what file that
> code would be in I could look again.

The code is is graphics.cc:

-- Start Code --
static void
convert_cdata_2 (bool is_scaled, bool is_real, double clim_0, double clim_1,
                 const double *cmapv, double x, octave_idx_type lda,
                 octave_idx_type nc, octave_idx_type i, double *av)
{
  if (is_scaled)
    x = octave::math::fix (nc * (x - clim_0) / (clim_1 - clim_0));
  else if (is_real)
    x = octave::math::round (x - 1);
-- End Code --

I think the direct case should match the scaled case and use
octave::math::fix.  But, the test image I asked for will tell me what is
correct.

--Rik



reply via email to

[Prev in Thread] Current Thread [Next in Thread]