]> Creatis software - creaMaracasVisu.git/commitdiff
#3517 ShowNPoints actual Point
authorEduardo DAVILA <davila@creatis.insa-lyon.fr>
Wed, 12 Jul 2023 11:52:51 +0000 (13:52 +0200)
committerEduardo DAVILA <davila@creatis.insa-lyon.fr>
Wed, 12 Jul 2023 11:52:51 +0000 (13:52 +0200)
bbtk/bbs/boxes/Mesh_tool_ApplyPatchSimple.bbg
bbtk/bbs/boxes/Mesh_tool_ApplyPatchSimple.bbs
bbtk/src/bbcreaMaracasVisuShowNPoints_Tools.cxx

index f6d42bfecec93a30d95cb925134d3044424bd770..1806865cd447bef3ebf6770f13a3951d60fa0d80 100644 (file)
@@ -72,7 +72,7 @@ COMPLEX_PORT
 meshmanagermodel
 -150.374274:130.740991:-900.000000
 FIN_COMPLEX_PORT
-BOXES:87
+BOXES:86
 BOX
 creaMaracasVisu:ShowNPoints:showNpoints
 ISEXEC:FALSE
@@ -272,8 +272,8 @@ FIN_BOX
 BOX
 creaMaracasVisu:PolyDataToActor_Widget:Box37
 ISEXEC:FALSE
--78.990878:-90.579841:-900.000000
--55.970878:-93.079841:-900.000000
+-78.826120:-92.227420:-900.000000
+-55.806120:-94.727420:-900.000000
 PORT
 color:"0 1 1"
 PORT
@@ -462,14 +462,14 @@ FIN_BOX
 BOX
 creaVtk:MeshManager:Box92
 ISEXEC:FALSE
--28.843589:-73.485234:-900.000000
--6.813589:-75.985234:-900.000000
+-28.349315:-72.331929:-900.000000
+-6.319315:-74.831929:-900.000000
 FIN_BOX
 BOX
 creaVtk:MeshManager_tool:Box93
 ISEXEC:FALSE
-37.734522:-140.066535:-900.000000
-60.234522:-142.566535:-900.000000
+49.926605:-150.446282:-900.000000
+72.426605:-152.946282:-900.000000
 PORT
 Tool:"35"
 FIN_BOX
@@ -524,11 +524,13 @@ FIN_BOX
 BOX
 creaMaracasVisu:ShowNPoints_Tools:Box120
 ISEXEC:FALSE
--380.000207:-26.721711:-900.000000
--357.455207:-29.221711:-900.000000
+-382.950306:-29.444879:-900.000000
+-360.405306:-31.944879:-900.000000
 PORT
 BoxProcessMode:"Manual"
 PORT
+Params:"1"
+PORT
 Type:"220"
 FIN_BOX
 BOX
@@ -555,21 +557,23 @@ ISEXEC:FALSE
 PORT
 BoxProcessMode:"Manual"
 PORT
+Params:"-1"
+PORT
 Type:"220"
 FIN_BOX
 BOX
 std:ConcatStrings:Box130
 ISEXEC:FALSE
--377.646633:23.880476:-900.000000
--354.886633:21.380476:-900.000000
+-389.900889:26.376713:-900.000000
+-367.140889:23.876713:-900.000000
 PORT
 In2:"  1"
 FIN_BOX
 BOX
 std:ConcatStrings:Box131
 ISEXEC:FALSE
--336.496984:24.204237:-900.000000
--313.736984:21.704237:-900.000000
+-359.416982:25.792752:-900.000000
+-336.656982:23.292752:-900.000000
 PORT
 In2:"  -1"
 FIN_BOX
@@ -592,8 +596,8 @@ FIN_BOX
 BOX
 std:GetVectorDoubleSubVector:Box132
 ISEXEC:FALSE
--346.082243:44.049611:-900.000000
--322.622243:41.549611:-900.000000
+-377.171745:33.383870:-900.000000
+-353.711745:30.883870:-900.000000
 PORT
 ErrorValue:"0"
 PORT
@@ -630,24 +634,6 @@ ISEXEC:FALSE
 63.214011:-94.383830:-900.000000
 FIN_BOX
 BOX
-vtk:MarchingCubes:Box141
-ISEXEC:FALSE
-85.086669:-114.162421:-900.000000
-107.371669:-116.662421:-900.000000
-FIN_BOX
-BOX
-vtk:ImageGaussianSmooth:Box142
-ISEXEC:FALSE
-78.317640:-101.123010:-900.000000
-101.322640:-103.623010:-900.000000
-PORT
-StdDevX:"1"
-PORT
-StdDevY:"1"
-PORT
-StdDevZ:"1"
-FIN_BOX
-BOX
 creaVtk:MeshReduction_DecimatePro:Box143
 ISEXEC:FALSE
 40.721236:-119.806931:-900.000000
@@ -718,8 +704,8 @@ FIN_BOX
 BOX
 std:MultipleInputs:Box154
 ISEXEC:FALSE
-44.500333:-130.635183:-900.000000
-66.580333:-133.135183:-900.000000
+65.754100:-130.140909:-900.000000
+87.834100:-132.640909:-900.000000
 FIN_BOX
 BOX
 wx:LayoutLine:Box136
@@ -777,7 +763,15 @@ ISEXEC:FALSE
 -62.727956:-100.753344:-900.000000
 -40.947956:-103.253344:-900.000000
 FIN_BOX
-CONNECTIONS:175
+BOX
+std:MagicBox:Box157
+ISEXEC:FALSE
+38.119377:-128.210032:-900.000000
+59.829377:-130.710032:-900.000000
+PORT
+BoxProcessMode:"Manual"
+FIN_BOX
+CONNECTIONS:173
 CONNECTION
 Box06:LstContourPointsX:Box04:LstX
 NumberOfControlPoints:0
@@ -1112,12 +1106,6 @@ CONNECTION
 showNpoints:WidgetShowNPoints:Box128:WidgetShowNPoints
 NumberOfControlPoints:0
 CONNECTION
-Box130:Out:Box120:Params
-NumberOfControlPoints:0
-CONNECTION
-Box131:Out:Box128:Params
-NumberOfControlPoints:0
-CONNECTION
 Box120:BoxChange:Box31:In3
 NumberOfControlPoints:0
 CONNECTION
@@ -1190,9 +1178,6 @@ CONNECTION
 Box140:Out:Box139:InImage
 NumberOfControlPoints:0
 CONNECTION
-Box139:Out:Box142:In
-NumberOfControlPoints:0
-CONNECTION
 Box129:Widget:Box146:Widget2
 NumberOfControlPoints:0
 CONNECTION
@@ -1208,12 +1193,6 @@ CONNECTION
 Box148:Widget:Box79:Widget4
 NumberOfControlPoints:0
 CONNECTION
-Box143:Out:Box45:Mesh
-NumberOfControlPoints:0
-CONNECTION
-Box143:Out:Box93:Mesh
-NumberOfControlPoints:0
-CONNECTION
 Box53:BoxChange:Box143:BoxExecute
 NumberOfControlPoints:0
 CONNECTION
@@ -1223,9 +1202,6 @@ CONNECTION
 Box139:Out:Box151:In
 NumberOfControlPoints:0
 CONNECTION
-Box151:Out:Box141:In
-NumberOfControlPoints:0
-CONNECTION
 Box151:Out:Box152:In
 NumberOfControlPoints:0
 CONNECTION
@@ -1303,4 +1279,16 @@ NumberOfControlPoints:0
 CONNECTION
 Box156:Widget:Box138:Widget9
 NumberOfControlPoints:0
+CONNECTION
+Box157:Out:Box45:Mesh
+NumberOfControlPoints:0
+CONNECTION
+Box157:Out:Box93:Mesh
+NumberOfControlPoints:0
+CONNECTION
+Box135:Out:Box157:In
+NumberOfControlPoints:0
+CONNECTION
+Box135:BoxChange:Box157:BoxExecute
+NumberOfControlPoints:0
 APP_END
index 359643c727210ab42243887b72db0092478e0986..1082d9177f4e5df851701d1a5015dc96a8bc91fc 100644 (file)
@@ -189,6 +189,7 @@ new std:AddStringToVector Box119
 
 new creaMaracasVisu:ShowNPoints_Tools Box120
   set Box120.BoxProcessMode "Manual"
+  set Box120.Params "1"
   set Box120.Type "220"
 
 new wx:CommandButton Box121
@@ -199,6 +200,7 @@ new wx:CommandButton Box127
 
 new creaMaracasVisu:ShowNPoints_Tools Box128
   set Box128.BoxProcessMode "Manual"
+  set Box128.Params "-1"
   set Box128.Type "220"
 
 new std:ConcatStrings Box130
@@ -228,13 +230,6 @@ new creaVtk:PolyDataToImageData Box139
 
 new vtk:CreateImage Box140
 
-new vtk:MarchingCubes Box141
-
-new vtk:ImageGaussianSmooth Box142
-  set Box142.StdDevX "1"
-  set Box142.StdDevY "1"
-  set Box142.StdDevZ "1"
-
 new creaVtk:MeshReduction_DecimatePro Box143
   set Box143.BoxProcessMode "Manual"
   set Box143.TargetReduction "0.8"
@@ -283,6 +278,9 @@ new wx:OutputText Box155
 
 new wx:OutputText Box156
 
+new std:MagicBox Box157
+  set Box157.BoxProcessMode "Manual"
+
 
 connect Box06.LstContourPointsX Box04.LstX
 connect showNpoints.lstIndexs Box06.LstIndexsIn
@@ -380,8 +378,6 @@ connect Box121.BoxChange Box120.BoxExecute
 connect Box127.BoxChange Box128.BoxExecute
 connect Box68.Spacing Box128.Spacing
 connect showNpoints.WidgetShowNPoints Box128.WidgetShowNPoints
-connect Box130.Out Box120.Params
-connect Box131.Out Box128.Params
 connect Box120.BoxChange Box31.In3
 connect Box128.BoxChange Box31.In5
 connect showNpoints.BoxChange Box126.In4
@@ -406,18 +402,14 @@ connect Box68.Spacing Box140.Spacing
 connect Box68.Size Box140.Dimensions
 connect Box68.TypeName Box140.OutputFormat
 connect Box140.Out Box139.InImage
-connect Box139.Out Box142.In
 connect Box129.Widget Box146.Widget2
 connect Box146.Widget Box38.Widget4
 connect Box42.BoxChange Box51.BoxExecute
 connect Box134.Widget Box148.Widget3
 connect Box148.Widget Box79.Widget4
-connect Box143.Out Box45.Mesh
-connect Box143.Out Box93.Mesh
 connect Box53.BoxChange Box143.BoxExecute
 connect Box53.BoxChange Box150.BoxExecute
 connect Box139.Out Box151.In
-connect Box151.Out Box141.In
 connect Box151.Out Box152.In
 connect Box152.Out Box143.In
 connect Box42.BoxChange Box53.In3
@@ -444,6 +436,10 @@ connect Box149.Widget Box145.Widget9
 connect Box153.Widget Box136.Widget9
 connect Box155.Widget Box147.Widget9
 connect Box156.Widget Box138.Widget9
+connect Box157.Out Box45.Mesh
+connect Box157.Out Box93.Mesh
+connect Box135.Out Box157.In
+connect Box135.BoxChange Box157.BoxExecute
 
 # Complex input ports
 input point showNpoints.In " "
index 52d804e42a5e66cbf73a77771af6a3d772ff54b6..c7cf336197607b153ff64c7f49720f104b25657d 100644 (file)
@@ -272,7 +272,7 @@ void ShowNPoints_Tools::CreatePatch_Points(std::vector<double> lstX, std::vector
     }
        
     // --- Group 1 ---
-    double centroid[3];
+//EED    double centroid[3];
     
     wsp->InsertCollectionAfter_();
       p[0] = (lstX[0]+lstX[3])/2;
@@ -287,7 +287,7 @@ void ShowNPoints_Tools::CreatePatch_Points(std::vector<double> lstX, std::vector
       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],"");
-         std::copy(std::begin(p), std::end(p), std::begin(centroid));
+//EED    std::copy(std::begin(p), std::end(p), std::begin(centroid));
     // --- Group 2 ---
     wsp->InsertCollectionAfter_();
     dx = lstX[2]-lstX[3];
@@ -395,17 +395,19 @@ void ShowNPoints_Tools::CreatePatch_Points(std::vector<double> lstX, std::vector
        vtkMath::MultiplyScalar(n2, -1);
         wsp->InvertLstPoints_();
     } // if angle
-    std::vector<double> normalOut(n2, n2 + 3);
-    double norm = vtkMath::Norm(n2);
-    normalOut[0] = normalOut[0]/norm;
-       normalOut[1] = normalOut[1]/norm;
-       normalOut[2] = normalOut[2]/norm;
+    
+//EED 2023 07 12
+    //EED    std::vector<double> normalOut(n2, n2 + 3);
+    //EED    double norm = vtkMath::Norm(n2);
+    //EED    normalOut[0] = normalOut[0]/norm;
+    //EED      normalOut[1] = normalOut[1]/norm;
+    //EED      normalOut[2] = normalOut[2]/norm;
        
-       std::vector<double> outputData;
-       outputData.insert(outputData.end(), &centroid[0], &centroid[3]);
-       outputData.insert(outputData.end(), &normalOut[0], &normalOut[3]);
+    //EED      std::vector<double> outputData;
+    //EED      outputData.insert(outputData.end(), &centroid[0], &centroid[3]);
+    //EED      outputData.insert(outputData.end(), &normalOut[0], &normalOut[3]);
        
-       bbSetOutputOut(outputData);
+//EED  bbSetOutputOut(outputData);
     //bbSetOutputOut(normalOut);
     
     // --- Finish ---
@@ -414,7 +416,9 @@ void ShowNPoints_Tools::CreatePatch_Points(std::vector<double> lstX, std::vector
 }
 
 void ShowNPoints_Tools::MovePatchCenter()
-{      
+{
+    
+/* EED 2023 07 12
        std::vector<double> params = bbGetInputParams();
        if(params.size() == 4)
        {
@@ -426,27 +430,33 @@ void ShowNPoints_Tools::MovePatchCenter()
                
                double centerPoint[3];
                std::vector<double> normal, modPoint;
-               
                normal.push_back(params[0]);
                normal.push_back(params[1]);
                normal.push_back(params[2]);
-
                int direction = -1 * params[3];
-               
                WidgetShowNPoints* wsp = bbGetInputWidgetShowNPoints();
                wsp->GetCollectionPoint(1,1, centerPoint);
                modPoint.push_back(centerPoint[0] + direction * normal[0]);
                modPoint.push_back(centerPoint[1] + direction * normal[1]);
                modPoint.push_back(centerPoint[2] + direction * normal[2]);
-
                wsp->SetCollectionPoint(1, 1, modPoint);
-        
+    
+    
         // --- Finish ---
         wsp->SetOutputBox();
         wsp->UndoRedo_SaveCollection();
        }else{
                printf("PG ShowNPoints_Tools::MovePatchCenter()  Warning params are wrong. Need 4: normal x y z and direction of movement (1 or -1)\n");
        }
+ */
+
+    double              step                = bbGetInputParams()[0];
+    WidgetShowNPoints   *wsp                = bbGetInputWidgetShowNPoints();
+    wsp->SetActualCollection( wsp->GetLstModelShowNPointsSize()/2 );
+    ModelShowNPoints    *modelSNP           = wsp->GetModelShowNPoints( );
+    modelSNP->SetIdCurrentPoint( modelSNP->GetLstPointsSize()/2 );
+    wsp->MovePoint_( step );
 }
 
 /**