+ WidgetShowNPoints* wsp = bbGetInputWidgetShowNPoints();
+ if ( (wsp->GetLstModelShowNPointsSize()==1) &&
+ (wsp->GetModelShowNPoints()->GetLstPointsSize()==4) &&
+ (bbGetInputMesh()!=NULL ) )
+ {
+ double spc[3];
+ spc[0] = bbGetInputSpacing()[0];
+ spc[1] = bbGetInputSpacing()[1];
+ spc[2] = bbGetInputSpacing()[2];
+ vtkPoints *points = bbGetInputMesh()->GetPoints();
+ vtkStaticPointLocator *pointLocator = vtkStaticPointLocator::New();
+ pointLocator->SetDataSet( bbGetInputMesh() );
+ pointLocator->BuildLocator();
+
+ wsp->StopTrackPoint();
+ double p[3],pM[3];
+ double dx,dy,dz,s;
+ std::vector<int> lstX = wsp->GetModelShowNPoints()->GetLstPointsX();
+ std::vector<int> lstY = wsp->GetModelShowNPoints()->GetLstPointsY();
+ std::vector<int> lstZ = wsp->GetModelShowNPoints()->GetLstPointsZ();
+
+ // --- Group 0 ---
+ wsp->ErasePoint( 2 );
+ wsp->ErasePoint( 2 );
+ dx = lstX[1]-lstX[0];
+ dy = lstY[1]-lstY[0];
+ dz = lstZ[1]-lstZ[0];
+ s=0.33333;
+ p[0] = lstX[0] + dx*s;
+ p[1] = lstY[0] + dy*s;
+ p[2] = lstZ[0] + dz*s;
+ NearestPointToMesh(points, pointLocator, spc, p,pM);
+ wsp->InsertPoint(pM[0] ,pM[1], pM[2],"");
+ s=s*2;
+ p[0] = lstX[0] + dx*s;
+ p[1] = lstY[0] + dy*s;
+ p[2] = lstZ[0] + dz*s;
+ NearestPointToMesh(points, pointLocator, spc, p,pM);
+ wsp->InsertPoint(pM[0],pM[1], pM[2],"");
+
+ // --- Group 1 ---
+ wsp->OnInsertCollectionAfter_();
+ p[0] = (lstX[0]+lstX[3])/2;
+ p[1] = (lstY[0]+lstY[3])/2;
+ p[2] = (lstZ[0]+lstZ[3])/2;
+ NearestPointToMesh(points, pointLocator, spc, p,pM);
+ wsp->InsertPoint(pM[0] ,pM[1], pM[2],"");
+ p[0] = (lstX[1]+lstX[2])/2;
+ p[1] = (lstY[1]+lstY[2])/2;
+ p[2] = (lstZ[1]+lstZ[2])/2;
+ NearestPointToMesh(points, pointLocator, spc, p,pM);
+ wsp->InsertPoint(pM[0] ,pM[1], pM[2],"");
+ p[0] = (lstX[0]+lstX[1]+lstX[2]+lstX[3])/4; p[1] = (lstY[0]+lstY[1]+lstY[2]+lstY[3])/4; p[2] = (lstZ[0]+lstZ[1]+lstZ[2]+lstZ[3])/4;
+ wsp->InsertPoint(p[0] ,p[1], p[2],"");
+
+ // --- Group 2 ---
+ wsp->OnInsertCollectionAfter_();
+ p[0] = lstX[3];
+ p[1] = lstY[3];
+ p[2] = lstZ[3];
+ wsp->InsertPoint(p[0] ,p[1], p[2],"");
+ p[0] = lstX[2];
+ p[1] = lstY[2];
+ p[2] = lstZ[2];
+ wsp->InsertPoint(p[0] ,p[1], p[2],"");
+ dx = lstX[2]-lstX[3];
+ dy = lstY[2]-lstY[3];
+ dz = lstZ[2]-lstZ[3];
+ s=0.33333;
+ p[0] = lstX[3] + dx*s;
+ p[1] = lstY[3] + dy*s;
+ p[2] = lstZ[3] + dz*s;
+ NearestPointToMesh(points, pointLocator, spc, p,pM);
+ wsp->InsertPoint(pM[0] ,pM[1], pM[2],"");
+ s=s*2;
+ p[0] = lstX[3] + dx*s;
+ p[1] = lstY[3] + dy*s;
+ p[2] = lstZ[3] + dz*s;
+ NearestPointToMesh(points, pointLocator, spc, p,pM);
+ wsp->InsertPoint(pM[0] ,pM[1], pM[2],"");
+
+ wsp->SetOutputBox();
+ pointLocator->Delete();
+ } else {
+ printf("EED ShowNPoints_Tools::CreatePatch01 Warning patch not apply. Need juste one group with four points\n");
+ } // if