[vtkusers] Is clipping really that hard in VTK???

Bertwim van Beest bwvb at xs4all.nl
Thu Aug 29 19:45:21 EDT 2002


Hi,
thanks for your reply. I will experiment with it.
One question though: in your code I see / "SetScalarModeToUsePointData/ 
" etc.
In my case, I have cell data. I have seen functions that convert cell 
data to point data (and vice versa), but from what I have seen these 
functions are useless in the sense that data is interpolated/averaged 
such that no sensible information is left.

What I need is clipping a (unstructured) grid, but keeping the cell data 
alive.

Does you code adress this problem?

Kind regards,
Bertwim


D.M.P.Davies wrote:

> *Bertwim*
>
> *I've just done exactly this in my  tcl/tk general purpose display 
> package using vtk3.2.*
>
> *Steps were as follows :*
>
> *###  Define a suitable implicit function to cut unstructured grid#####*
> /vtkCylinder $CC/
> /  $CC SetCenter  0 0 0/
> /  $CC SetRadius 100/
>
> /vtkSphere $CS/
> /  $CS SetCenter  0 0 0/
> /  $CS SetRadius 100/
>
> /vtkPlane $CP/
> /    $CP  SetOrigin 0 0 0/
> /    $CP SetNormal -1 -1 .5/
> /#CN/
>
> /set imp $CC/
> /set imp $C/P
>
> *############### Now Clip The Unstuctured Grid Boundary (i.e after 
> vtkGeometryFilter) ##############*
> /vtkClipPolyData $CN/
> /    $CN  SetInput [$boundary GetOutput]/
> /    $CN  SetClipFunction $imp/
> /    $CN  GenerateClipScalarsOff/
> /    $CN  SetValue 0.5/
> /$CN Update/
> */###### Also for in front of implicit function#####/*
> /vtkClipPolyData $Cn/
> /    $Cn  SetInput [$boundary GetOutput]/
> /    $Cn  SetClipFunction $imp/
> /    $Cn  GenerateClipScalarsOff/
> /    $Cn  SetInsideOut 1/
> /    $Cn  SetValue 0.5/
> /$Cn Update/
> *########## Now Cut The Full Structure to get better cut mesh 
> ##############*
>
> /vtkCutter $CE; #Generate cut lines/
> /   $CE SetInput [$thresh GetOutput]/
> /   $CE SetCutFunction $imp/
> /  $CE GenerateCutScalarsOff/
> /  $CE SetValue 0 0.5/
>
> *######## Now Append cutter mesh  to front and back clipped Polys and 
> map them ############*
> /vtkAppendPolyData $AP/
> /  $AP AddInput [$CN GetOutput]/
> /  $AP AddInput [$CE GetOutput]/
>
> /vtkDataSetMapper $CL/
> /$CL SetInput [$AP GetOutput]/
> /$CL SetLookupTable  vTK_LUT($LUT(no))/
> /$CL SetScalarRange $LUT($LUT(no),bot)  $LUT($LUT(no),top)/
> /$CL SetScalarModeToUsePointData/
>
> /vtkAppendPolyData $Ap/
> /  $Ap AddInput [$Cn GetOutput]/
> /  $Ap AddInput [$CE GetOutput]/
> /#/
> /vtkDataSetMapper $Cl/
> /$Cl SetInput [$Ap GetOutput]/
> /$Cl SetLookupTable  vTK_LUT($LUT(no))/
> /$Cl SetScalarRange $LUT($LUT(no),bot)  $LUT($LUT(no),top)/
> /$Cl SetScalarModeToUsePointData/
> *###################Actors For Front and 
> Back###################################*
> /vtkActor $CA/
> /    $CA SetMapper $CL/
> /    $CA SetProperty property(front)/
> /vtkActor $Ca/
> /    $Ca SetMapper $Cl/
> /    $Ca SetProperty property(back)/
> *##################Finally Render the actors 
> #############################*
> /Renderer($widget) AddActor $CA/
> /Renderer($widget) AddActor $Ca/
>
> */It Works Well for me with dials in control of the implicit funtion 
> positioning running under a  vtkTkRenderWidget's $widget./*
>  
>
> Bertwim van Beest wrote:
>
>> I simply don't understand how to do the following:
>>
>> I have a certain UnstructuredGrid, with one data value per cell.
>> ,
>> Bertwim
>>
>> _______________________________________________
>>




More information about the vtkusers mailing list