<div dir="ltr"><div class="gmail_default" style="font-family:tahoma,sans-serif;font-size:small">Hi all,</div><div class="gmail_default" style="font-family:tahoma,sans-serif;font-size:small"><br></div><div class="gmail_default" style="font-family:tahoma,sans-serif;font-size:small">I'm having a really though time plotting a flat surface (as in every point from that surface has the same <b>z value</b>). I'm using the QVTKWidget in my Qt 5.7 application. My idea is to show one or multiple signals which represent how near one or multiple (up to 10) fingers come to the surface of a device. So initially the surface plot is flat (since no fingers are touching it). Whenever a finger comes near the surface, the device emits the position of that finger (<b>x,y values</b>) along with a signal strength at that position (<b>z value</b>). I'm really new to the whole chart and surface plotting in VTK (I have used it with PCL) so I have no idea where to look at (it took me quite some time to even build and integrate the VTK and the surface plot in my Qt application...). Basically if I set all my points to have the same <b>z value</b> the surface plot simply doesn't show. I think this has something to do with the scaling of the chart and the fact that it expects a range of values. Even if it's binary (that is only two values are possible for each <b>z value</b>) the min and max have to be different. Setting the min and max to a very small values (min: 0, max: 0.00001) doesn't help at all since the chart scales to these values and I get a very noisy surface plot. Currently my plot is static (though I intend to bind it to near real time values if it works out) and I'm setting up the data as follows:</div><div class="gmail_default" style="font-family:tahoma,sans-serif;font-size:small"><br></div><div class="gmail_default" style="font-family:tahoma,sans-serif;font-size:small"><pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(128,128,0)">void</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(128,0,128)">Q3DTouchPadSignalsFingersPlot</span><span style="color:rgb(0,0,0)">::</span><span style="color:rgb(0,0,0)">setupPlot</span><span style="color:rgb(0,0,0)">()</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,0,0)">{</span></pre>
<pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(192,192,192)">    </span><span style="color:rgb(128,128,0)">int</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,0,0)">numPoints</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,0,0)">=</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,0,128)">100</span><span style="color:rgb(0,0,0)">;</span></pre>
<pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(192,192,192)">    </span><span style="color:rgb(128,128,0)">double</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,0,0)">inc</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,0,0)">=</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,0,128)">9.424778</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,0,0)">/</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,0,0)">(</span><span style="color:rgb(0,0,0)">numPoints</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,0,0)">-</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,0,128)">1</span><span style="color:rgb(0,0,0)">);</span></pre>
<pre style="margin-top:0px;margin-bottom:0px"><br></pre>
<pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(192,192,192)">    </span><span style="color:rgb(128,128,0)">for</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,0,0)">(</span><span style="color:rgb(128,128,0)">int</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,0,0)">i</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,0,0)">=</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,0,128)">0</span><span style="color:rgb(0,0,0)">;</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,0,0)">i</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,0,0)"><</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,0,0)">(</span><span style="color:rgb(128,128,0)">int</span><span style="color:rgb(0,0,0)">)</span><span style="color:rgb(0,0,0)">numPoints</span><span style="color:rgb(0,0,0)">;</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,0,0)">++</span><span style="color:rgb(0,0,0)">i</span><span style="color:rgb(0,0,0)">)</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,0,0)">{</span></pre>
<pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(192,192,192)">        </span><span style="color:rgb(128,0,128)">vtkNew</span><span style="color:rgb(0,0,0)"><</span><span style="color:rgb(128,0,128)">vtkFloatArray</span><span style="color:rgb(0,0,0)">></span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,0,0)">arr</span><span style="color:rgb(0,0,0)">;</span></pre>
<pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(192,192,192)">        </span><span style="color:rgb(128,128,0)">this</span><span style="color:rgb(0,0,0)">-></span><span style="color:rgb(128,0,0)">surfaceData</span><span style="color:rgb(0,0,0)">-></span><span style="color:rgb(0,0,0)">AddColumn</span><span style="color:rgb(0,0,0)">(</span><span style="color:rgb(0,0,0)">arr</span><span style="color:rgb(0,0,0)">.</span><span style="color:rgb(0,0,0)">GetPointer</span><span style="color:rgb(0,0,0)">());</span></pre>
<pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(192,192,192)">    </span><span style="color:rgb(0,0,0)">}</span></pre>
<pre style="margin-top:0px;margin-bottom:0px"><br></pre>
<pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(192,192,192)">    </span><span style="color:rgb(128,128,0)">this</span><span style="color:rgb(0,0,0)">-></span><span style="color:rgb(128,0,0)">surfaceData</span><span style="color:rgb(0,0,0)">-></span><span style="color:rgb(0,0,0)">SetNumberOfRows</span><span style="color:rgb(0,0,0)">(</span><span style="color:rgb(0,0,0)">numPoints</span><span style="color:rgb(0,0,0)">);</span></pre>
<pre style="margin-top:0px;margin-bottom:0px"><br></pre>
<pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(192,192,192)">    </span><span style="color:rgb(128,128,0)">for</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,0,0)">(</span><span style="color:rgb(128,128,0)">int</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,0,0)">i</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,0,0)">=</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,0,128)">0</span><span style="color:rgb(0,0,0)">;</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,0,0)">i</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,0,0)"><</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,0,0)">(</span><span style="color:rgb(128,128,0)">int</span><span style="color:rgb(0,0,0)">)</span><span style="color:rgb(0,0,0)">numPoints</span><span style="color:rgb(0,0,0)">;</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,0,0)">++</span><span style="color:rgb(0,0,0)">i</span><span style="color:rgb(0,0,0)">)</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,0,0)">{</span></pre>
<pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(192,192,192)">        </span><span style="color:rgb(128,128,0)">double</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,0,0)">x</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,0,0)">=</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,0,0)">i</span><span style="color:rgb(0,0,0)">*</span><span style="color:rgb(0,0,0)">inc</span><span style="color:rgb(0,0,0)">;</span></pre>
<pre style="margin-top:0px;margin-bottom:0px"><br></pre>
<pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(192,192,192)">        </span><span style="color:rgb(0,128,0)">//</span><span style="color:rgb(192,192,192)">        </span><span style="color:rgb(0,128,0)">double</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,128,0)">x</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,128,0)">=</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,128,0)">i;</span></pre>
<pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(192,192,192)">        </span><span style="color:rgb(128,128,0)">for</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,0,0)">(</span><span style="color:rgb(128,128,0)">int</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,0,0)">j</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,0,0)">=</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,0,128)">0</span><span style="color:rgb(0,0,0)">;</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,0,0)">j</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,0,0)"><</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,0,0)">(</span><span style="color:rgb(128,128,0)">int</span><span style="color:rgb(0,0,0)">)</span><span style="color:rgb(0,0,0)">numPoints</span><span style="color:rgb(0,0,0)">;</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,0,0)">++</span><span style="color:rgb(0,0,0)">j</span><span style="color:rgb(0,0,0)">)</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,0,0)">{</span></pre>
<pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(192,192,192)">            </span><span style="color:rgb(128,128,0)">double</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,0,0)">y</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,0,0)">=</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,0,0)">j</span><span style="color:rgb(0,0,0)">*</span><span style="color:rgb(0,0,0)">inc</span><span style="color:rgb(0,0,0)">;</span></pre>
<pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(192,192,192)">            </span><span style="color:rgb(0,128,0)">//</span><span style="color:rgb(192,192,192)">            </span><span style="color:rgb(0,128,0)">double</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,128,0)">y</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,128,0)">=</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,128,0)">j;</span></pre>
<pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(192,192,192)">            </span><span style="color:rgb(128,128,0)">this</span><span style="color:rgb(0,0,0)">-></span><span style="color:rgb(128,0,0)">surfaceData</span><span style="color:rgb(0,0,0)">-></span><span style="color:rgb(0,0,0)">SetValue</span><span style="color:rgb(0,0,0)">(</span><span style="color:rgb(0,0,0)">i</span><span style="color:rgb(0,0,0)">,</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,0,0)">j</span><span style="color:rgb(0,0,0)">,</span></pre><pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(0,0,0)">                                        sin(sqrt(x*x + y*y))/sqrt(x*x + y*y));</span></pre>
<pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(192,192,192)">                                        </span><span style="font-family:tahoma,sans-serif;color:rgb(0,128,0)">//</span><span style="font-family:tahoma,sans-serif;color:rgb(192,192,192)"> </span><span style="font-family:tahoma,sans-serif;color:rgb(0,128,0)">sin(sqrt(x*x</span><span style="font-family:tahoma,sans-serif;color:rgb(192,192,192)"> </span><span style="font-family:tahoma,sans-serif;color:rgb(0,128,0)">+</span><span style="font-family:tahoma,sans-serif;color:rgb(192,192,192)"> </span><span style="font-family:tahoma,sans-serif;color:rgb(0,128,0)">y*y))</span><span style="font-family:tahoma,sans-serif;color:rgb(192,192,192)"> </span><span style="font-family:tahoma,sans-serif;color:rgb(0,128,0)">|</span><span style="font-family:tahoma,sans-serif;color:rgb(192,192,192)"> </span><span style="font-family:tahoma,sans-serif;color:rgb(0,128,0)">sin(sqrt(x*x</span><span style="font-family:tahoma,sans-serif;color:rgb(192,192,192)"> </span><span style="font-family:tahoma,sans-serif;color:rgb(0,128,0)">+</span><span style="font-family:tahoma,sans-serif;color:rgb(192,192,192)"> </span><span style="font-family:tahoma,sans-serif;color:rgb(0,128,0)">y*y))/sqrt(x*x</span><span style="font-family:tahoma,sans-serif;color:rgb(192,192,192)"> </span><span style="font-family:tahoma,sans-serif;color:rgb(0,128,0)">+</span><span style="font-family:tahoma,sans-serif;color:rgb(192,192,192)"> </span><span style="font-family:tahoma,sans-serif;color:rgb(0,128,0)">y*y)</span></pre>
<pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(192,192,192)">        </span><span style="color:rgb(0,0,0)">}</span></pre>
<pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(192,192,192)">    </span><span style="color:rgb(0,0,0)">}</span></pre>
<pre style="margin-top:0px;margin-bottom:0px"><br></pre>
<pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(192,192,192)">    </span><span style="color:rgb(128,128,0)">this</span><span style="color:rgb(0,0,0)">-></span><span style="color:rgb(128,0,0)">plot</span><span style="color:rgb(0,0,0)">-></span><span style="color:rgb(0,0,0)">SetXRange</span><span style="color:rgb(0,0,0)">(</span><span style="color:rgb(0,0,128)">0</span><span style="color:rgb(0,0,0)">,</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,0,128)">9.424778</span><span style="color:rgb(0,0,0)">);</span></pre>
<pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(192,192,192)">    </span><span style="color:rgb(128,128,0)">this</span><span style="color:rgb(0,0,0)">-></span><span style="color:rgb(128,0,0)">plot</span><span style="color:rgb(0,0,0)">-></span><span style="color:rgb(0,0,0)">SetYRange</span><span style="color:rgb(0,0,0)">(</span><span style="color:rgb(0,0,128)">0</span><span style="color:rgb(0,0,0)">,</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,0,128)">9.424778</span><span style="color:rgb(0,0,0)">);</span></pre>
<pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(192,192,192)">    </span><span style="color:rgb(128,128,0)">this</span><span style="color:rgb(0,0,0)">-></span><span style="color:rgb(128,0,0)">plot</span><span style="color:rgb(0,0,0)">-></span><span style="font-style:italic;color:rgb(0,0,0)">SetInputData</span><span style="color:rgb(0,0,0)">(</span><span style="color:rgb(128,128,0)">this</span><span style="color:rgb(0,0,0)">-></span><span style="color:rgb(128,0,0)">surfaceData</span><span style="color:rgb(0,0,0)">.</span><span style="color:rgb(0,0,0)">GetPointer</span><span style="color:rgb(0,0,0)">());</span></pre>
<pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(0,0,0)">}</span></pre>
<pre style="margin-top:0px;margin-bottom:0px"><br></pre><pre style="margin-top:0px;margin-bottom:0px"><span style="font-family:tahoma,sans-serif;white-space:normal">This produces a quater of the function </span><span style="color:rgb(0,0,0);font-family:tahoma,sans-serif">sin(sqrt(x*x + y*y))/sqrt(x*x + y*y)):</span></pre><pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(0,0,0);font-family:tahoma,sans-serif"><br></span></pre><pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(0,0,0);font-family:tahoma,sans-serif"><img src="cid:ii_15673d786792db13" alt="Inline images 2" width="449" height="472"><br></span></pre><pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(0,0,0);font-family:tahoma,sans-serif"><br></span></pre><pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(0,0,0);font-family:tahoma,sans-serif">If I change the setting of the data at the given location in the surface to </span><span style="font-family:tahoma,sans-serif;color:rgb(128,128,0)">this</span><span style="font-family:tahoma,sans-serif;color:rgb(0,0,0)">-></span><span style="font-family:tahoma,sans-serif;color:rgb(128,0,0)">surfaceData</span><span style="font-family:tahoma,sans-serif;color:rgb(0,0,0)">-></span><span style="font-family:tahoma,sans-serif;color:rgb(0,0,0)">SetValue</span><span style="font-family:tahoma,sans-serif;color:rgb(0,0,0)">(</span><span style="font-family:tahoma,sans-serif;color:rgb(0,0,0)">i</span><span style="font-family:tahoma,sans-serif;color:rgb(0,0,0)">,</span><span style="font-family:tahoma,sans-serif;color:rgb(192,192,192)"> </span><span style="font-family:tahoma,sans-serif;color:rgb(0,0,0)">j</span><span style="font-family:tahoma,sans-serif;color:rgb(0,0,0)">, 1) (that is I use a constant) </span></pre><pre style="margin-top:0px;margin-bottom:0px"><span style="font-family:tahoma,sans-serif;color:rgb(0,0,0)">the plot disappears:</span></pre><pre style="margin-top:0px;margin-bottom:0px"><span style="font-family:tahoma,sans-serif;color:rgb(0,0,0)"><br></span></pre><pre style="margin-top:0px;margin-bottom:0px"><span style="font-family:tahoma,sans-serif;color:rgb(0,0,0)"><img src="cid:ii_15673d64e66847dd" alt="Inline images 1" width="465" height="472"><br></span></pre><pre style="margin-top:0px;margin-bottom:0px"><span style="font-family:tahoma,sans-serif;color:rgb(0,0,0)"><br></span></pre><pre style="margin-top:0px;margin-bottom:0px"><span style="font-family:tahoma,sans-serif;color:rgb(0,0,0)">Any ideas how to fix this?</span></pre><pre style="margin-top:0px;margin-bottom:0px"><span style="font-family:tahoma,sans-serif;color:rgb(0,0,0)"><br></span></pre><pre style="margin-top:0px;margin-bottom:0px"><span style="font-family:tahoma,sans-serif;color:rgb(0,0,0)">Kind regards,</span></pre><pre style="margin-top:0px;margin-bottom:0px"><span style="font-family:tahoma,sans-serif;color:rgb(0,0,0)">Aleksandar</span></pre></div>
</div>