[vtkusers] Filtering Double Precision Point data with vtkCleanPolyDate (for example) outputs only Single Precision?

Klaus Friedeheim K.Friedeheim at hydrotec.de
Fri Dec 2 11:26:00 EST 2005


Dear vtkusers,

I have some difficulties with Double Precision Point Data.
The Filter vtkCleanPolyData works fine, but Precision is lost.
Have I missed something? 

I am using vtk 5.0 with Python 2.3.

Here is what I have got ( For the testscript and datafiles see below):
the printout from the script below
----------------------------------------------
Original Points 2
(1234567890.1234567, 1234567890.1234567, 1234567890.1234567)
(1234567890.1234567, 1234567890.1234567, 1234567890.1234567)
Filtered Points 1
(1234567936.0, 1234567936.0, 1234567936.0)
----------------------------------------------

2 Points in (17 digits)
1 Point out (filter works but only 9 digits are left over):

I found vtkPoints.SetDataTypeToDouble(). But I cannot 
SetDataTypeToDouble() for vtkCleanPolyData(), can I?
Are there any Global Switches or Compile Options I missed?

Thanks
Klaus Friedeheim
________________________________
Dr.-Ing. Klaus Friedeheim
Hydrotec Ing.-Ges. fuer Wasser und Umwelt mbH
Bachstrasse 62 - 64, D-52066 Aachen
Telefon: ++49-241-9 46 89-35, Fax: ++49-241-50 68 89
E-Mail: mailto:k.friedeheim at hydrotec.de
Internet: http://www.hydrotec.de


----------------------------------------------
The Programm (just reading, printing, filtering, printing writing, 
writing):
----------------------------------------------
#!/usr/bin/env python
import vtk
#     reading
geom = vtk.vtkPolyDataReader()
geom.SetFileName('test.vtk')
geom.Update()
#
test1 = vtk.vtkPolyData()
test1 = geom.GetOutput()
# 
print '\nOriginal Points', test1.GetNumberOfPoints()
print test1.GetPoints().GetPoint(0)
print test1.GetPoints().GetPoint(1)
#      filtering
clean = vtk.vtkCleanPolyData()
clean.SetInput(geom.GetOutput())
clean.Update()
#
test2 = vtk.vtkPolyData()
test2 = clean.GetOutput()
#
print '\nFiltered Points', test2.GetNumberOfPoints()
print test2.GetPoints().GetPoint(0)
#      writing
writer1 = vtk.vtkPolyDataWriter()
writer1.SetFileName("test_original.vtk")
writer1.SetInput(geom.GetOutput())
writer1.Write()
#
writer2 = vtk.vtkPolyDataWriter()
writer2.SetFileName("test_filtered.vtk")
writer2.SetInput(clean.GetOutput())
writer2.Write() 

----------------------------------------------
The Input (just 2 points, 1 vertex, a lot or percision digits):
----------------------------------------------
# vtk DataFile Version 3.0
vtk output
ASCII
DATASET POLYDATA
POINTS 2 double
1234567890.123456789 1234567890.123456789 1234567890.123456789
1234567890.123456789 1234567890.123456789 1234567890.123456789
VERTICES 1 2
1 0
CELL_DATA 1
POINT_DATA 2

----------------------------------------------
Output from Writer1 (double, but only 7 significant digits)
----------------------------------------------
# vtk DataFile Version 3.0
vtk output
ASCII
DATASET POLYDATA
POINTS 2 double
1.23457e+009 1.23457e+009 1.23457e+009 1.23457e+009 1.23457e+009 
1.23457e+009 
VERTICES 1 2
1 0 
CELL_DATA 1
POINT_DATA 2

----------------------------------------------
Output from Writer2 (only float left)
----------------------------------------------
# vtk DataFile Version 3.0
vtk output
ASCII
DATASET POLYDATA
POINTS 1 float
1.23457e+009 1.23457e+009 1.23457e+009 
VERTICES 1 2
1 0 
CELL_DATA 1
POINT_DATA 1




More information about the vtkusers mailing list