[vtkusers] get tcoords from pointId

Cory Quammen cory.quammen at kitware.com
Thu Dec 18 14:33:42 EST 2014


Hi Marco,

Texture coordinates are stored in an array in a vtkDataSet's
vtkPointData object. Say you have a vtkPolyData with texture
coordinates. To access it, you would do something like

vtkPointData* pd = polyData->GetPointData();
vtkDataArray* tcoords = pd->GetTCoords();

// Let's assume the tcoords are in a vtkFloatArray
vtkFloatArray* floatTcoords = vtkFloatArray::SafeDownCast(tcoords);
if (floatTCoords)
  {
  float texCoord[3];
  floatTcoords->GetTupleValue(pointId, texCoord);

  // do something with texCoord
  }

I hope that helps,
Cory

On Thu, Dec 18, 2014 at 1:58 PM, marco <piccima at gmail.com> wrote:
> Hello,
> maybe it has been deprecated but I cannot find a method like
> GetTcoords(pointId)!
> Is there something similar in the library?
>
> Thank you
>
> _______________________________________________
> Powered by www.kitware.com
>
> Visit other Kitware open-source projects at
> http://www.kitware.com/opensource/opensource.html
>
> Please keep messages on-topic and check the VTK FAQ at:
> http://www.vtk.org/Wiki/VTK_FAQ
>
> Follow this link to subscribe/unsubscribe:
> http://public.kitware.com/mailman/listinfo/vtkusers



-- 
Cory Quammen
R&D Engineer
Kitware, Inc.


More information about the vtkusers mailing list