<table cellspacing="0" cellpadding="0" border="0" ><tr><td valign="top" style="font: inherit;"><DIV>Hello David,</DIV>
<DIV> </DIV>
<DIV>thanks a lot for the example, but there it looks like a new polyData is created. I read mine from a VTK file.</DIV>
<DIV> </DIV>
<DIV>Here is an example of the VTK file. The values are already there, I just want to change the point coordinates and I managed to extract the point coordinates from the VTK and changed them. Then I put them into the polyData again but then I'm stuck, putting the polyData back into the object where I took it from. Here is an example of my code:</DIV>
<DIV> </DIV>
<DIV> </DIV>
<DIV>Reader[0]->SetFileName("D:/VTKzeug/room3D/temperature.vtk"); <BR>Reader[0]->Update();</DIV>
<DIV><BR>//Now making a 2D plane, to make a cut through the room<BR>plane = vtkPlaneSource::New();</DIV>
<DIV>plane->SetResolution(((int)sqrt(tempForRes))*resolutionFactorX,((int)sqrt(tempForRes))*resolutionFactorY);<BR>plane->SetOrigin(linex1, liney1, linez1);<BR>plane->SetPoint1(linex2, liney2 , linez1);<BR>plane->SetPoint2(linex1, liney1, linez2);</DIV>
<DIV>probe = vtkProbeFilter::New(); <BR>probe->SetInput(plane->GetOutput()); <BR>probe->SetSource(Reader->GetOutput());<BR>probe->Update();</DIV>
<DIV>//Now changing the point-coordinates with own calculation <BR>//(I rotate the points and translate them) The values remain the same<BR>PolyDat = vtkPolyData::New();<BR>PolyDat = probe->GetPolyDataOutput();</DIV>
<DIV>numberOfCells=PolyDat->GetNumberOfPoints();</DIV>
<DIV>data = vtkPolyData::New();<BR>scalars = vtkFloatArray::New();<BR>points = vtkPoints::New();</DIV>
<DIV>for (int i = 0; i < numberOfCells; i++)<BR>{<BR> scalars->InsertTuple1(i, PolyDat->GetPointData()->GetScalars()->GetTuple(j));</DIV>
<DIV>//deleted the stuff here to calculate the new coordinate values<BR> points->InsertPoint(i, newX, nexY, newZ);<BR>}</DIV>
<DIV>//I take the new point-coordinates, as well as the unchanges scalars to the vtkPolyData <BR>//and now don't know how to take them into the vtkPlaneSource probe again<BR>PolyDat->SetPoints(points);<BR>PolyDat->GetPointData()->SetScalars(scalars);<BR></DIV>
<DIV> </DIV>
<DIV> </DIV>
<DIV>... I don't know if there is a class that provides simple translating and rotating the points of the polyData, so I did it manually. But now I can not bring the polyData back to the vtkPlaneSource plane for visualising it.</DIV>
<DIV> </DIV>
<DIV>Greets</DIV>
<DIV>Dmitri<BR><BR>--- David Doria <I><daviddoria+vtk@gmail.com></I></B> schrieb am <B>Di, 4.8.2009:<BR></DIV>
<BLOCKQUOTE style="BORDER-LEFT: rgb(16,16,255) 2px solid; PADDING-LEFT: 5px; MARGIN-LEFT: 5px"><BR>Von: David Doria <daviddoria+vtk@gmail.com><BR>Betreff: Re: [vtkusers] Translating and rotating PolyData<BR>An: vtkusers@vtk.org<BR>Datum: Dienstag, 4. August 2009, 14:00<BR><BR>
<DIV id=yiv1517680561>
<DIV class=gmail_quote>
<BLOCKQUOTE style="BORDER-LEFT: rgb(204,204,204) 1px solid; MARGIN: 0pt 0pt 0pt 0.8ex; PADDING-LEFT: 1ex" class=gmail_quote>
<TABLE border=0 cellSpacing=0 cellPadding=0>
<TBODY>
<TR>
<TD style="FONT-FAMILY: inherit; font-size-adjust: inherit; font-stretch: inherit" vAlign=top><B>
<BLOCKQUOTE style="BORDER-LEFT: rgb(16,16,255) 2px solid; PADDING-LEFT: 5px; MARGIN-LEFT: 5px"><BR>
<DIV>Hello David,</DIV>
<DIV> </DIV>
<DIV>I'm not sure if i explained it right. First I read a VTK file, in which is a rectilinear grid in 3D. And every point of the grid has its value (scalar) (for example, in a 3D room each value is a temperature at its coordinates)</DIV>
<DIV> </DIV>
<DIV>I now want to move the values in the grid, so that for example</DIV>
<DIV> </DIV>
<DIV>
<DIV>x = 0, y = 0, z = 0</DIV>
<DIV>with the temperature value 30°C in that location and I move it to:</DIV>
<DIV class=im>
<DIV> x = x +100 </DIV>
<DIV>so that the new coordinates are :</DIV></DIV>
<DIV>x = 100, y = 0, z = 0</DIV>
<DIV>and the value has still to be 30°C</DIV>
<DIV>this is what I want to reach.</DIV>
<DIV>Hope I managed to explain that somehow.</DIV>
<DIV> </DIV>
<DIV>Greets</DIV>
<DIV>Dmitri</DIV></DIV></BLOCKQUOTE></B></TD></TR></TBODY></TABLE><BR></BLOCKQUOTE></DIV><BR>Dmitri,<BR><BR>Please reply to the list rather than an individual so everyone can benefit from the conversation.<BR><BR>Yes, that explanation is exactly what I thought you were talking about. See this example for how to attach that temperature value to your grid points:<BR><BR><A href="http://www.vtk.org/Wiki/Add_Miscellaneous_Data_to_Points_in_a_Polydata" rel=nofollow target=_blank>http://www.vtk.org/Wiki/Add_Miscellaneous_Data_to_Points_in_a_Polydata</A><BR><A href="http://www.vtk.org/Wiki/Add_Miscellaneous_Data_to_Cells_in_a_Polydata" rel=nofollow target=_blank>http://www.vtk.org/Wiki/Add_Miscellaneous_Data_to_Cells_in_a_Polydata</A><BR><BR>I'm assuming the values are already in that type of array in your vtk file? If you can't get it from here please provide the vtk file and we'll take a look.<BR><BR
clear=all>Thanks,<BR><BR>David<BR></DIV><BR>-----Integrierter Anhang folgt-----<BR><BR>
<DIV class=plainMail>_______________________________________________<BR>Powered by www.kitware.com<BR><BR>Visit other Kitware open-source projects at <A href="http://www.kitware.com/opensource/opensource.html" 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" target=_blank>http://www.vtk.org/Wiki/VTK_FAQ</A><BR><BR>Follow this link to subscribe/unsubscribe:<BR><A href="http://www.vtk.org/mailman/listinfo/vtkusers" target=_blank>http://www.vtk.org/mailman/listinfo/vtkusers</A><BR></DIV></BLOCKQUOTE></B><B></B></td></tr></table><br>