<div dir="ltr"><div><div>Hi Sankesh,<br></div>Thanks for the pointers. If I change this to the following<br><br><br><div><font face="monospace, monospace" color="#0000ff"><br></font></div><div><font face="monospace, monospace" color="#0000ff"> for (vtkIdType i= 0; i < count; i++)</font></div><div><font face="monospace, monospace" color="#0000ff"> {<br></font><font face="monospace, monospace" color="#0000ff"> cell->InsertNextCell( i );</font><br></div><div><font face="monospace, monospace" color="#0000ff"><span style="white-space:pre-wrap"> </span>cell->InsertCellPoint(i);</font></div><div><font face="monospace, monospace" color="#0000ff"> }</font></div>will this mean the same what you are suggesting? In that case how the points are getting distributed ? I have been learning VTK by going through the examples. Indeed they are useful.<br><br></div><div>I would really appreciate, if you can point me towards some "description" of VTK cells / normals /Tcoords etc that will be very helpful to understand the underlying concepts easily.<br><br></div><div>Thanks,<br></div><div>Chiranjib<br></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Tue, Jul 21, 2015 at 8:27 PM, Sankhesh Jhaveri <span dir="ltr"><<a href="mailto:sankhesh.jhaveri@kitware.com" target="_blank">sankhesh.jhaveri@kitware.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div class="gmail_default" style="font-family:verdana,sans-serif;font-size:small;color:rgb(11,83,148)">Hi Chiranjib,<br><br></div><div class="gmail_default" style="font-family:verdana,sans-serif;font-size:small;color:rgb(11,83,148)">Your code calls InsertNextCell once and adds all points to that cell using InsertCellPoint. Thats why you just end up with one cell.<br><br></div><div class="gmail_default" style="font-family:verdana,sans-serif;font-size:small;color:rgb(11,83,148)">You can add more cells by calling InsertNextCell as many times as the number of cells you want. You will have to distribute the points in the resultant cells accordingly.<br><br></div><div class="gmail_default" style="font-family:verdana,sans-serif;font-size:small;color:rgb(11,83,148)">Take a look at examples here: <a href="http://www.vtk.org/Wiki/VTK/Examples/Cxx" target="_blank">http://www.vtk.org/Wiki/VTK/Examples/Cxx</a><br><br></div></div><div class="gmail_extra"><br clear="all"><div><div><div dir="ltr"><div><div dir="ltr"><div><div dir="ltr"><div><span style="color:rgb(11,83,148)"><br></span></div><div><span style="color:rgb(11,83,148)"><span style="font-family:verdana,sans-serif">Warm Regards,<br><br></span></span></div><span style="color:rgb(11,83,148)"><span style="font-family:verdana,sans-serif">Sankhesh Jhaveri<br>Research & Development Engineer</span></span><div><span style="color:rgb(11,83,148)"><span style="font-family:verdana,sans-serif">Kitware, Inc.<br><b>Phone</b>: (518) 881 4417<br><b>Fax</b>: (518) 371 4573</span></span><br><b></b><br> </div></div></div></div></div></div></div></div>
<br><div class="gmail_quote"><div><div class="h5">On Mon, Jul 20, 2015 at 5:48 AM, Chiranjib Sur <span dir="ltr"><<a href="mailto:sur.chiranjib@gmail.com" target="_blank">sur.chiranjib@gmail.com</a>></span> wrote:<br></div></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div><div class="h5"><div dir="ltr"><div>Hi VTK experts,</div><div>I am not an expert vtk programmers like many others in the forum. I have a confusion.</div><div><br></div><div>I am creating a set of vtk points (and eventually a vtkpolydata) and want to create vtkcells for the associated points. I was looking at the examples and trying to implement this way ( <a href="http://www.vtk.org/gitweb?p=VTK.git;a=blob;f=Examples/VisualizationAlgorithms/Cxx/TubesWithVaryingRadiusAndColors.cxx" target="_blank">http://www.vtk.org/gitweb?p=VTK.git;a=blob;f=Examples/VisualizationAlgorithms/Cxx/TubesWithVaryingRadiusAndColors.cxx</a>)</div><div><br></div><div>What I am observing is that when I create vtkcells, I only create ONE cell. What is going wrong here and why not all vtkcells are created? </div><div><br></div><div>Any suggestions ?</div><div><br></div><div>Thanks in advance,</div><div>Chiranjib</div><div><br></div><div>Here is my code snippet</div><div><br></div><div><br></div><div><br></div><div><font face="monospace, monospace" color="#0000ff">// VTK points are defined here</font></div><div><font face="monospace, monospace" color="#0000ff"> </font></div><div><font face="monospace, monospace" color="#0000ff"> vtkSmartPointer<vtkPoints> newPoints = vtkSmartPointer<vtkPoints>::New();</font></div><div><font face="monospace, monospace" color="#0000ff"> </font></div><div><font face="monospace, monospace" color="#0000ff">// Set precision for the vtk points</font></div><div><font face="monospace, monospace" color="#0000ff"> newPoints->SetDataType( VTK_DOUBLE );</font></div><div><font face="monospace, monospace" color="#0000ff"><br></font></div><div><font face="monospace, monospace" color="#0000ff"> unsigned int count = 0;</font></div><div><font face="monospace, monospace" color="#0000ff"> double resolution = 0.1;</font></div><div><font face="monospace, monospace" color="#0000ff"> </font></div><div><font face="monospace, monospace" color="#0000ff">// Create the points for the entire volume</font></div><div><font face="monospace, monospace" color="#0000ff"> for (unsigned int j = 0; j<10; j++)</font></div><div><font face="monospace, monospace" color="#0000ff"> {</font></div><div><font face="monospace, monospace" color="#0000ff"> for (unsigned int i = 0; i<10; i++)</font></div><div><font face="monospace, monospace" color="#0000ff"> {</font></div><div><font face="monospace, monospace" color="#0000ff"> for (unsigned int k = 0; k<10; k++)</font></div><div><font face="monospace, monospace" color="#0000ff"> {</font></div><div><font face="monospace, monospace" color="#0000ff"> newPoints->InsertNextPoint( x0[0]+ resolution*i, x0[1]+ resolution*j, x0[2]+ resolution*k );</font></div><div><font face="monospace, monospace" color="#0000ff"> count++;</font></div><div><font face="monospace, monospace" color="#0000ff"> } </font></div><div><font face="monospace, monospace" color="#0000ff"> } </font></div><div><font face="monospace, monospace" color="#0000ff"> } </font></div><div><font face="monospace, monospace" color="#0000ff"><br></font></div><div><font face="monospace, monospace" color="#0000ff">std::cout << "length of mycube = " << xl << ","<<yl<<","<<zl << std::endl;</font></div><div><font face="monospace, monospace" color="#0000ff">std::cout << "Number of points = " << count << std::endl;</font></div><div><font face="monospace, monospace" color="#0000ff"><br></font></div><div><font face="monospace, monospace" color="#0000ff"><br></font></div><div><font face="monospace, monospace" color="#0000ff"><br></font></div><div><font face="monospace, monospace" color="#0000ff"> // Insert vtk cell arrays</font></div><div><font face="monospace, monospace" color="#0000ff"> vtkSmartPointer<vtkCellArray> cell = vtkSmartPointer<vtkCellArray>::New();</font></div><div><font face="monospace, monospace" color="#0000ff"><br></font></div><div><font face="monospace, monospace" color="#0000ff"> cell->InsertNextCell( count);</font></div><div><font face="monospace, monospace" color="#0000ff"><br></font></div><div><font face="monospace, monospace" color="#0000ff"> for (vtkIdType i= 0; i < count; i++)</font></div><div><font face="monospace, monospace" color="#0000ff"> {</font></div><div><font face="monospace, monospace" color="#0000ff"><span style="white-space:pre-wrap"> </span> cell->InsertCellPoint(i);</font></div><div><font face="monospace, monospace" color="#0000ff"> }</font></div><div><font face="monospace, monospace" color="#0000ff"><br></font></div><div><font face="monospace, monospace" color="#0000ff">// Define the polydata for the cube</font></div><div><font face="monospace, monospace" color="#0000ff"> vtkSmartPointer<vtkPolyData> np = vtkSmartPointer<vtkPolyData>::New();</font></div><div><font face="monospace, monospace" color="#0000ff"> np->SetPoints( newPoints );</font></div><div><font face="monospace, monospace" color="#0000ff"> np->SetLines( cell);</font></div><div><font face="monospace, monospace" color="#0000ff"><br></font></div><div><font face="monospace, monospace" color="#0000ff"> std::cout << "Number of cells "<< np->GetNumberOfCells() << ":" << count << std::endl;</font></div><div><br></div></div>
<br></div></div>_______________________________________________<br>
Powered by <a href="http://www.kitware.com" rel="noreferrer" target="_blank">www.kitware.com</a><br>
<br>
Visit other Kitware open-source projects at <a href="http://www.kitware.com/opensource/opensource.html" rel="noreferrer" 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" rel="noreferrer" target="_blank">http://www.vtk.org/Wiki/VTK_FAQ</a><br>
<br>
Search the list archives at: <a href="http://markmail.org/search/?q=vtkusers" rel="noreferrer" target="_blank">http://markmail.org/search/?q=vtkusers</a><br>
<br>
Follow this link to subscribe/unsubscribe:<br>
<a href="http://public.kitware.com/mailman/listinfo/vtkusers" rel="noreferrer" target="_blank">http://public.kitware.com/mailman/listinfo/vtkusers</a><br>
<br></blockquote></div><br></div>
</blockquote></div><br></div>