[vtk-developers] howto report a bug?

Bill Lorensen bill.lorensen at gmail.com
Fri Oct 5 13:47:33 EDT 2012


Henning,

As a work around, just scale the plane uwing SetNormal so that the range of
the data is the same as the sphere (or other data). No need to implement
your own.

On Fri, Oct 5, 2012 at 1:26 PM, Henning Meyer <tutmann at gmail.com> wrote:

> Thank you all for helping me understanding the issue. For now I'll
> implement my own version of vtkSphere and vtkCylinder - I think the
> algorithm they use could be switched depending on a certain radius
> threshold (somewhere around 50). I'll try and produce some patches.
> Am 05.10.2012 20:11 schrieb "David Gobbi" <david.gobbi at gmail.com>:
>
> Several other implicit functions return squared distance instead
>> of linear distance.  Of course there's the caveat that clipping is
>> approximate for non-planar implicit surfaces, so people using
>> these functions should only expect approximate results.
>>
>> vtkCylinder
>> vtkQuadric
>> vtkSuperquadric
>> vtkImplicitHalo
>>
>> The last two classes, vtkSuperquadric and vtkImplicitHalo, aren't
>> even complete, they don't compute the function gradient.  And
>> vtkImplicitHalo has a math error in EvaluateFunction, and will only
>> give correct results if Radius=1.0.  So it's a very good thing that
>> these days we have gerrit to enforce code review.
>>
>> I'll see about posting a bug report to report my findings.  If anyone
>> wants to send patches, I'll be glad to review them.
>>
>>  - David
>>
>>
>>
>>
>> On Fri, Oct 5, 2012 at 10:42 AM, Bill Lorensen <bill.lorensen at gmail.com>
>> wrote:
>> > Will,
>> >
>> > Sounds like a good solution.
>> >
>> > Bill
>> >
>> >
>> > On Fri, Oct 5, 2012 at 12:40 PM, Will Schroeder <
>> will.schroeder at kitware.com>
>> > wrote:
>> >>
>> >> One approach is to just add an option to the class which indicates
>> whether
>> >> the take the sqrt or not. Leave the default behavior alone or you'll be
>> >> driving a lot of people nuts :-)
>> >> W
>> >>
>> >>
>> >> On Fri, Oct 5, 2012 at 12:09 PM, David Gobbi <david.gobbi at gmail.com>
>> >> wrote:
>> >>>
>> >>> 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
>> >>> >
>> >>> _______________________________________________
>> >>> 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
>> >>>
>> >>
>> >>
>> >>
>> >> --
>> >> William J. Schroeder, PhD
>> >> Kitware, Inc.
>> >> 28 Corporate Drive
>> >> Clifton Park, NY 12065
>> >> will.schroeder at kitware.com
>> >> http://www.kitware.com
>> >> (518) 881-4902
>> >>
>> >> _______________________________________________
>> >> 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
>> >>
>> >>
>> >
>> >
>> >
>> > --
>> > Unpaid intern in BillsBasement at noware dot com
>> >
>> _______________________________________________
>> 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
>>
>>


-- 
Unpaid intern in BillsBasement at noware dot com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/vtk-developers/attachments/20121005/dcbbde10/attachment.html>


More information about the vtk-developers mailing list