So after struggling with this for a while, I've come up with the following code, which kinda does the job.<div><br></div><div><div> public vtkPoints reorderPoints(vtkPolyData unorderedData) {</div><div> vtkStripper stripper = new vtkStripper();</div>
<div> stripper.SetInput(unorderedData);</div><div> stripper.Update();</div><div> vtkPolyData strippedData = stripper.GetOutput();</div><div> </div><div> vtkPoints points = new vtkPoints();</div>
<div> // Here, we're trying to mimic the suggestion given here</div><div> // <a href="http://vtk.1045678.n5.nabble.com/question-about-vtkContourWidget-vtkContourRepresentation-td1255118.html#a3247766">http://vtk.1045678.n5.nabble.com/question-about-vtkContourWidget-vtkContourRepresentation-td1255118.html#a3247766</a></div>
<div> for (int i=0; i<strippedData.GetNumberOfCells(); i++) {</div><div> vtkCell cell = strippedData.GetCell(i);</div><div> for (int j=0; j<cell.GetPoints().GetNumberOfPoints()-1; j++) {</div>
<div> points.InsertNextPoint(cell.GetPoints().GetPoint(j));</div><div> }</div><div> }</div><div> return points;</div><div> }</div>The points that are returned are in "better" order than having not run this method, but it's still not the correct order. It turns out that I cannot upgrade to the newest version of VTK because we're using GDCM which isn't yet integrated into the newest version of VTK, so I'm stuck with 5.6 for now. However, I did do a test on the head of GIT and I tried to use Karthik's code suggested above, but I still couldn't get that working. I attempted to follow internally what vtkCellArray.GetNextCell() was doing, and that's how I came up with the above function. </div>
<div><br></div><div>Can someone tell me why the above function isn't returning the vtkPoints in the correct order for vtkContourWidget?</div><div><br></div><div>Thanks<br><div class="gmail_quote">On Sat, Nov 6, 2010 at 10:12 PM, Karthik Krishnan <span dir="ltr"><<a href="mailto:karthik.krishnan@kitware.com">karthik.krishnan@kitware.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">Ah.. yes.. This method was added on May 19, 2010. Perhaps you are<br>
using a version of VTK prior to that.<br>
<br>
Please see :<br>
<a href="http://vtk.org/gitweb?p=VTK.git;a=commitdiff;h=068a064cea7ba0fc7a4c4f9d2f7dfed6eb093674" target="_blank">http://vtk.org/gitweb?p=VTK.git;a=commitdiff;h=068a064cea7ba0fc7a4c4f9d2f7dfed6eb093674</a><br>
<br>
Update your VTK.<br>
<div><div></div><div class="h5"><br>
<br>
On Sat, Nov 6, 2010 at 10:54 PM, Jonathan Morra <<a href="mailto:jonmorra@gmail.com">jonmorra@gmail.com</a>> wrote:<br>
> I couldn't find GetNextCell() at all in Java. I'm currently using version<br>
> 5.6. Do you have any other suggestions?<br>
><br>
> On Nov 6, 2010 9:05 AM, "Karthik Krishnan" <<a href="mailto:karthik.krishnan@kitware.com">karthik.krishnan@kitware.com</a>><br>
> wrote:<br>
><br>
> Jonathan:<br>
><br>
> Use the other signature of the method GetNextCell. [ int<br>
> GetNextCell(vtkIdList *pts) ]That should be wrapped...<br>
><br>
> The code to re-order the points based on the connectivity information<br>
> would be written in java as :<br>
><br>
> vtkIdList idlist = new vtkIdList();<br>
> unorderedPolyData.GetLines().GetNextCell(idlist);<br>
> npts = idlist.GetNumberOfIds();<br>
> for ( int i = 0; i < ( npts-1 ); i ++)<br>
> {<br>
> points.InsertPoint(i, unorderedPolyData.GetPoints().GetPoint(pts[i]));<br>
> }<br>
><br>
> --<br>
> karthik<br>
><br>
> On Wed, Nov 3, 2010 at 7:29 AM, Jonathan Morra <<a href="mailto:jonmorra@gmail.com">jonmorra@gmail.com</a>> wrote:<br>
>> I have a 3D vtkPolyDat...<br>
><br>
>> _______________________________________________<br>
>> Powered by <a href="http://www.kitware.com" target="_blank">www.kitware.com</a><br>
>><br>
>> Visit other Kitwa...<br>
</div></div></blockquote></div><br></div>