X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=blobdiff_plain;f=bbtk_creaVtk_PKG%2Fsrc%2FbbcreaVtkPlaneSource.cxx;h=91f5a49d2d890a7937fac69906accbf316c72f21;hb=c4879112fd85619dc824d3ae163d65fd0b59ecf9;hp=2f8b50dff43c9ac9a48605a76d7a537029883084;hpb=3582c0f9b8380fde739856aa6a188da3262cf03b;p=creaVtk.git diff --git a/bbtk_creaVtk_PKG/src/bbcreaVtkPlaneSource.cxx b/bbtk_creaVtk_PKG/src/bbcreaVtkPlaneSource.cxx index 2f8b50d..91f5a49 100644 --- a/bbtk_creaVtk_PKG/src/bbcreaVtkPlaneSource.cxx +++ b/bbtk_creaVtk_PKG/src/bbcreaVtkPlaneSource.cxx @@ -16,33 +16,71 @@ BBTK_BLACK_BOX_IMPLEMENTATION(PlaneSource,bbtk::AtomicBlackBox); //===== void PlaneSource::Process() { - vtkPlaneSource *plane; - plane = vtkPlaneSource::New(); - double p0[3]; - p0[0]=0; - p0[1]=0; - p0[2]=0; + double c[3]; + double p0[3]; double p1[3]; - p1[0]=0; - p1[1]=1; - p1[2]=0; - double p2[3]; - p2[0]=0; - p2[1]=0; - p2[2]=1; - double c[3]; - c[0]=bbGetInputCenter()[0]; - c[1]=bbGetInputCenter()[1]; - c[2]=bbGetInputCenter()[2]; + double p2[3]; + vtkPlaneSource *plane; + plane = vtkPlaneSource::New(); + c[0] = bbGetInputCenter()[0]; + c[1] = bbGetInputCenter()[1]; + c[2] = bbGetInputCenter()[2]; + p0[0] = 0; + p0[1] = 0; + p0[2] = 0; + + + bool byNormal=true; + double size=350; + + // xy + if ((bbGetInputNormal()[0]==0) && (bbGetInputNormal()[1]==0) && (bbGetInputNormal()[2]==1) ) + { + byNormal= false; + p1[0] = size; + p1[1] = 0; + p1[2] = 0; + p2[0] = 0; + p2[1] = size; + p2[2] = 0; + } + + // xz + if ((bbGetInputNormal()[0]==0) && (bbGetInputNormal()[1]==1) && (bbGetInputNormal()[2]==0) ) + { + byNormal= false; + p1[0] = size; + p1[1] = 0; + p1[2] = 0; + p2[0] = 0; + p2[1] = 0; + p2[2] = size; + } + + // yz + if ((bbGetInputNormal()[0]==1) && (bbGetInputNormal()[1]==0) && (bbGetInputNormal()[2]==0) ) + { + byNormal= false; + p1[0] = 0; + p1[1] = size; + p1[2] = 0; + p2[0] = 0; + p2[1] = 0; + p2[2] = size; + } plane->SetResolution( bbGetInputXResolution(), bbGetInputYResolution() ); - plane->SetOrigin( p0 ); - plane->SetPoint1( p1 ); - plane->SetPoint2( p2 ); - plane->Update( ); - plane->SetNormal( bbGetInputNormal()[0], bbGetInputNormal()[1], bbGetInputNormal()[2] ); - plane->Update( ); - plane->SetCenter( c ); + if (byNormal==false) + { + plane->SetOrigin( p0 ); + plane->SetPoint1( p1 ); + plane->SetPoint2( p2 ); + } else { + plane->SetNormal( bbGetInputNormal()[0], bbGetInputNormal()[1], bbGetInputNormal()[2] ); + printf("EED PlaneSource. Missing mechanism to define the size of the plane\n"); + } + plane->SetCenter( c ); + plane->Update( ); bbSetOutputPlane( (vtkDataSet*)plane ); bbSetOutputPolyData( plane->GetOutput() );