#include <vtkBox.h>
#include <vtkPlane.h>
#include <vtkClipPolyData.h>
-
+#include <vtkPolyDataNormals.h>
namespace bbcreaVtk
{
vtkPlane *clipPlane = vtkPlane::New();
vtkBox *clipBox = vtkBox::New();
vtkClipPolyData *clipper = vtkClipPolyData::New();
+// clipper->GenerateClipScalarsOn();
+// clipper->GenerateClippedOutputOff();
+//EED 2017-01-01 Migration VTK7
+#if VTK_MAJOR_VERSION <= 5
clipper -> SetInput( bbGetInputIn() );
+#else
+// vtkPolyDataNormals *nn = vtkPolyDataNormals::New();
+// nn->SetInputData( bbGetInputIn() );
+// clipper -> SetInputData( nn->GetOutput() );
+ clipper -> SetInputData( bbGetInputIn() );
+#endif
clipper->SetInsideOut( bbGetInputInsideVol() );
-
int a; // correction border
if (bbGetInputInsideVol()==false)
{
} else {
a=0;
}
-
int px=bbGetInputPoint()[0];
int py=bbGetInputPoint()[1];
int pz=bbGetInputPoint()[2];
-
if ( bbGetInputType()=="x" ) { clipPlane->SetNormal(1, 0, 0); ok=1; } else
if ( bbGetInputType()=="y" ) { clipPlane->SetNormal(0, 1, 0); ok=1; } else
if ( bbGetInputType()=="z" ) { clipPlane->SetNormal(0, 0, 1); ok=1; } else
-
if ( bbGetInputType()=="x+y+" ) { clipBox->SetBounds(px ,px+sb ,py ,py+sb ,pz-sb ,pz+sb ); ok=2; } else
if ( bbGetInputType()=="x-y+" ) { clipBox->SetBounds(px-sb,px+a ,py ,py+sb ,pz-sb ,pz+sb ); ok=2; } else
if ( bbGetInputType()=="x+y-" ) { clipBox->SetBounds(px ,px+sb ,py-sb ,py+a ,pz-sb ,pz+sb ); ok=2; } else
if ( bbGetInputType()=="x+z-" ) { clipBox->SetBounds(px ,px+sb ,py-sb ,py+sb ,pz-sb ,pz+a ); ok=2; } else
if ( bbGetInputType()=="x-z-" ) { clipBox->SetBounds(px-sb,px+a ,py-sb ,py+sb ,pz-sb ,pz+a ); ok=2; } else
-
if ( bbGetInputType()=="x+y+z+" ) { clipBox->SetBounds(px ,px+sb ,py ,py+sb ,pz ,pz+sb ); ok=2; } else
if ( bbGetInputType()=="x-y+z+" ) { clipBox->SetBounds(px-sb,px+a ,py ,py+sb ,pz ,pz+sb ); ok=2; } else
if ( bbGetInputType()=="x+y-z+" ) { clipBox->SetBounds(px ,px+sb ,py-sb ,py+a ,pz ,pz+sb ); ok=2; } else
if (ok==1) {
clipPlane -> SetOrigin(px,py,pz);
+ clipPlane -> Modified();
clipper -> SetClipFunction(clipPlane);
+ clipper -> Update();
bbSetOutputOut( clipper->GetOutput() );
- } else if (ok==2) {
-
- clipper -> SetClipFunction(clipBox);
+ } else if (ok==2) {
+ clipBox -> Modified();
+ clipper -> SetClipFunction(clipBox);
+ clipper -> Update();
bbSetOutputOut( clipper->GetOutput() );
} else {
bbSetOutputOut( bbGetInputIn() );