[vtkusers] get tcoords from pointId
marco
piccima at gmail.com
Thu Dec 18 16:09:41 EST 2014
Hello
I was able to retrieve the tcoords for my Points.
Now I'm trying to access the texture image to get the rgb value for that
location.
Is possible to use directly the tcoords to do that? or I have to compute
the pixel coordinate with a transformation?
Thank you for your help
Marco
On 12/18/2014 02:33 PM, Cory Quammen wrote:
> 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
>
>
More information about the vtkusers
mailing list