--- /dev/null
+// =============================================================================
+// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+// Copyright (C) 2020 - Stéphane MOTTELET
+//
+// This file is distributed under the same license as the Scilab package.
+// =============================================================================
+
+// <-- TEST WITH GRAPHIC -->
+// <-- NO CHECK REF -->
+
+// <-- Non-regression test for bug 16407 -->
+//
+// <-- Bugzilla URL -->
+// http://bugzilla.scilab.org/show_bug.cgi?id=16407
+//
+// <-- Short Description -->
+// Fec rendering is incorrect
+
+x=[0 1 0]';
+y=[0 0 1]';
+z=[0 1 1]';
+triangles=[1 1 2 3 1];
+clf
+n=4;
+gcf().color_map = jetcolormap(n)
+fec(x,y,triangles,z);
+xs2png(0,fullfile(TMPDIR,"bug_16407_1.png"))
+//
+w = 0.125;
+xfrect(0,w,w,w)
+gce().background = 1;
+xfrect(0.5-w,0.5,w,w)
+gce().background = n;
+xs2png(0,fullfile(TMPDIR,"bug_16407_2.png"))
+//
+res1 = getmd5(fullfile(TMPDIR,"bug_16407_1.png"));
+res2 = getmd5(fullfile(TMPDIR,"bug_16407_2.png"));
+assert_checkequal(res1,res2)
+
* [#16401](https://bugzilla.scilab.org/16401): global `external_object_java` class was crashing Scilab.
* [#16403](https://bugzilla.scilab.org/16403): 1D extraction of matrix with implicit index had wrong dimensions.
* [#16406](https://bugzilla.scilab.org/16406): `edit_curv` yielded an error when reading data.
+* [#16407](https://bugzilla.scilab.org/16407): Fec rendering was incorrect
* [#16408](https://bugzilla.scilab.org/16408): toJSON(var, indent, filename) is the right call sequence. Documentation has been udpated.
* [#16445](https://bugzilla.scilab.org/16445): `colorbar(..)` ignored how to guess `umin` and `umax` for a Champ object (with .colored="on").
* [#16449](https://bugzilla.scilab.org/16449): Insertion of implicit vector in Cell was crahsing Scilab
}
else
{
+ /* fix min and max value to respect position of strips https://bugzilla.scilab.org/show_bug.cgi?id=16407 */
+ double a = maxValue-minValue;
+ minValue += a/2.0/(double)colorsNumber;
+ maxValue -= a/2.0/(double)colorsNumber;
for (int i = 0; i < numVertices; i++)
{
buffer[bufferOffset++] = (float)(t + scale * (values[i] - minValue) / (maxValue - minValue));