[vtk-developers] howto report a bug?

David Gobbi david.gobbi at gmail.com
Fri Oct 5 12:09:53 EDT 2012


I think the root of the problem is vtkSphere.  Here is the function
that it uses:

  return ( ((x[0] - this->Center[0]) * (x[0] - this->Center[0]) +
              (x[1] - this->Center[1]) * (x[1] - this->Center[1]) +
              (x[2] - this->Center[2]) * (x[2] - this->Center[2])) -
              this->Radius*this->Radius );

It is computing the squared distance from the surface of the sphere.
This is different from vtkPlane, which computes the linear distance
from the plane.  This is definitely going to cause scaling problems
when you combine these two functions with vtkImplicitBoolean.

VTK's clipping and contouring operations work by doing linearly
interpolating the scalar value along each edge or line segment that is
clipped.  In order for the clipping to be done accurately, the
implicit functions must return a signed linear distance from the
surface that the implicit function defines.  Because vtkSphere is
returning a squared distance, I have to declare that vtkSphere is
broken.

It should be using a formula like this:

  double d2 = (dx*dx + dy*dy + dz*dz - r*r);
  return (d2 < 0 ? -sqrt(-d2) : sqrt(d2));

This will make vtkSphere a bit slower, but it will make it give better results.

 - David


On Thu, Oct 4, 2012 at 5:05 PM, Sebastien Jourdain
<sebastien.jourdain at kitware.com> wrote:
> Ok then, could you save the 2 output of the vtkSampleFunction to a
> binary vtk file format and upload them to the bug tracker, so I can
> try to clip the dataset inside ParaView.
>
> Thanks,
>
> Seb
>
> On Thu, Oct 4, 2012 at 6:51 PM, Henning Meyer <tutmann at gmail.com> wrote:
>>> But I don't think the issue come from the contour filter. Did you
>>> tried to just render the SampleFunction ?
>> It looks almost the same in both cases - besides the 1000 * value range in
>> the second example.
> _______________________________________________
> Powered by www.kitware.com
>
> Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html
>
> Follow this link to subscribe/unsubscribe:
> http://www.vtk.org/mailman/listinfo/vtk-developers
>



More information about the vtk-developers mailing list