BVtkNodes icon indicating copy to clipboard operation
BVtkNodes copied to clipboard

Hexahedral box in BoxClipDataSet filter

Open vigeesh opened this issue 4 years ago • 2 comments

Hi @tkeskita,

I'm once again back to the vtkBoxClipDataSet filter. This time I'm struggling to get my clipping box to have an arbitrary orientation rather than having it parallel with the coordinate axis. I tried to modify the custom class definition, but somehow can't get it to work.

Is there a way to implement it in the BoxClipDataSet filter?

The VTK documentation says:

To use this filter, you can decide if you will be clipping with a box or a hexahedral box.

  1. Set orientation if(SetOrientation(0)): box (parallel with coordinate axis) SetBoxClip(xmin,xmax,ymin,ymax,zmin,zmax) if(SetOrientation(1)): hexahedral box (Default) SetBoxClip(n[0],o[0],n[1],o[1],n[2],o[2],n[3],o[3],n[4],o[4],n[5],o[5]) PlaneNormal[] normal of each plane PlanePoint[] point on the plane
  2. Apply the GenerateClipScalarsOn()
  3. Execute clipping Update();

In Paraview, I can do it by setting the Position, Rotation, Length.

vigeesh avatar Sep 14 '20 14:09 vigeesh

Hi, I was able to add Custom Code to vtkBoxClipDataSet like:

SetOrientation(1)
SetBoxClip([1, 0.1, 0], [0.5, 0, 0],  [0.1, 1, 0], [0, 0.5, 0], [0, 0.1, 1], [0, 0, 0.8],   [-1, 0, 0.1], [-0.5, 0, 0], [0.1, -1, 0], [0, -0.5, 0], [0.1 ,0, -1], [0, 0, 0.1])
GenerateClipScalarsOn()

Looking at SetBoxClip source code you need to specify normal vector and a point vector for each of the six sides of the clipping box. It's a bit cumbersome but you can do it.

Another way could be to first transform data, apply normal box clip and then transform back.

tkeskita avatar Sep 14 '20 15:09 tkeskita

Hi @tkeskita

Thanks for the tip.

vigeesh avatar Sep 15 '20 19:09 vigeesh