[vtkusers] Cutting a 2D dataset with a vtkImplicitDataSet

David.Pont at ensisjv.com David.Pont at ensisjv.com
Sun Sep 4 17:24:54 EDT 2005


Paul Cochrane <cochrane at esscc.uq.edu.au> wrote on 02/09/2005 16:01:49:

> David,
>
> I've got another (and very similar) problem you might be able to help me
out
> with.  I'm now trying to clip (instead of cut) a 2D data set with a
contour
> generated from another 2D data set.  I'll explain what I'm trying to do,
and
> what I've done to try and get vtk to do it, and hopefully you, or someone
> else, may be able to give me some pointers.
>
> What I've got is a 2D bubble rising up through a fluid.  The surface of
the
> bubble is defined by the zero value contour of one data set of scalars.
> This is the easy part, I can just generate the contour using
> vtkContourFilter.  I now want to clip a data set that holds the vector
field
> of the fluid with the contour, so that the vector field that is defined
> inside the bubble (sounds odd, I know, having a vector field of a fluid
in a
> bubble when the fluid is outside, but anyway...  I think it's something
to
> do with this level set method that is being used to do the simulations)
is
> removed, and so I can display just the vector field outside the region of
> the bubbles, which makes a lot more sense to visualise what's going on.
>
> I've tried many ways of doing this, for instance:
> - use the contour as input to vtkImplicitDataSet and pass this as the
>   implicit function into vtkClipDataSet.  This doesn't produce anything
on
>   the output.

I have never used vtkImplicitDataSet but I think you are on the right track
here. You should input the original bubble data set to vtkImplicitDataSet
(rather than the contour). Then use it to clip the fluid by specifying the
clip value to vtkClipPolyData (which would be the same as you specified to
get the contour). You dont need the contour for clipping, but it might be
useful to outline the boundary for visualisation?
  Dave P

> - use vtkClipPolyData on the arrow glyphs generated from the initial
vector
>   field, with the contour as imput to vtkImplicitDataSet.  Again, no
output.
> - use a vtkProbeFilter between the contour and the vtkImplicitDataSet to
do
>   something similar to what you advised me to do before.  This seemed to
>   produce the right kind of output when one prints the object, but the
>   vktImplicitDataSet complained about not the right data set on input.
> - use vtkClipDataSet on the scalar data input with the value I would use
for
>   the contour, and try and use that data set to clip the vector data set.
>   Again, couldn't get that to go.
> - combine the two grids together (the vector and scalar) so that I can
pass
>   the new grid into vtkClipDataSet and use the scalar value in the grid
to
>   clip the vector part on output.  Again, couldn't get any output, or
what
>   did come out seemed like it was corrupted.  The grid that came out of
the
>   clip had bounds at around 1e299, but the names and dimensions etc of
the
>   vector and scalar arrays within the grid looked fine.
> - I've also tried vtkExtractGeometry without success
>
> I can't think of much else to try.  Any ideas as to what I'm doing wrong?
> Or any ideas as to how to solve this problem?  At the end of the day, I
just
> want to be able to visualise the vector field outside the bubbles, but
just
> the vector field (I know I can make a bubble in 3D using the
> RotationalExtrusionFilter to cover up the arrows, but that's just a bit
of a
> hack, and not what we want to see.
>
> Anyway, any help with this would be greatly appreciated.
>
> Many thanks in advance,
>
> Paul
>
> --
> Paul Cochrane
> Computational Scientist/Software Developer
> Earth Systems Science Computational Centre
> Rm 703, SMI Building
> University of Queensland
> Brisbane
> Queensland 4072
> Australia
>
> E: cochrane at esscc.uq.edu.au
> P: +61 7 3346 4109
> F: +61 7 3365 7347




More information about the vtkusers mailing list