[vtkusers] Loss of precision vtkCutter with vtkPlanes with vtk 5.10.1 - Reposting
remy.trichet at zimmercas.com
Thu Feb 14 12:08:00 EST 2013
I tried to post on vtkusers but had no success yet, so I am trying on vtk-developers.
From: vtkusers-bounces at vtk.org [mailto:vtkusers-bounces at vtk.org] On Behalf Of Rémy Trichet
Sent: Wednesday, February 13, 2013 11:44 AM
To: vtkusers at vtk.org
Subject: [vtkusers] Loss of precision vtkCutter with vtkPlanes with vtk 5.10.1
I am trying to use a vtkCutter with vtkPlanes as CutFunction, and then get the output.
I set a vtkPlane with a normal (0.0, 0.0, 1.0) and an origin of (-1.0, -1.0, 0.5).
My source is half a sphere centered on (-1.0,-1.0,0.5) and with z > 0.5.
When I do the cut, and try to get the output, this is empty.
I try to cut the entire sphere instead of only a half with the same vtkPlane and get the output (with vtkPolyData::GetPoint(i)) and
I see that the resulting points have a z = 0.49999999046325684 instead of 0.5, which explains that the output is empty when I use half the sphere.
I am only using doubles and the vtk methods I am calling return also doubles, so I am wondering why this happens, and if I am doing something wrong?
Here is the sample :
vtkSmartPointer<vtkPlane> plane3 = vtkSmartPointer<vtkPlane>::New();
vtkSmartPointer<vtkSTLReader> roiModelReader =
vtkSmartPointer<vtkCutter> cutterForROI =
vtkPointSet* dataSet = cutterForROI->GetOutput();
int nbrPoints = dataSet->GetNumberOfPoints(); // = 0 with half the sphere
for(int i = 0; i<nbrPoints; ++i)
point = dataSet->GetPoint(i); // point = 0. 0.49999999046325684 when using the whole sphere
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the vtkusers