# HG changeset patch # User Rik # Date 1354310475 28800 # Node ID d803cd07f31a0d52c06024020c3e7d57749c54da # Parent 242e9efd43154fb4537f76b15373f5337449d6cc 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. diff --git a/libinterp/interpfcn/graphics.cc b/libinterp/interpfcn/graphics.cc --- 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;