<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"><<a href="mailto:david.gobbi@gmail.com" target="_blank">david.gobbi@gmail.com</a>></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 <class T><br>
inline void vtkDataArrayRoundIfNecessary(double val, T* retVal)<br>
{<br>
*retVal = static_cast<T>((val>=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 <<a href="mailto:bill.lorensen@gmail.com">bill.lorensen@gmail.com</a>> wrote:<br>
> Maybe I have it this time.<br>
><br>
> Multiple problems:<br>
> 1) First number of points must be used, not number of ploys<br>
> 2) I think color interpolation is overflowing/underflowing the unsigned char<br>
><br>
> Solution. Use FloatArray for colors. After subdivision, convert the floats<br>
> to unsigned chars, clamping between 0 and 255.<br>
><br>
> Attached is an example c++ that seems to work.<br>
><br>
><br>
><br>
> On Sun, Apr 21, 2013 at 11:46 AM, Bill Lorensen <<a href="mailto:bill.lorensen@gmail.com">bill.lorensen@gmail.com</a>><br>
> wrote:<br>
>><br>
>> Oops. I still see problems after that change.<br>
>><br>
>><br>
>><br>
>> On Sun, Apr 21, 2013 at 11:45 AM, Bill Lorensen <<a href="mailto:bill.lorensen@gmail.com">bill.lorensen@gmail.com</a>><br>
>> wrote:<br>
>>><br>
>>> Found the problem.<br>
>>><br>
>>> You want to set the point data, but your colors array is filled for<br>
>>> NumberOfPolys. Replace NumberOfPolys with NumberOfPoints and the results<br>
>>> look good.<br>
>>><br>
>>><br>
>>><br>
>>> On Sun, Apr 21, 2013 at 10:43 AM, DivyaS <<a href="mailto:div.anand141@gmail.com">div.anand141@gmail.com</a>> wrote:<br>
>>>><br>
>>>> Bill,<br>
>>>><br>
>>>> Butterfly subdivision gives me better results(shape) to the actual data<br>
>>>> i'm<br>
>>>> working on. Is there no other way we can get this working? you were<br>
>>>> talking<br>
>>>> about assigned scalar float, single component values, I would like to<br>
>>>> give<br>
>>>> 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>