<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=koi8-r">
<meta name="Generator" content="Microsoft Word 14 (filtered medium)">
<style><!--
/* Font Definitions */
@font-face
        {font-family:Calibri;
        panose-1:2 15 5 2 2 2 4 3 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0in;
        margin-bottom:.0001pt;
        font-size:11.0pt;
        font-family:"Calibri","sans-serif";
        mso-fareast-language:EN-US;}
a:link, span.MsoHyperlink
        {mso-style-priority:99;
        color:blue;
        text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
        {mso-style-priority:99;
        color:purple;
        text-decoration:underline;}
span.EmailStyle17
        {mso-style-type:personal-compose;
        font-family:"Calibri","sans-serif";
        color:windowtext;}
.MsoChpDefault
        {mso-style-type:export-only;
        font-family:"Calibri","sans-serif";
        mso-fareast-language:EN-US;}
@page WordSection1
        {size:8.5in 11.0in;
        margin:70.85pt 70.85pt 70.85pt 70.85pt;}
div.WordSection1
        {page:WordSection1;}
--></style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]-->
</head>
<body lang="NL" link="blue" vlink="purple">
<div class="WordSection1">
<p class="MsoNormal">Hi all,<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal"><span lang="EN-US">Last few days I’ve been struggling to find the cause of a strange contouring effect caused, I think, by vtkMapper::MapScalarsToTexture()<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US"><o:p> </o:p></span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-family:"Courier New"">    // Get the texture map from the lookup table.<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-family:"Courier New"">    // Create a dummy ramp of scalars.<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-family:"Courier New"">    // In the future, we could extend vtkScalarsToColors.<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-family:"Courier New"">    double k = (range[1]-range[0]) / (ColorTextureMapSize-1);<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-family:"Courier New"">    vtkFloatArray* tmp = vtkFloatArray::New();<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-family:"Courier New"">    tmp->SetNumberOfTuples(ColorTextureMapSize);<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-family:"Courier New"">    float* ptr = tmp->GetPointer(0);<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-family:"Courier New"">    for (int i = 0; i < ColorTextureMapSize; ++i)<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-family:"Courier New"">      {<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-family:"Courier New"">      *ptr = range[0] + i * k;<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-family:"Courier New"">      ++ptr;<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-family:"Courier New"">      }<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US"><o:p> </o:p></span></p>
<p class="MsoNormal"><span lang="EN-US">I set the color scale to have 3 colors, and, as you can see, when using color interpolation before mapping, I get 2 almost identical greens, neither of which matches the green of the color scale. This happens only when
 I run our application under  Windows remote desktop. When I run a local installation on Windows, or a VNC session on Linux, the colors are fine.<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US"><o:p> </o:p></span></p>
<p class="MsoNormal"><span lang="EN-US">I accidentally came across issue 7887 while studying vtkContourValues::GenerateValues()
<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US"><o:p> </o:p></span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-family:"Courier New"">    for (i= 0; i < numContours; ++i)<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-family:"Courier New"">      {<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-family:"Courier New"">      // no we cannot factorize the ratio<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-family:"Courier New"">      // (range[1] - range[0])/(numContours - 1) out of the loop.<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-family:"Courier New"">      // we want the whole expression to be evaluated on the FPU.<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-family:"Courier New"">      // see bug discussion: http://www.vtk.org/Bug/view.php?id=7887<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-family:"Courier New"">      this->SetValue(i, range[0] + i*(range[1] - range[0])/(numContours - 1));<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-family:"Courier New"">      }<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US"><o:p> </o:p></span></p>
<p class="MsoNormal"><span lang="EN-US">The same loop occurs in said method of vtkMapper but here the multiplier is calculated outside the loop.  I suspect that this may cause the difference in behavior. I have no way for testing it though. Could someone please
 try to reproduce? Should I file this as an issue in mantis?<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US">Thanks a lot,<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US"><o:p> </o:p></span></p>
<p class="MsoNormal" style="text-autospace:none"><b><span lang="EN-US" style="font-size:10.0pt;font-family:"Arial","sans-serif";color:black;mso-fareast-language:NL">Andreas Buykx<o:p></o:p></span></b></p>
<p class="MsoNormal" style="text-autospace:none"><span lang="EN-US" style="font-size:10.0pt;font-family:"Arial","sans-serif";color:black;mso-fareast-language:NL">Senior Software Engineer<o:p></o:p></span></p>
<p class="MsoNormal" style="text-autospace:none"><span lang="EN-US" style="font-size:10.0pt;font-family:"Arial","sans-serif";color:black;mso-fareast-language:NL"><o:p> </o:p></span></p>
<p class="MsoNormal" style="text-autospace:none"><b><span lang="EN-US" style="font-size:11.5pt;font-family:"Arial","sans-serif";color:#CB2027;mso-fareast-language:NL">TNO DIANA BV
</span></b><span lang="EN-US" style="font-size:11.5pt;font-family:"Arial","sans-serif";color:#CB2027;mso-fareast-language:NL"><o:p></o:p></span></p>
<p class="MsoNormal" style="text-autospace:none"><i><span lang="EN-US" style="font-size:8.0pt;font-family:"Arial","sans-serif";color:black;mso-fareast-language:NL">Software Developers and Analysis Consultants for Civil and Geotechnical Engineering
<o:p></o:p></span></i></p>
<p class="MsoNormal" style="text-autospace:none"><span lang="EN-US" style="font-size:8.0pt;font-family:"Arial","sans-serif";color:black;mso-fareast-language:NL"><o:p> </o:p></span></p>
<p class="MsoNormal" style="text-autospace:none"><span lang="EN-US" style="font-size:9.0pt;font-family:"Arial","sans-serif";color:black;mso-fareast-language:NL">Delftechpark 19a, 2628 XJ, Delft, The Netherlands
<o:p></o:p></span></p>
<p class="MsoNormal" style="text-autospace:none"><span lang="EN-US" style="font-size:9.0pt;font-family:"Arial","sans-serif";color:black;mso-fareast-language:NL">Tel: +31 88 34262 15 (Direct)
</span><span lang="EN-US" style="color:black;mso-fareast-language:NL"> Tel: +31 88 34262 00 (Switchboard)  +31 88 34262 99 (Fax)
<o:p></o:p></span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:9.0pt;font-family:"Arial","sans-serif";color:black;mso-fareast-language:NL"><a href="http://tnodiana.com/"><span lang="EN-US">http://tnodiana.com</span></a></span><b><i><span style="font-size:9.0pt;mso-fareast-language:NL">
<span lang="EN-US"><o:p></o:p></span></span></i></b></p>
<p class="MsoNormal" style="text-autospace:none"><b><i><span lang="EN-US" style="font-size:9.0pt;mso-fareast-language:NL"><o:p> </o:p></span></i></b></p>
<p class="MsoNormal"><b><i><span lang="EN-US" style="font-size:9.0pt;mso-fareast-language:NL">…be green keep it on screen</span></i></b><span lang="EN-US" style="mso-fareast-language:NL"><o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US"><o:p> </o:p></span></p>
</div>
<font face="monospace">____________________________________________________________<br>
TNO DIANA BV is a limited liability company registered in the trade register of the Chamber of Commerce as TNO DIANA BV with registered number 27252655.<br>
____________________________________________________________<br>
This e-mail and its contents are subject to the DISCLAIMER at http://tnodiana.com/content/Disclaimer<br>
____________________________________________________________</font></body>
</html>