Hi Shriram,<br><br>Thanks for response!<br><br>I got the error message "error: invalid use of incomplete type 'struct vtkPolyData' " related to the line "points = cone->GetOutput()->GetPoints();" when I compiled my program. I do not know how to correct it.<br><br>Actually I want to move the vertex with the max X value of the cone and change the colors of the surfaces conjoint to this vertex. So i have to get all the vertices information including the each x-y-z and the points-index (rendering order) of each surface.<br><br>Toron<br><br>my codes is here<br>--------------------------------------------------------------<br>#include "vtkPolyDataMapper.h"<br>#include "vtkRenderWindow.h"<br>#include "vtkCamera.h"<br>#include "vtkActor.h"<br>#include "vtkRenderer.h"<br>#include "vtkPoints.h"<br>#include "vtkCellArray.h"<br>#include "vtkIdType.h"<br>#include "vtkRenderWindowInteractor.h"<br>#include "vtkInteractorStyleTrackballCamera.h"<br><br>int main( int argc, char *argv[]
)<br>{<br> vtkConeSource *cone = vtkConeSource::New();<br> cone->SetHeight( 3.0 );<br> cone->SetRadius( 1.0 );<br> cone->SetResolution( 10 );<br> <br> vtkPoints* points = vtkPoints::New();<br> points = cone->GetOutput()->GetPoints();<br><br> for (vtkIdType i = 0; i < points->GetNumberOfPoints(); i++)<br> {<br> double Pt[3];<br> points->GetPoint(i, Pt);<br> // ...<br> // Pt will now have the x, y, z coordinates of vertex i.<br> }<br><br> //vtkCellArray *indexes = vtkCellArray::New();<br> //indexes = cone->GetOutput()->GetPoints(); <br><br> vtkPolyDataMapper *coneMapper = vtkPolyDataMapper::New();<br> coneMapper->SetInput( cone->GetOutput() );<br><br> vtkActor *coneActor = vtkActor::New();<br> coneActor->SetMapper( coneMapper );<br><br> vtkRenderer *ren1=
vtkRenderer::New();<br> ren1->AddActor( coneActor );<br> ren1->SetBackground( 0.1, 0.2, 0.4 );<br><br> vtkRenderWindow *renWin = vtkRenderWindow::New();<br> renWin->AddRenderer( ren1 );<br> renWin->SetSize( 300, 300 );<br><br> vtkRenderWindowInteractor *iren = vtkRenderWindowInteractor::New();<br> iren->SetRenderWindow(renWin);<br> iren->Initialize();<br> iren->Start();<br><br> cone->Delete();<br> coneMapper->Delete();<br> coneActor->Delete();<br> ren1->Delete();<br> renWin->Delete();<br><br> return 0;<br>}<br>--------------------------------------------------------------<br><br><br><br><br><b><i>Shriram Iyer <shriram.uc@gmail.com></i></b> wrote:<blockquote class="replbq" style="border-left: 2px solid rgb(16, 16, 255); margin-left: 5px; padding-left: 5px;"> Toron,<br><br>I'm not quite sure what you are trying to do here. If you just want to
the location of <br>each vertex in the cone, you can use following code.<span class="q"><br><br>vtkPoints* points = vtkPoints::New(); <br>points = cone->GetOutput()->GetPoints(); <br><br></span>for (vtkIdType i = 0; i < points->GetNumberOfPoints(); i++)<br>{<br> double Pt[3];<br> points->GetPoint(i, Pt);<br> // Pt will now have the x, y, z coordinates of vertex i.<br> ...<br>}<br><br> HTH.<br>Shriram<br><br><div><span class="gmail_quote">On 10/22/07, <b class="gmail_sendername">Toron J.</b> <<a href="mailto:ji_wi@yahoo.com">ji_wi@yahoo.com</a>> wrote:</span><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;"> Thanks, Shriram.<br><br>I do know how to read 'cone->GetOutput()->GetPoints()' you suggested. So I tired to add the below codes. <br>-------------------------------------------------------------------------<br> vtkPoints *points =
vtkPoints::New();<br> points = cone->GetOutput()->GetPoints(); <br><br> vtkCellArray *indexes = vtkCellArray::New();<br> indexes = cone->GetOutput()->GetPoints(); <br>------------------------------------------------------------------------ <br>They did work. Could you correct them or let me know any example like this?<br><span class="sg"><br>Toron</span><div><span class="e" id="q_115c9a5d74afd442_2"><br><br><br><br><br><br><b><i>Shriram Iyer <<a href="mailto:shriram.uc@gmail.com" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)"> shriram.uc@gmail.com</a>></i></b> wrote:<blockquote style="border-left: 2px solid rgb(16, 16, 255); margin-left: 5px; padding-left: 5px;"> Use cone->GetOutput()->GetPoints() to get the vertices.<br><br>Shriram<br> <br><div><span class="gmail_quote">On 10/22/07, <b class="gmail_sendername">Toron J.</b> <<a href="mailto:ji_wi@yahoo.com" target="_blank"
onclick="return top.js.OpenExtLink(window,event,this)">ji_wi@yahoo.com</a> > wrote: </span><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">Hi All,<br><br>I used the following codes to build a simple cone.<br>--------------------------------------------------------------------------------------- <br> vtkConeSource *cone = vtkConeSource::New();<br> cone->SetHeight( 3.0 );<br> cone->SetRadius( 1.0 );<br> cone->SetResolution( 6 );<br> <br> vtkPolyDataMapper *coneMapper = vtkPolyDataMapper::New(); <br> coneMapper->SetInput( cone->GetOutput() );<br>--------------------------------------------------------------------------------------<br>Does any one can help me to know how to get the position (x,y,z) of each vertex and the rendering index?
Thanks in advance! <br><span><br>Toron<br></span><span><div> __________________________________________________<br>Do You Yahoo!?<br>Tired of spam? Yahoo! Mail has the best spam protection around <br><a href="http://mail.yahoo.com" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)"> http://mail.yahoo.com</a> </div></span><br>_______________________________________________<br>This is the private VTK discussion list.<br>Please keep messages on-topic. Check the FAQ at: <a href="http://www.vtk.org/Wiki/VTK_FAQ" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)"> http://www.vtk.org/Wiki/VTK_FAQ</a><br>Follow this link to subscribe/unsubscribe:<br><a href="http://www.vtk.org/mailman/listinfo/vtkusers" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)">http://www.vtk.org/mailman/listinfo/vtkusers </a><br><br></blockquote></div><br> </blockquote><br><div> __________________________________________________<br>Do You
Yahoo!?<br>Tired of spam? Yahoo! Mail has the best spam protection around <br><a href="http://mail.yahoo.com" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)"> http://mail.yahoo.com</a> </div></span></div></blockquote></div><br> </blockquote><br><p> __________________________________________________<br>Do You Yahoo!?<br>Tired of spam? Yahoo! Mail has the best spam protection around <br>http://mail.yahoo.com