[vtkusers] how to get the details about the object created by vtk sources?

Shriram Iyer shriram.uc at gmail.com
Mon Oct 22 18:13:22 EDT 2007


Toron,

I'm not quite sure what you are trying to do here. If you just want to the
location of
each vertex in the cone, you can use following code.

vtkPoints* points = vtkPoints::New();
points = cone->GetOutput()->GetPoints();

for (vtkIdType i = 0; i < points->GetNumberOfPoints(); i++)
{
  double Pt[3];
  points->GetPoint(i, Pt);
  // Pt will now have the x, y, z coordinates of vertex i.
 ...
}

HTH.
Shriram

On 10/22/07, Toron J. <ji_wi at yahoo.com> wrote:
>
> Thanks, Shriram.
>
> I do know how to read 'cone->GetOutput()->GetPoints()' you suggested. So I
> tired to add the below codes.
> -------------------------------------------------------------------------
>   vtkPoints *points = vtkPoints::New();
>     points = cone->GetOutput()->GetPoints();
>
>   vtkCellArray *indexes = vtkCellArray::New();
>     indexes = cone->GetOutput()->GetPoints();
> ------------------------------------------------------------------------
> They did work. Could you correct them or let me know any example like
> this?
>
> Toron
>
>
>
>
>
> *Shriram Iyer <shriram.uc at gmail.com>* wrote:
>
> Use cone->GetOutput()->GetPoints() to get the vertices.
>
> Shriram
>
> On 10/22/07, Toron J. <ji_wi at yahoo.com > wrote:
> >
> > Hi All,
> >
> > I used the following codes to build a simple cone.
> > ---------------------------------------------------------------------------------------
> >
> >   vtkConeSource *cone = vtkConeSource::New();
> >       cone->SetHeight( 3.0 );
> >       cone->SetRadius( 1.0 );
> >       cone->SetResolution( 6 );
> >
> >   vtkPolyDataMapper *coneMapper = vtkPolyDataMapper::New();
> >       coneMapper->SetInput( cone->GetOutput() );
> >
> > --------------------------------------------------------------------------------------
> > 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!
> >
> > Toron
> > __________________________________________________
> > Do You Yahoo!?
> > Tired of spam? Yahoo! Mail has the best spam protection around
> > http://mail.yahoo.com
> >
> > _______________________________________________
> > This is the private VTK discussion list.
> > Please keep messages on-topic. Check the FAQ at:
> > http://www.vtk.org/Wiki/VTK_FAQ
> > Follow this link to subscribe/unsubscribe:
> > http://www.vtk.org/mailman/listinfo/vtkusers
> >
> >
>
> __________________________________________________
> Do You Yahoo!?
> Tired of spam? Yahoo! Mail has the best spam protection around
> http://mail.yahoo.com
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20071022/c65996e7/attachment.htm>


More information about the vtkusers mailing list