[vtkusers] How to read POINTS with double precision in a vtk data file ?

Mathieu Malaterre mathieu.malaterre at gmail.com
Fri Oct 17 09:50:03 EDT 2008


Salut Sophie,

  http://www.vtk.org/Wiki/VTK_FAQ#How_should_I_ask_questions_on_the_mailing_lists.3F
<quote>
 * Avoid HTML emails.
</quote>

thx

On Fri, Oct 17, 2008 at 3:16 PM, Sophie BOUDAUD
<sophie.boudaud at cdr.hutchinson.fr> wrote:
>
> Hi vtkusers,
>
> I want to read POINTS in a vtk data file with double precision, sadly POINTS
> values are truncated.
> Can someone explain me what is wrong with my program ?
>
> I'm working on Windows and I'm using TclPro1.4 and VTK4.2.

VTK 4.2 ? Are you sure ? I did not double check but I am pretty sure
that before the float->double transition most filter will operate on
float (single precision) so your effort might be doomed from start...

> My reading VTK file is :
< ... >
>
> I'm using vtkUnstructuredGridReader  to  read my VTK file :
>                vtkUnstructuredGridReader Ureader
>                        Ureader SetFileName $file
>
> A vtkUnstructuredGrid object is created to insert or delete points or cells
> :
>                vtkUnstructuredGrid usgModel
>                        usgModel ShallowCopy [Ureader GetOutput]
>
> To get the value of the first point :  set coord(0) [usgModel GetPoint 0]
> The coordinates are :  -121.5 -300 8.23639  !!!!

Well, that does not mean anything. This is a setting on your iostream
(fixed, setprecision...).
I would print the type of the dataarray contained in the vtkPoints of
my unstructured grid:

 ugrid->GetPoints()->GetData()->Print( std::cout )

it should says whether the data stored is indeed single or double precision.


-- 
Mathieu



More information about the vtkusers mailing list