[vtkusers] Tolerance of InsertNextPoint in python

Brett Tully brett.tully at oxyntix.com
Tue Apr 3 08:48:58 EDT 2012


Brilliant, thank you!

On Tue, Apr 3, 2012 at 1:43 PM, David Gobbi <david.gobbi at gmail.com> wrote:

> Hi Brett,
>
> The default type of vtkPoints is "float".  If you need more precision,
> then you can change the precision to "double":
>
> vtk_points = vtk.vtkPoints()
> vtk_points.SetDataTypeToDouble()
>
> This is true in both C++ and Python.
>
>  - David
>
>
> On Tue, Apr 3, 2012 at 6:22 AM, Brett Tully <brett.tully at oxyntix.com>
> wrote:
> > Dear all,
> >
> > I am finding that vtkPoints.InsertNextPoint when called from python does
> not
> > return a point where I want it -- it seems to be out by ~1e-10 -- is
> there a
> > way to set the tolerance of this function or improve its location to be
> more
> > precise than 1e-10? Or is this due to python floats?
> >
> > Thanks,
> > Brett.
> >
> > I.e. the following python:
> >
> > import vtk
> > vtk_points = vtk.vtkPoints()
> > e = [0.0, 0.0065, 0.0]
> > e_id = vtk_points.InsertNextPoint(*e)
> > p_e = vtk_points.GetPoint(e_id)
> > print p_e, e
> > print (e[0] - p_e[0]), (e[1] - p_e[1]), (e[2] - p_e[2])
> >
> > # gives
> > # (0.0, 0.006500000134110451, 0.0) [0.0, 0.0065, 0.0]
> > # 0.0 -1.34110451043e-10 0.0
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20120403/cf48e58d/attachment.htm>


More information about the vtkusers mailing list