Mercurial > hg > octave-nkf
changeset 15707:d803cd07f31a
Tweak C++ implementation of jet colormap to produce exactly the same result as jet.m
* graphics.cc (jet_colormap): Create the index entry x in the same manner as
linspace so that jet_colormap() produces the same results as jet.m.
author | Rik <rik@octave.org> |
---|---|
date | Fri, 30 Nov 2012 13:21:15 -0800 |
parents | 242e9efd4315 |
children | 916ef285522a |
files | libinterp/interpfcn/graphics.cc |
diffstat | 1 files changed, 5 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/libinterp/interpfcn/graphics.cc +++ b/libinterp/interpfcn/graphics.cc @@ -137,6 +137,10 @@ { Matrix cmap (64, 3, 0.0); + // Produce X in the same manner as linspace so that + // jet_colormap and jet.m produce *exactly* the same result. + double delta = 1.0 / 63.0; + for (octave_idx_type i = 0; i < 64; i++) { // This is the jet colormap. It would be nice to be able @@ -146,7 +150,7 @@ // called, so calling an interpreted function is not // possible. - double x = i / 63.0; + double x = i*delta; if (x >= 3.0/8.0 && x < 5.0/8.0) cmap(i,0) = 4.0 * x - 3.0/2.0;