[vtkusers] Problems with vtkClipPolyData and vtkImplicitBoolean

Cory Quammen cory.quammen at kitware.com
Mon Jan 4 10:20:36 EST 2016


Hi Normanius,

I'm CC'ing David Gobbi for his expertise in geometry operations in VTK as
he likely has some insight in the issue and what you've done.

Looking at the other implicit functions besides vtkPlane, it looks like
most evaluate the squared distance rather than the linear distance, so this
appears to be by design. I'm not familiar with the history of the classes,
but, as you suspect, I wouldn't recommend changing the current behavior of
vtkCylinder because it would be a backwards-incompatible change. Instead,
for your application, I would recommend subclassing vtkCylinder and
overriding the EvaluateFunction() and possibly EvaluateGradient() if you
need it to compute the non-squared distances.

Regarding your second patch, I am intrigued by using a bisection method or
other solver to find the zero-crossing of the implicit function. Your
results with the combined cylinder and planes look very nice. I might
recommend changing from specifying the clipping function from
vtkImplicitFunction to something more general, like a callback function,
though I'm not completely sold on that, and moving the setting/getter to
vtkCell so that other cells might someday make use of the zero-crossing
function.

Thanks for the interesting work,
Cory

On Fri, Jan 1, 2016 at 8:10 AM, normanius <juch at zhaw.ch> wrote:

> Hi VTK-developers
>
> I implemented a hack that solves the above problem for me. See the result
> (before and after):
>
> <http://vtk.1045678.n5.nabble.com/file/n5735721/comparison.jpg>
>
> Below the two patches. The second patch is the important one. The first one
> just implements the suggested linear distance metric for vtkCylinder. (I
> branched off from the revision git-hash ac7a28f).
> patch-001-linear-cylinder-function.diff
> <
> http://vtk.1045678.n5.nabble.com/file/n5735721/patch-001-linear-cylinder-function.diff
> >
> patch-002-clippolydata-triangle-clipping-fix.diff
> <
> http://vtk.1045678.n5.nabble.com/file/n5735721/patch-002-clippolydata-triangle-clipping-fix.diff
> >
>
> Here is what I did roughly: In vtkTriangle::Clip(), use the bisection
> method
> to correctly find the "zero-crossing", as an alternative to the linear
> interpolation that is the method of choice in the current release. The
> bisection method requires a handle to the implicit function and the
> iso-value used in vtkClipPolyData. If in the cell traversal in
> vtkClipPolyData::RequestData() the current vtkGenericCell turns out to be
> of
> triangular type, it gets dirty-casted into vtkTriangle and the implicit
> function and the iso-value are set. This will trigger the advanced
> interpolation scheme in vtkTriangle::Clip().
>
> Obviously, my fix works only for triangular meshes. I haven't spent a
> thought on how to generalise and implement this properly. Let me know what
> you think. Shall create an issue in your bug-tracker?
>
>
>
>
>
> --
> View this message in context:
> http://vtk.1045678.n5.nabble.com/Problems-with-vtkClipPolyData-and-vtkImplicitBoolean-tp5735713p5735721.html
> Sent from the VTK - Users mailing list archive at Nabble.com.
> _______________________________________________
> Powered by www.kitware.com
>
> Visit other Kitware open-source projects at
> http://www.kitware.com/opensource/opensource.html
>
> Please keep messages on-topic and check the VTK FAQ at:
> http://www.vtk.org/Wiki/VTK_FAQ
>
> Search the list archives at: http://markmail.org/search/?q=vtkusers
>
> Follow this link to subscribe/unsubscribe:
> http://public.kitware.com/mailman/listinfo/vtkusers
>



-- 
Cory Quammen
R&D Engineer
Kitware, Inc.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/vtkusers/attachments/20160104/47e98491/attachment.html>


More information about the vtkusers mailing list