Thanks Burlen,<br><br>Another question, I checked the code for CSCS's vtkPointSpriteMapper and it will work just fine if I put all the verticies into one cell...<br><br>Is there any reason why I should put one vertex per cell ? EG, I imagine it may be required when adding support for point-picking ?<br>
<br>thanks,<br>Paul<br><br><br><div class="gmail_quote">2009/1/17 Burlen Loring <span dir="ltr"><<a href="mailto:burlen.loring@kitware.com">burlen.loring@kitware.com</a>></span><br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
Here is an example using vertex cells.<br>
<br>
<br>
vtkIdTypeArray *va=vtkIdTypeArray::New();<br>
va->SetNumberOfTuples(2*nCells);<br>
vtkIdType *verts=va->GetPointer(0);<br>
vtkPoints *pts=vtkPoints::New();<br>
pts->SetData(xyzArray);<br>
for (int i=0; i<nCells; ++i)<br>
{<br>
verts[0]=1;<br>
verts[1]=i;<br>
verts+=2;<br>
}<br>
polydataset->SetPoints(pts);<br>
pts->Delete();<br>
vtkCellArray *cells=vtkCellArray::New();<br>
cells->SetCells(static_cast<vtkIdType>(nCells),va);<br>
polydataset->SetVerts(cells);<br>
cells->Delete();<br>
va->Delete();<br>
<br>
<br>
Paul Harris wrote:<br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;"><div><div></div><div class="Wj3C7c">
Hi,<br>
<br>
I have the following code:<br>
<br>
vtkCellArray * p_cells = vtkCellArray::New();<br>
<br>
p_cells->Allocate( ids.size() );<br>
<br>
for ( vector<vtkIdType>::const_iterator id = ids.begin(), id_end = ids.end(); id != id_end; ++id )<br>
p_cells->InsertNextCell(1,&*c);<br>
<br>
<br>
But, I am not sure that my Allocate() call is correct. Should it be:<br>
Allocate(ids.size()*2);<br>
<br>
... the reason I ask is that I wanted to try and use p_cells->WritePointer() to do the copying with a memcpy, but it looks like the format of a CellArray is something like:<br>
<br>
[cellid, pointid, cellid, pointid, cellid, pointid]<br>
<br>
if i had 2 points per cell it would be<br>
[cellid, point1, point2, cellid, point1, point2, etc]<br>
<br>
if this is so, then in order to create a cellarray of 20 points, each in their own cells, i'd need to alloc room for 40.<br>
<br>
<br>
Am I reading the code correctly?<br>
Does anyone do efficient copies, or does everyone use InsertNextEtc() methods?<br>
<br>
thanks,<br>
Paul<br>
<br>
<br></div></div></blockquote></blockquote></div><br>