//===== // Before editing this file, make sure it's a file of your own (i.e.: it wasn't generated from xml description; if so : your modifications will be lost) //===== #include "bbcreaVtkMeshCutByAxis.h" #include "bbcreaVtkPackage.h" #include #include #include namespace bbcreaVtk { BBTK_ADD_BLACK_BOX_TO_PACKAGE(creaVtk,MeshCutByAxis) BBTK_BLACK_BOX_IMPLEMENTATION(MeshCutByAxis,bbtk::AtomicBlackBox); //===== // Before editing this file, make sure it's a file of your own (i.e.: it wasn't generated from xml description; if so : your modifications will be lost) //===== void MeshCutByAxis::Process() { // THE MAIN PROCESSING METHOD BODY // Here we simply set the input 'In' value to the output 'Out' // And print out the output value // INPUT/OUTPUT ACCESSORS ARE OF THE FORM : // void bbSet{Input|Output}NAME(const TYPE&) // const TYPE& bbGet{Input|Output}NAME() const // Where : // * NAME is the name of the input/output // (the one provided in the attribute 'name' of the tag 'input') // * TYPE is the C++ type of the input/output // (the one provided in the attribute 'type' of the tag 'input') // bbSetOutputOut( bbGetInputIn() ); // std::cout << "Output value = " < SetInput( bbGetInputIn() ); clipper->SetInsideOut( bbGetInputInsideVol() ); int a; // correction border if (bbGetInputInsideVol()==false) { a=1; } 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-y-" ) { clipBox->SetBounds(px-sb,px+a ,py-sb ,py+a ,pz-sb ,pz+sb ); ok=2; } else if ( bbGetInputType()=="y+z+" ) { clipBox->SetBounds(px-sb,px+sb ,py ,py+sb ,pz ,pz+sb ); ok=2; } else if ( bbGetInputType()=="y-z+" ) { clipBox->SetBounds(px-sb,px+sb ,py-sb ,py+a ,pz ,pz+sb ); ok=2; } else if ( bbGetInputType()=="y+z-" ) { clipBox->SetBounds(px-sb,px+sb ,py ,py+sb ,pz-sb ,pz+a ); ok=2; } else if ( bbGetInputType()=="y-z-" ) { clipBox->SetBounds(px-sb,px+sb ,py-sb ,py+a ,pz-sb ,pz+a ); ok=2; } else if ( bbGetInputType()=="x+z+" ) { clipBox->SetBounds(px ,px+sb ,py-sb ,py+sb ,pz ,pz+sb ); ok=2; } else if ( bbGetInputType()=="x-z+" ) { clipBox->SetBounds(px-sb,px+a ,py-sb ,py+sb ,pz ,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 ( bbGetInputType()=="x+y+z-" ) { clipBox->SetBounds(px ,px+sb ,py ,py+sb ,pz-sb ,pz+a ); ok=2; } else if ( bbGetInputType()=="x-y-z+" ) { clipBox->SetBounds(px-sb,px+a ,py-sb ,py+a ,pz ,pz+sb ); ok=2; } else if ( bbGetInputType()=="x+y-z-" ) { clipBox->SetBounds(px ,px+sb ,py-sb ,py+a ,pz-sb ,pz+a ); ok=2; } else if ( bbGetInputType()=="x-y+z-" ) { clipBox->SetBounds(px-sb,px+a ,py ,py+sb ,pz-sb ,pz+a ); ok=2; } else if ( bbGetInputType()=="x-y-z-" ) { clipBox->SetBounds(px-sb,px+a ,py-sb ,py+a ,pz-sb ,pz+a ); ok=2; } if (ok==1) { clipPlane -> SetOrigin(px,py,pz); clipper -> SetClipFunction(clipPlane); bbSetOutputOut( clipper->GetOutput() ); } else if (ok==2) { clipper -> SetClipFunction(clipBox); bbSetOutputOut( clipper->GetOutput() ); } else { bbSetOutputOut( bbGetInputIn() ); } // ok } //===== // Before editing this file, make sure it's a file of your own (i.e.: it wasn't generated from xml description; if so : your modifications will be lost) //===== void MeshCutByAxis::bbUserSetDefaultValues() { // SET HERE THE DEFAULT INPUT/OUTPUT VALUES OF YOUR BOX // Here we initialize the input 'In' to 0 bbSetInputIn(NULL); bbSetInputType("x+y+z+"); bbSetInputInsideVol(true); std::vector point; point.push_back(0); point.push_back(0); point.push_back(0); bbSetInputPoint(point); } //===== // Before editing this file, make sure it's a file of your own (i.e.: it wasn't generated from xml description; if so : your modifications will be lost) //===== void MeshCutByAxis::bbUserInitializeProcessing() { // THE INITIALIZATION METHOD BODY : // Here does nothing // but this is where you should allocate the internal/output pointers // if any } //===== // Before editing this file, make sure it's a file of your own (i.e.: it wasn't generated from xml description; if so : your modifications will be lost) //===== void MeshCutByAxis::bbUserFinalizeProcessing() { // THE FINALIZATION METHOD BODY : // Here does nothing // but this is where you should desallocate the internal/output pointers // if any } } // EO namespace bbcreaVtk