<table cellspacing="0" cellpadding="0" border="0" ><tr><td valign="top" style="font: inherit;">Hello,<br><br>(I have corrected some things in my previous mail)<br>I 'm creating a 3D animation, visualizing a 3D surface per frame (the data get loaded from <br>files) and I 've tried to improve it's speed. I give you my code below. I 've tried to speed up<br>the setting of vertex and cell data by using "SetArray" instead of looping through the <br>whole array. Setting the vertex data works fine, causing no trouble, but when I try to set the <br>cell data I get crashes. The code for setting the vertex and the cell data is quite similar, so<br>I can't understand why the 1st works while the other fails... :(<br>I am a beginner in VTK. Any kind of help would be highly appreciated.<br><br>The "(int*)TPoints" variable is a pointer to integer data that defines triangles like the <br>following:<br>{3,a1,b1,c1, 3,a2,b2,c2,
3,a3,b3,c3, ...............}
repeated "m_NumOfTriangles" <br>times.<br><br>#define FAST // Enable fast vertex data set.<br>#define FAST_2 // Enable fast cell data set.<br>.....<br>.....<br><br> if( !LoadTrianglesFromFile(lpStr,false) ) return;<br> //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~<br> vtkPoints *points = vtkPoints::New();<br>#ifdef FAST<br> points->SetDataTypeToFloat();<br> vtkFloatArray* da = vtkFloatArray::New();<br> da->SetNumberOfComponents(3);<br> da->SetArray((float*)VerticesP, m_NumOfVertices*3*sizeof(float), 1);<br> points->SetData(da);<br> da->Delete();<br>#else<br> for(int k=0;
k<m_NumOfVertices; k++)<br> {<br> points->SetPoint(k, VerticesP[k].coords);<br> }<br>#endif<br> //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~<br> vtkCellArray *cellArray = vtkCellArray::New();<br>#ifdef FAST_2<br> cellArray->SetNumberOfCells(m_NumOfTriangles);<br> vtkIdTypeArray *ita = vtkIdTypeArray::New();<br> ita->SetNumberOfComponents(4);<br> ita->SetArray((int*)TPoints, m_NumOfTriangles*4*sizeof(int), 1);<br> cellArray->SetCells(m_NumOfTriangles, ita);<br> ita->Delete();<br>#else<br> for(int k=0; k<m_NumOfTriangles; k++)<br> {<br> cellArray->InsertNextCell(3, TPoints[k].corners);<br>
}<br>#endif<br><br><br><br>Thanks.<br><br></td></tr></table><br>
<hr size=1><font size=-1 face=Arial>
Χρησιμοποιείτε Yahoo!<br>
Βαρεθήκατε τα ενοχλητικά μηνύ ματα (spam); Το Yahoo! Mail διαθέτει την καλύτερη δυνατή προστασία κατά των ενοχλητικών μηνυμάτων <br>
<a href="http://login.yahoo.com/config/mail?.intl=gr">http://login.yahoo.com/config/mail?.intl=gr</a> </font>