WidgetShowNPoints* wsp = bbGetInputWidgetShowNPoints();
wsp->StopAutoAddPoints();
wsp->StopTrackPoint();
- if((wsp->GetLstModelShowNPointsSize()==1) && (bbGetInputMesh()!=NULL )){
+ if((wsp->GetLstModelShowNPointsSize()==1) && (bbGetInputMesh()!=NULL ))
+ {
if(wsp->GetModelShowNPoints()->GetLstPointsSize()==4){
CreatePatch_4points();
}
}
else{
printf("PG ShowNPoints_Tools::CreatePatch_Npoints Warning patch not apply. groups or mesh invalid. Need 1 group of 3 or 4 points, and a mesh\n");
- }
+ } // if wsp && mesh
}
+void ShowNPoints_Tools::InitCreateVolumeSurface_Points()
+{
+ InitCreatePatch_Points(); // 1 group -> 3 groups
+
+ // 3 groups to 4 groups
+ WidgetShowNPoints* wsp = bbGetInputWidgetShowNPoints();
+ wsp->StopAutoAddPoints();
+ wsp->StopTrackPoint();
+ if( wsp->GetLstModelShowNPointsSize()==3 )
+ {
+ double spc[3];
+ double pC1[3]; // fist point
+ double dx,dy,dz;
+ double pC2A[3]; // first middle point
+ double pC2B[3]; // second midle point
+ double pC3[3]; // last point
+ double pN[3]; // new over the surface
+
+ vtkPoints *points = bbGetInputMesh()->GetPoints();
+ vtkStaticPointLocator *pointLocator = vtkStaticPointLocator::New();
+ pointLocator->SetDataSet( bbGetInputMesh() );
+ pointLocator->BuildLocator();
+ spc[0] = bbGetInputSpacing()[0];
+ spc[1] = bbGetInputSpacing()[1];
+ spc[2] = bbGetInputSpacing()[2];
+ wsp->InsertCollectionAfter_();
+ wsp->GetCollectionPoint(1,0, pC1);
+ wsp->GetCollectionPoint(1,2, pC3);
+ dx=pC3[0]-pC1[0];
+ dy=pC3[1]-pC1[1];
+ dz=pC3[2]-pC1[2];
+ pC2A[0]=pC1[0]+dx*0.33333; pC2A[1]=pC1[1]+dy*0.3333; pC2A[2]=pC1[2]+dz*0.33333;
+ pC2B[0]=pC1[0]+dx*0.66666; pC2B[1]=pC1[1]+dy*0.6666; pC2B[2]=pC1[2]+dz*0.66666;
+
+ wsp->InsertPoint(pC1[0] ,pC1[1], pC1[2],"");
+
+ NearestPointToMesh(points, pointLocator, spc, pC2A,pN);
+ wsp->InsertPoint(pN[0] ,pN[1], pN[2],"");
+
+ NearestPointToMesh(points, pointLocator, spc, pC2B,pN);
+ wsp->InsertPoint(pN[0] ,pN[1], pN[2],"");
+
+ wsp->InsertPoint(pC3[0] ,pC3[1], pC3[2],"");
+
+ // --- Finish ---
+ wsp->SetOutputBox();
+ wsp->UndoRedo_SaveCollection();
+
+ } // if wsp && mesh
+}
+
+
void ShowNPoints_Tools::CreatePatch_Points(std::vector<double> lstX, std::vector<double> lstY, std::vector<double> lstZ)
{
WidgetShowNPoints* wsp = bbGetInputWidgetShowNPoints();
}
NearestPointToMesh(points, pointLocator, spc, p,pM);
wsp->InsertPoint(pM[0] ,pM[1], pM[2],"");
-
if(sect == 0 || sect == 4) lstIdNormalSurface.push_back( pointLocator->FindClosestPoint(pM) );
}
wsp->InsertPoint(p[0] ,p[1], p[2],"");
std::copy(std::begin(p), std::end(p), std::begin(centroid));
// --- Group 2 ---
-
wsp->InsertCollectionAfter_();
-
dx = lstX[2]-lstX[3];
dy = lstY[2]-lstY[3];
dz = lstZ[2]-lstZ[3];
}
NearestPointToMesh(points, pointLocator, spc, p,pM);
wsp->InsertPoint(pM[0] ,pM[1], pM[2],"");
-
if(sect == 0 || sect == 4) lstIdNormalSurface.push_back( pointLocator->FindClosestPoint(pM) );
}
-
pointLocator->Delete();
-
// Check normals
// 1. Recorrer las normales de lstIdNormals y calcular el promedio -> V1
double *nValue;
{
bbGetInputWidgetShowNPoints()->OnResetCollections_();
} // if Type
- if (bbGetInputType()==200)
+ if (bbGetInputType()==200) // Create patch surface
{
InitCreatePatch_Points();
} // if Type
+ if (bbGetInputType()==205) // Create volume surface from points
+ {
+ InitCreateVolumeSurface_Points();
+ } // if Type
if (bbGetInputType()==210)
{
bbGetInputWidgetShowNPoints()->OnInvertLstPoints_();