<div dir="ltr">Bill,<div><br></div><div style>I am not sure I understand how to <span style="font-family:arial,sans-serif;font-size:13px">assigned scalar float, single component values, and if i use a lookup table will I be able to assign a particular color for a point(because that will be how I get the input) ? Could you please give me a sample code of how to assign </span><span style="font-family:arial,sans-serif;font-size:13px">scalar float value, just that part n C++ would do..</span></div>
<div style><span style="font-family:arial,sans-serif;font-size:13px">Thank you for your help.</span></div></div><div class="gmail_extra"><br><br><div class="gmail_quote">On Sun, Apr 21, 2013 at 3:21 AM, Bill Lorensen <span dir="ltr">&lt;<a href="mailto:bill.lorensen@gmail.com" target="_blank">bill.lorensen@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"><div dir="ltr">I was able to duplicate your problem. I believe the problem is trying to approximate the unsigned char 3-component colors. Butterfly is an approximating subdivision scheme, while loop is an interpolating scheme. I think if you assigned scalar float, single component values and mapper them through a lookup table you would get good results. But I&#39;m not sure that would accomplish what you want.<div>

<br></div></div><div class="HOEnZb"><div class="h5"><div class="gmail_extra"><br><br><div class="gmail_quote">On Sat, Apr 20, 2013 at 2:23 PM, Bill Lorensen <span dir="ltr">&lt;<a href="mailto:bill.lorensen@gmail.com" target="_blank">bill.lorensen@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"><div dir="ltr">This better. Just to be sure, I assume this code also produces bad results?<br><br></div><div class="gmail_extra">

<div><div><br><br><div class="gmail_quote">On Sat, Apr 20, 2013 at 1:39 PM, DivyaS <span dir="ltr">&lt;<a href="mailto:div.anand141@gmail.com" target="_blank">div.anand141@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">Sure, please check this code - I have removed all the unnecessary code. I<br>
have added comments for each of the steps.<br>
<br>
            //Defining a cylinder source.<br>
            vtkCylinderSource cylinderSource = vtkCylinderSource.New();<br>
            cylinderSource.Update();<br>
<br>
            vtkTriangleFilter triangles = vtkTriangleFilter.New();<br>
            triangles.SetInput(cylinderSource.GetOutput());<br>
<div>            triangles.Update();<br>
            vtkPolyData originalMesh;<br>
            originalMesh = triangles.GetOutput();<br>
<br>
            vtkUnsignedCharArray colors = vtkUnsignedCharArray.New();<br>
            colors.SetNumberOfComponents(3);<br>
            colors.SetNumberOfTuples(originalMesh.GetNumberOfPolys());<br>
            colors.SetName(&quot;Colors&quot;);<br>
<br>
</div>            //Creating an array to store the values according to which the<br>
colors are selected.<br>
            //Values are inserted for each of the points in the polydata<br>
            int[] colorAT = new int[originalMesh.GetNumberOfPolys()];<br>
            for (int i = 0; i &lt; originalMesh.GetNumberOfPolys(); i++)<br>
            {<br>
                colorAT[i] = i;<br>
            }<br>
<br>
            int activationTime;<br>
            //Loop to select colors for each of the points in the polydata.<br>
            for (int i = 0; i &lt; originalMesh.GetNumberOfPolys(); i++)<br>
            {<br>
                activationTime = colorAT[i];<br>
                if (activationTime &gt; 0 &amp;&amp; activationTime &lt; 5)<br>
                {<br>
                    //Black<br>
                    colors.InsertTuple3(i, 255, 255, 0);<br>
                }<br>
                else if (activationTime &gt; 4 &amp;&amp; activationTime &lt; 10)<br>
<div>                {<br>
                    //Blue<br>
                    colors.InsertTuple3(i, 0, 0, 255);<br>
                }<br>
</div>                else if (activationTime &gt; 9 &amp;&amp; activationTime &lt; 300)<br>
<div>                {<br>
                    //Red<br>
                    colors.InsertTuple3(i, 255, 0, 0);<br>
                }<br>
            }<br>
            originalMesh.GetPointData().SetScalars(colors);<br>
<br>
</div>            //Subdivision.<br>
            int numberOfSubdivisions = 4;<br>
            vtkPolyDataAlgorithm subdivisionFilter =<br>
vtkButterflySubdivisionFilter.New();<br>
<br>
((vtkButterflySubdivisionFilter)subdivisionFilter).SetNumberOfSubdivisions(numberOfSubdivisions);<br>
            subdivisionFilter.SetInput(originalMesh);<br>
            subdivisionFilter.Update();<br>
<br>
            vtkRenderWindow renderWindow =<br>
renderWindowControl1.RenderWindow;<br>
            vtkRenderer renderer = vtkRenderer.New();<br>
<div><br>
            //Create a mapper and actor<br>
            vtkPolyDataMapper mapper = vtkPolyDataMapper.New();<br>
            mapper.SetInputConnection(subdivisionFilter.GetOutputPort());<br>
            vtkActor actor = vtkActor.New();<br>
            actor.SetMapper(mapper);<br>
<br>
            renderer.AddActor(actor);<br>
</div>            renderer.SetBackground(0, 0, 0);<br>
            renderer.ResetCamera();<br>
            renderWindow.AddRenderer(renderer);<br>
            renderWindow.Render();<br>
<br>
<br>
<br>
--<br>
View this message in context: <a href="http://vtk.1045678.n5.nabble.com/Uneven-colors-after-the-vtkButterflySubdivisionFilter-tp5720205p5720234.html" target="_blank">http://vtk.1045678.n5.nabble.com/Uneven-colors-after-the-vtkButterflySubdivisionFilter-tp5720205p5720234.html</a><br>



<div><div>Sent from the VTK - Users mailing list archive at Nabble.com.<br>
_______________________________________________<br>
Powered by <a href="http://www.kitware.com" target="_blank">www.kitware.com</a><br>
<br>
Visit other Kitware open-source projects at <a href="http://www.kitware.com/opensource/opensource.html" target="_blank">http://www.kitware.com/opensource/opensource.html</a><br>
<br>
Please keep messages on-topic and check the VTK FAQ at: <a href="http://www.vtk.org/Wiki/VTK_FAQ" target="_blank">http://www.vtk.org/Wiki/VTK_FAQ</a><br>
<br>
Follow this link to subscribe/unsubscribe:<br>
<a href="http://www.vtk.org/mailman/listinfo/vtkusers" target="_blank">http://www.vtk.org/mailman/listinfo/vtkusers</a><br>
</div></div></blockquote></div><br><br clear="all"><br></div></div><div>-- <br>Unpaid intern in BillsBasement at noware dot com<br>
</div></div>
</blockquote></div><br><br clear="all"><div><br></div>-- <br>Unpaid intern in BillsBasement at noware dot com<br>
</div>
</div></div></blockquote></div><br><br clear="all"><div><br></div>-- <br><blockquote style="margin-top:0px;margin-right:0px;margin-bottom:0px;margin-left:0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">
<span style="font-family:&#39;comic sans ms&#39;,sans-serif"><b><font color="#CC33CC">div......</font></b></span></blockquote>
</div>