<div dir="ltr">Performance could be an issue.<br></div><div class="gmail_extra"><br><br><div class="gmail_quote">On Sun, Apr 21, 2013 at 3:39 PM, David Gobbi <span dir="ltr">&lt;<a href="mailto:david.gobbi@gmail.com" target="_blank">david.gobbi@gmail.com</a>&gt;</span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hi Bill,<br>
<br>
I traced the code that is interpolating the scalars, and it led me to<br>
the following function in vtkDataArray.cxx, which is called from<br>
vtkDataArray::InterpolateTuple().  In fact, that is the only place<br>
this function is called from.<br>
<br>
  template &lt;class T&gt;<br>
  inline void vtkDataArrayRoundIfNecessary(double val, T* retVal)<br>
  {<br>
    *retVal = static_cast&lt;T&gt;((val&gt;=0.0)?(val + 0.5):(val - 0.5));<br>
  }<br>
<br>
It might be good for us to add a clamp here immediately before the<br>
cast, rather than to trust that the weights will never sum to a value<br>
greater than one.<br>
<br>
Either that, or vtkButterflySubdivisionFilter can be modified so that<br>
it normalizes the weights before it interpolates the scalars (i.e. it<br>
would be approximating when computing the points, but would use<br>
normalized weights when computing the scalars).  My preference,<br>
though, would be to modify vtkDataArray in order to make the fix more<br>
general.<br>
<span class="HOEnZb"><font color="#888888"><br>
 - David<br>
</font></span><div class="HOEnZb"><div class="h5"><br>
<br>
<br>
On Sun, Apr 21, 2013 at 10:12 AM, Bill Lorensen &lt;<a href="mailto:bill.lorensen@gmail.com">bill.lorensen@gmail.com</a>&gt; wrote:<br>
&gt; Maybe I have it this time.<br>
&gt;<br>
&gt; Multiple problems:<br>
&gt; 1) First number of points must be used, not number of ploys<br>
&gt; 2) I think color interpolation is overflowing/underflowing the unsigned char<br>
&gt;<br>
&gt; Solution. Use FloatArray for colors. After subdivision,  convert the floats<br>
&gt; to unsigned chars, clamping between 0 and 255.<br>
&gt;<br>
&gt; Attached is an example c++ that seems to work.<br>
&gt;<br>
&gt;<br>
&gt;<br>
&gt; On Sun, Apr 21, 2013 at 11:46 AM, Bill Lorensen &lt;<a href="mailto:bill.lorensen@gmail.com">bill.lorensen@gmail.com</a>&gt;<br>
&gt; wrote:<br>
&gt;&gt;<br>
&gt;&gt; Oops. I still see problems after that change.<br>
&gt;&gt;<br>
&gt;&gt;<br>
&gt;&gt;<br>
&gt;&gt; On Sun, Apr 21, 2013 at 11:45 AM, Bill Lorensen &lt;<a href="mailto:bill.lorensen@gmail.com">bill.lorensen@gmail.com</a>&gt;<br>
&gt;&gt; wrote:<br>
&gt;&gt;&gt;<br>
&gt;&gt;&gt; Found the problem.<br>
&gt;&gt;&gt;<br>
&gt;&gt;&gt; You want to set the point data, but your colors array is filled for<br>
&gt;&gt;&gt; NumberOfPolys. Replace NumberOfPolys with NumberOfPoints and the results<br>
&gt;&gt;&gt; look good.<br>
&gt;&gt;&gt;<br>
&gt;&gt;&gt;<br>
&gt;&gt;&gt;<br>
&gt;&gt;&gt; On Sun, Apr 21, 2013 at 10:43 AM, DivyaS &lt;<a href="mailto:div.anand141@gmail.com">div.anand141@gmail.com</a>&gt; wrote:<br>
&gt;&gt;&gt;&gt;<br>
&gt;&gt;&gt;&gt; Bill,<br>
&gt;&gt;&gt;&gt;<br>
&gt;&gt;&gt;&gt; Butterfly subdivision gives me better results(shape) to the actual data<br>
&gt;&gt;&gt;&gt; i&#39;m<br>
&gt;&gt;&gt;&gt; working on. Is there no other way we can get this working? you were<br>
&gt;&gt;&gt;&gt; talking<br>
&gt;&gt;&gt;&gt; about assigned scalar float, single component values, I would like to<br>
&gt;&gt;&gt;&gt; give<br>
&gt;&gt;&gt;&gt; it a try.. could you please give me some details on that.<br>
</div></div></blockquote></div><br><br clear="all"><br>-- <br>Unpaid intern in BillsBasement at noware dot com<br>
</div>