#include "bbcreaMaracasVisuShowNPoints_Tools.h"
#include "bbcreaMaracasVisuPackage.h"
+#include <vtkPointData.h>
+#include <vtkDataArray.h>
+#include <vtkMath.h>
+
namespace bbcreaMaracasVisu
{
// Check normals
- 1. Recorrer las normales de lstIdNormals y calcular el promedio -> V1
- 2. Calcular el promedio de 4 normales de la nueva superficie -> V2
- 3. Calcular el angulo entre V1 y V2
- 4. Si el angulo es major de 90 Invertir las normales de la superficie actual
+// 1. Recorrer las normales de lstIdNormals y calcular el promedio -> V1
+ double *nValue;
+ double n1[3];
+ vtkPointData *pointdata = bbGetInputMesh()->GetPointData();
+ vtkDataArray *dataarray = pointdata->GetNormals();
+ int i,size = lstIdNormal.size();
+ n1[0]=0;
+ n1[1]=0;
+ n1[2]=0;
+ for (i=0; i<size; i++)
+ {
+ nValue = dataarray->GetTuple3( i );
+ n1[0] = n1[0]+nValue[0];
+ n1[1] = n1[1]+nValue[1];
+ n1[2] = n1[2]+nValue[2];
+ } // for i
+ n1[0] = n1[0]/size;
+ n1[1] = n1[1]/size;
+ n1[2] = n1[2]/size;
+
+
+// 2. Calcular el promedio de 4 normales de la nueva superficie -> V2
+// 3. Calcular el angulo entre V1 y V2
+// 4. Si el angulo es major de 90 Invertir las normales de la superficie actual
// --- Finish ---
// EED 2022-05-19
// mmodelShowNPoints = new ModelShowNPoints();
idUndoRedo = 0;
- maxUndoRedo = 0;
- UndoRedoDir = "/tmp";
-
+ maxUndoRedo = 0;
+#if defined(_WIN32)
+ char * val = getenv( "TEMP" );
+ if (val == NULL)
+ {
+ UndoRedoDir = std::string("");
+ } else {
+ UndoRedoDir = std::string(val)+"\\creatools";
+ printf("WidgetShowNPoints::WidgetShowNPoints UndoRedoDir = %s %p \n", UndoRedoDir.c_str() , this );
+ std::string cmd1 = "mkdir "+ UndoRedoDir;
+ system( cmd1.c_str() );
+ // Erasing files of more than 1 day old ( -1 )
+ std::string cmd2 = "ForFiles /p \"" + UndoRedoDir + "\" /s /d -1 /c \"cmd /c del @file \"";
+ system( cmd2.c_str() );
+ }
+#elif defined(__GNUC__)
+
+
+ #if defined(MACOSX)
+ UndoRedoDir = "/tmp";
+ #else // Linux
+ UndoRedoDir = "/tmp";
+ #endif
+
+ printf("WidgetShowNPoints::WidgetShowNPoints UndoRedoDir = %s %p \n", UndoRedoDir.c_str() , this );
+ // Erasing files of more than 1 day old ( +1 )
+ str::string cmd= "find "+UndoRedoDir+" -name \"UndoRedo_collection_*.undoredo\" -type f -mtime +1 -delete";
+ system( cmd.c_str() );
+
+#else
+ UndoRedoDir = "./";
+#endif
+
+
mActualCollection = 0;
ModelShowNPoints* modelShowNPoints = new ModelShowNPoints();
lstModelShowNPoints.push_back( modelShowNPoints );