<DIV>Hi Randall,</DIV>
<DIV> </DIV>
<DIV>This piece of code might be helpful.</DIV>
<DIV> </DIV>
<DIV> for(int i=0;i<count;i++)<BR>{</DIV>
<DIV> int a, b, c;<BR> importCellArray->InsertNextCell(3);<BR> importCellArray->InsertCellPoint(a);<BR> importCellArray->InsertCellPoint(b);<BR> importCellArray->InsertCellPoint(c);</DIV>
<DIV>}//Generate Triangle List</DIV>
<DIV> </DIV>
<DIV>for(i=0;i<count;i++)<BR>{<BR> float x,y,z;<BR> importPoints->InsertPoint(importPoints->GetNumberOfPoints(),x,y,z);<BR>}//Generate Points<BR></DIV>
<DIV>finalPoly->SetPoints(importPoints);<BR>finalPoly->SetPolys(importCellArray);</DIV>
<DIV> </DIV>
<DIV>Qiang</DIV>
<DIV><BR><B><I>Randall Hand <randall.hand@gmail.com></I></B> 写道:</DIV>
<BLOCKQUOTE class=replbq style="PADDING-LEFT: 5px; MARGIN-LEFT: 5px; BORDER-LEFT: #1010ff 2px solid">I have a code block similar to this:<BR><BR> // First load the points<BR> vtkPoints *newPts = vtkPoints::New();<BR> newPts->Allocate(countVert);<BR> for(i=1; i<=countVert; i++) {<BR> newPts->InsertPoint(i-1, x, y, z);<BR> }<BR><BR> // Now load up the connectivity<BR> vtkIdList *pts = vtkIdList::New();<BR> pts->Allocate(VTK_CELL_SIZE);<BR> vtkCellArray *newPolys = vtkCellArray::New();<BR> newPolys->Allocate(countPoly);<BR><BR> for(i=1; i<=countPoly; i++) {<BR> pts->Reset();<BR>
pts->InsertNextId(v1-1);<BR> pts->InsertNextId(v2-1);<BR> pts->InsertNextId(v3-1);<BR> newPolys->InsertNextCell(pts);<BR> }<BR> fclose(fptr);<BR><BR> vtkPolyData *output = vtkPolyData::New();<BR> output->SetPoints(newPts);<BR> newPts->Delete();<BR> output->SetPolys(newPolys);<BR> newPolys->Delete();<BR> pts->Delete();<BR><BR>Now when I try to query the resulting vtkPolyData, I get segfaults in the ComputeBounds routines. I tried connecting it to a vtkPLYWriter, and it saves a file to disk that crashes both 3DSMax & Paraview. Any ideas what I'm missing here?<BR><BR>-- <BR>Randall Hand<BR><A href="http://www.yeraze.com/">http://www.yeraze.com</A>
_______________________________________________<BR>This is the private VTK discussion list. <BR>Please keep messages on-topic. Check the FAQ at: http://www.vtk.org/Wiki/VTK_FAQ<BR>Follow this link to subscribe/unsubscribe:<BR>http://www.vtk.org/mailman/listinfo/vtkusers<BR></BLOCKQUOTE><BR><BR><p><br><hr size=1>
<b>Do You Yahoo!?</b><br>
<a href="http://cn.rd.yahoo.com/mail_cn/tag/1g/*http://cn.mail.yahoo.com/" target=blank>注册世界一流品质的雅虎免费电邮</a>