if ( sizeLstIndexslstIndexs!=0 )
{
iGeneral = 0;
- iGeneralPlusSize = (*lstOutIndexs)[0];
+ SizeContour = (*lstOutIndexs)[0];
+ iGeneralPlusSize = iGeneral + SizeContour;
for ( iContour=1 ; iContour<=contour ; iContour++ )
{
iGeneral = iGeneral + (*lstOutIndexs)[iContour-1];
iSize++;
} //for
} else {
- printf("EED Warnning!! ManualContourModel_Box::PutPointsInContour the lstTmp vector is not of the correct size. \n");
+ printf("EED Warnning!! ManualContourModel_Box::PutPointsInContour the lstTmp vector is not of the correct size. SizeContour=%d lstTmp.size=%d\n"
+ ,SizeContour, (*lstTmpX).size() );
for ( i=iGeneral ; i<iGeneralPlusSize ; i++ )
{
(*lstOutX)[i] = -9999 ;
std::vector<double> *lstC2Y,
std::vector<double> *lstC2Z )
{
-printf("EED ManualContourModel_Box::Redistribution_SIN Start \n");
std::vector<double> lstRstX;
std::vector<double> lstRstY;
std::vector<double> lstRstZ;
- int ii,iGeneral;
- double iiByDelta;
- int size,iGeneralPlusSize;
- double Alpha,Beta,t,tt, PI=3.14159265;
- double TwoPI=2*PI;
- double dist=sizeOfContour;
- double dist2,distSeg,delta;
- double dd,dx,dy,dz;
- int i,k;
- int firstK;
- double tmpX,tmpY,tmpZ;
- iGeneral=0;
+ int ii,iGeneral;
+ int size,iGeneralPlusSize;
+ int i,k;
+ int firstK;
+ double iiByDelta;
+ double dist2,distSeg;
+// double delta;
+ double dd,dx,dy,dz;
+ double t,tt, PI;
+ double TwoPI;
+ double dist;
+ dist = sizeOfContour;
+ PI = 3.14159265;
+ TwoPI = 2*PI;
+ iGeneral = 0;
// for (iLstIndexOut=0; iLstIndexOut<sizeLstIndexOut; iLstIndexOut++) // For each contour
// {
// lstRstX.clear();
// lstRstY.clear();
// lstRstZ.clear();
// size = (*lstIndexsOut)[iLstIndexOut];
- size = (*lstInX).size();
+ size = (*lstC1X).size();
iGeneralPlusSize = iGeneral+size;
if (size>2)
{
// dz = (*lstOutZ)[i]-(*lstOutZ)[i+1];
// dist= dist+sqrt( dx*dx + dy*dy + dz*dz );
// } //for
- delta = dist/(size-1);
+
+// delta = dist/(size-1);
firstK = 0;
for (i=iGeneral; i<iGeneralPlusSize;i++) // For each point of one contour
{
ii = i-iGeneral;
dist2 = 0;
- for (k=iGeneral; k<iGeneralPlusSize-1;k++) // Search inside
+ for (k=iGeneral; k<iGeneralPlusSize;k++) // Search inside
{
//if ( 385==(*lstOutY)[k] )
//{
lstRstZ.push_back( (*lstC1Z)[k] + dd*dz );
}
}// if dist2
- dist2 = dist2+distSeg;
+ dist2 = dist2 + distSeg;
} // for k
- } //for i
-
-
+ } //for i
if (lstRstX.size()!=size)
{
- printf("EED Warnning! ManualContourModel_Box::Redistribution_SIN >> This list is not coherent iLstIndexOut=%d lstRstX.size()=%d size=%d\n",iLstIndexOut, lstRstX.size(), size);
- tmpX = lstRstX[iGeneral];
- tmpY = lstRstY[iGeneral];
- tmpZ = lstRstZ[iGeneral];
- lstRstX.push_back( tmpX );
- lstRstY.push_back( tmpY );
- lstRstZ.push_back( tmpZ );
+ printf("EED Warnning! ManualContourModel_Box::Redistribution_SIN >> This list is not coherent lstRstX.size()=%d size=%d\n", lstRstX.size(), size);
}
+ (*lstC2X).clear();
+ (*lstC2Y).clear();
+ (*lstC2Z).clear();
for (i=iGeneral; i<iGeneralPlusSize;i++)
{
- lstC2X.push_back(-1);
- lstC2Y.push_back(-1);
- lstC2Z.push_back(-1);
+ (*lstC2X).push_back(-1);
+ (*lstC2Y).push_back(-1);
+ (*lstC2Z).push_back(-1);
} // for i
int iii;
for (i=iGeneral; i<iGeneralPlusSize;i++)
(*lstC2Y)[iii] = lstRstY[ii];
(*lstC2Z)[iii] = lstRstZ[ii];
} // for i
- } // if size>2
+ } else {
+ for (i=0; i<size ; i++)
+ {
+ (*lstC2X)[i] = (*lstC1X)[i];
+ (*lstC2Y)[i] = (*lstC1Y)[i];
+ (*lstC2Z)[i] = (*lstC1Z)[i];
+ } // for i
+ }// if size>2
// iGeneral=iGeneral+size;
// }// for iLstIndexOut
-printf("EED ManualContourModel_Box::Redistribution_SIN End \n");
}
-
void ManualContourModel_Box::CopyContour2InContour1(
std::vector<double> *lstInX,
std::vector<double> *lstInY,
std::vector<double> *lstOutZ,
std::vector<int> *lstIndexsOut )
{
+printf("ManualContourModel_Box::RedistributionPointsAllContours_SIN start\n");
std::vector<double> lstTmp1X;
std::vector<double> lstTmp1Y;
std::vector<double> lstTmp1Z;
std::vector<double> lstTmp2X;
std::vector<double> lstTmp2Y;
std::vector<double> lstTmp2Z;
- std::vector<double> lstTmp1aX;
- std::vector<double> lstTmp1aY;
- std::vector<double> lstTmp1aZ;
+ std::vector<double> lstTmp2aX;
+ std::vector<double> lstTmp2aY;
+ std::vector<double> lstTmp2aZ;
+ std::vector<double> lstTmp2bX;
+ std::vector<double> lstTmp2bY;
+ std::vector<double> lstTmp2bZ;
+ std::vector<double> lstTmp2cX;
+ std::vector<double> lstTmp2cY;
+ std::vector<double> lstTmp2cZ;
+ std::vector<double> lstTmp3X;
+ std::vector<double> lstTmp3Y;
+ std::vector<double> lstTmp3Z;
+ std::vector<int> lstContourExeption;
int iContour;
- double nbContours = (*lstIndexsOut).size()-1;
+ double nbContours = (*lstIndexsOut).size();
double alpha,iAlpha;
double beta,iBeta;
double sizeContour1;
double sizeContour2;
+ double sizeContour3;
double distAcum;
double minDistAcum;
+
+ // ------------ Wave 1 -----------------
+
ExtractContour(lstOutX,lstOutY,lstOutZ,lstIndexsOut,0,&lstTmp1X,&lstTmp1Y,&lstTmp1Z);
sizeContour1 = SizeContour( &lstTmp1X, &lstTmp1Y, &lstTmp1Z );
// Increment
- for ( iContour=0; iContour<nbContours ; iContour++ )
+ for ( iContour=0; iContour<nbContours-1 ; iContour++ )
{
- beta = 0.10;
+printf("ManualContourModel_Box::RedistributionPointsAllContours_SIN iContour=%d\n",iContour);
+ beta = 0;
+ alpha = 0;
// find Alpha
ExtractContour( lstOutX,lstOutY,lstOutZ,lstIndexsOut, iContour+1 ,&lstTmp2X,&lstTmp2Y,&lstTmp2Z );
sizeContour2 = SizeContour( &lstTmp2X, &lstTmp2Y, &lstTmp2Z );
- if (sizeContour1<sizeContour2){
+
+ if (iContour+2<nbContours)
+ {
+ ExtractContour( lstOutX,lstOutY,lstOutZ,lstIndexsOut, iContour+2 ,&lstTmp3X,&lstTmp3Y,&lstTmp3Z );
+ sizeContour3 = SizeContour( &lstTmp3X, &lstTmp3Y, &lstTmp3Z );
+ } else {
+ sizeContour3=-1;
+ }
+
+ if ( (sizeContour1>sizeContour2) && (sizeContour2>sizeContour3) )
+ {
+ beta = 0.05;
alpha = 0;
- minDistAcum=-999999999;
- for (iAlpha=0.1 ; iAlpha<1; iAlpha=iAlpha+0.1)
+ minDistAcum = 999999999;
+ for (iAlpha=0 ; iAlpha<1; iAlpha=iAlpha+0.1 )
{
- Redistribution_SIN( alpha,beta, &lstTmp1X,&lstTmp1Y,&lstTmp1Z ,sizeContour1, &lstTmp1aX,&lstTmp1aY,&lstTmp1aZ );
- distAcum = IntegralDistanceTwoContours( &lstTmp1aX,&lstTmp1aY,&lstTmp1aZ , &lstTmp2X,&lstTmp2Y,&lstTmp2Z );
+ Redistribution_SIN( iAlpha,beta, &lstTmp2X,&lstTmp2Y,&lstTmp2Z ,sizeContour2, &lstTmp2aX,&lstTmp2aY,&lstTmp2aZ );
+ distAcum = IntegralDistanceTwoContours( &lstTmp1X,&lstTmp1Y,&lstTmp1Z , &lstTmp2aX,&lstTmp2aY,&lstTmp2aZ );
if (distAcum<minDistAcum)
{
alpha = iAlpha;
} // if integerDist
} // for alpha
// find Beta
+ minDistAcum = 999999999;
for (iBeta=0.0 ; iBeta<0.2; iBeta=iBeta+0.01)
{
- minDistAcum=-999999999;
- Redistribution_SIN( alpha,beta, &lstTmp1X,&lstTmp1Y,&lstTmp1Z , &lstTmp1aX,&lstTmp1aY,&lstTmp1aZ );
- distAcum = IntegralDistanceTwoContours( &lstTmp1aX,&lstTmp1aY,&lstTmp1aZ , &lstTmp2X,&lstTmp2Y,&lstTmp2Z );
+ Redistribution_SIN( alpha,iBeta, &lstTmp2X,&lstTmp2Y,&lstTmp2Z ,sizeContour2, &lstTmp2aX,&lstTmp2aY,&lstTmp2aZ );
+ distAcum = IntegralDistanceTwoContours( &lstTmp1X,&lstTmp1Y,&lstTmp1Z , &lstTmp2aX,&lstTmp2aY,&lstTmp2aZ );
if (distAcum<minDistAcum)
{
beta = iBeta;
} // if integerDist
} // for beta
- } //if sizeContour2<sizeContour1
+ } //if sizeContour1>sizeContour2>sizeContour3
+ else {
+ if ( (sizeContour1>sizeContour2) && (sizeContour2<sizeContour3) )
+ {
+ lstContourExeption.push_back( iContour+1 );
+ } //
+ }
+
// Set Alpha y Beta
- Redistribution_SIN( alpha,beta, &lstTmp1X,&lstTmp1Y,&lstTmp1Z , &lstTmp1aX,&lstTmp1aY,&lstTmp1aZ );
- double nn = SizeContour( &lstTmp1aX, &lstTmp1aY, &lstTmp1aZ );
- PutPointsInContour(&lstTmp1aX,&lstTmp1aY,&lstTmp1aZ, iContour ,lstOutX,lstOutY,lstOutZ,lstIndexsOut);
+
+
+ Redistribution_SIN( alpha,beta, &lstTmp2X,&lstTmp2Y,&lstTmp2Z ,sizeContour2, &lstTmp2aX,&lstTmp2aY,&lstTmp2aZ );
+
+// if(lstTmp2Y[0]==385) { alpha=bbGetInputParam()[1]; beta=bbGetInputParam()[2]; printf("ManualContourModel_Box::RedistributionPointsAllContours_SIN ---385-- \n"); }
+printf("ManualContourModel_Box::RedistributionPointsAllContours_SIN wve 1 alpha=%f beta=%f z=%f sc1=%f sc2=%f\n",alpha,beta,lstTmp2Y[0], sizeContour1,sizeContour2 );
+
+ PutPointsInContour(&lstTmp2aX,&lstTmp2aY,&lstTmp2aZ, iContour+1 ,lstOutX,lstOutY,lstOutZ,lstIndexsOut);
sizeContour1 = sizeContour2;
- CopyContour2InContour1( &lstTmp2X,&lstTmp2Y,&lstTmp2Z , &lstTmp1X,&lstTmp1Y,&lstTmp1Z );
+ CopyContour2InContour1( &lstTmp2aX,&lstTmp2aY,&lstTmp2aZ , &lstTmp1X,&lstTmp1Y,&lstTmp1Z );
+
} // for iContour
+
+
+
+
+
+ // ------------ Wave 2 -----------------
+
+ ExtractContour(lstOutX,lstOutY,lstOutZ,lstIndexsOut,nbContours-1,&lstTmp1X,&lstTmp1Y,&lstTmp1Z);
+ sizeContour1 = SizeContour( &lstTmp1X, &lstTmp1Y, &lstTmp1Z );
+
+// Increment
+ for ( iContour=nbContours-1; iContour>=0 ; iContour-- )
+ {
+printf("ManualContourModel_Box::RedistributionPointsAllContours_SIN iContour=%d\n",iContour);
+ beta = 0;
+ alpha = 0;
+// find Alpha
+ ExtractContour( lstOutX,lstOutY,lstOutZ,lstIndexsOut, iContour-1 ,&lstTmp2X,&lstTmp2Y,&lstTmp2Z );
+ sizeContour2 = SizeContour( &lstTmp2X, &lstTmp2Y, &lstTmp2Z );
+
+
+ if (iContour-2<=0)
+ {
+ ExtractContour( lstOutX,lstOutY,lstOutZ,lstIndexsOut, iContour-2 ,&lstTmp3X,&lstTmp3Y,&lstTmp3Z );
+ sizeContour3 = SizeContour( &lstTmp3X, &lstTmp3Y, &lstTmp3Z );
+ } else {
+ sizeContour3=-1;
+ }
+
+ if ( (sizeContour1>sizeContour2) && (sizeContour2>sizeContour3) ){
+ beta = 0.05;
+ alpha = 0;
+ minDistAcum = 999999999;
+ for (iAlpha=0 ; iAlpha<1; iAlpha=iAlpha+0.1 )
+ {
+ Redistribution_SIN( iAlpha,beta, &lstTmp2X,&lstTmp2Y,&lstTmp2Z ,sizeContour2, &lstTmp2aX,&lstTmp2aY,&lstTmp2aZ );
+ distAcum = IntegralDistanceTwoContours( &lstTmp1X,&lstTmp1Y,&lstTmp1Z , &lstTmp2aX,&lstTmp2aY,&lstTmp2aZ );
+ if (distAcum<minDistAcum)
+ {
+ alpha = iAlpha;
+ minDistAcum = distAcum;
+ } // if integerDist
+ } // for alpha
+// find Beta
+ minDistAcum = 999999999;
+ for (iBeta=0.0 ; iBeta<0.2; iBeta=iBeta+0.01)
+ {
+ Redistribution_SIN( alpha,iBeta, &lstTmp2X,&lstTmp2Y,&lstTmp2Z ,sizeContour2, &lstTmp2aX,&lstTmp2aY,&lstTmp2aZ );
+ distAcum = IntegralDistanceTwoContours( &lstTmp1X,&lstTmp1Y,&lstTmp1Z , &lstTmp2aX,&lstTmp2aY,&lstTmp2aZ );
+ if (distAcum<minDistAcum)
+ {
+ beta = iBeta;
+ minDistAcum = distAcum;
+ } // if integerDist
+
+ } // for beta
+ } //if sizeContour1>sizeContour2>sizeContour3
+// Set Alpha y Beta
+
+
+ Redistribution_SIN( alpha,beta, &lstTmp2X,&lstTmp2Y,&lstTmp2Z ,sizeContour2, &lstTmp2aX,&lstTmp2aY,&lstTmp2aZ );
+
+// if(lstTmp2Y[0]==385) { alpha=bbGetInputParam()[1]; beta=bbGetInputParam()[2]; printf("ManualContourModel_Box::RedistributionPointsAllContours_SIN ---385-- \n"); }
+printf("ManualContourModel_Box::RedistributionPointsAllContours_SIN wave 2 alpha=%f beta=%f z=%f sc1=%f sc2=%f\n",alpha,beta,lstTmp2Y[0], sizeContour1,sizeContour2 );
+
+ PutPointsInContour(&lstTmp2aX,&lstTmp2aY,&lstTmp2aZ, iContour-1 ,lstOutX,lstOutY,lstOutZ,lstIndexsOut);
+ sizeContour1 = sizeContour2;
+ CopyContour2InContour1( &lstTmp2aX,&lstTmp2aY,&lstTmp2aZ , &lstTmp1X,&lstTmp1Y,&lstTmp1Z );
+
+ } // for iContour
+
+
+
+ // ------------ Wave 3 -----------------
+
+ printf("ManualContourModel_Box::RedistributionPointsAllContours_SIN wave3 los que faltan");
+ double iExtra,sizeExtra=lstContourExeption.size();
+ for ( iExtra=0 ; iExtra<sizeExtra ; iExtra++ )
+ {
+ printf("ManualContourModel_Box::RedistributionPointsAllContours_SIN wave3 los que faltan %d \n", lstContourExeption[iExtra] );
+
+ ExtractContour(lstOutX,lstOutY,lstOutZ,lstIndexsOut, lstContourExeption[iExtra]-1 , &lstTmp1X,&lstTmp1Y,&lstTmp1Z);
+ sizeContour1 = SizeContour( &lstTmp1X, &lstTmp1Y, &lstTmp1Z );
+ ExtractContour(lstOutX,lstOutY,lstOutZ,lstIndexsOut, lstContourExeption[iExtra] , &lstTmp2X,&lstTmp2Y,&lstTmp2Z);
+ sizeContour2 = SizeContour( &lstTmp2X, &lstTmp2Y, &lstTmp2Z );
+ ExtractContour(lstOutX,lstOutY,lstOutZ,lstIndexsOut, lstContourExeption[iExtra]+1 , &lstTmp3X,&lstTmp3Y,&lstTmp3Z);
+ sizeContour3 = SizeContour( &lstTmp3X, &lstTmp3Y, &lstTmp3Z );
+
+ beta = 0.05;
+ alpha = 0;
+ minDistAcum = 999999999;
+ for (iAlpha=0 ; iAlpha<1; iAlpha=iAlpha+0.1 )
+ {
+ Redistribution_SIN( iAlpha,beta, &lstTmp2X,&lstTmp2Y,&lstTmp2Z ,sizeContour2, &lstTmp2aX,&lstTmp2aY,&lstTmp2aZ );
+ distAcum = IntegralDistanceTwoContours( &lstTmp1X,&lstTmp1Y,&lstTmp1Z , &lstTmp2aX,&lstTmp2aY,&lstTmp2aZ );
+ if (distAcum<minDistAcum)
+ {
+ alpha = iAlpha;
+ minDistAcum = distAcum;
+ } // if integerDist
+ } // for alpha
+// find Beta
+ minDistAcum = 999999999;
+ for (iBeta=0.0 ; iBeta<0.2; iBeta=iBeta+0.01)
+ {
+ Redistribution_SIN( alpha,iBeta, &lstTmp2X,&lstTmp2Y,&lstTmp2Z ,sizeContour2, &lstTmp2aX,&lstTmp2aY,&lstTmp2aZ );
+ distAcum = IntegralDistanceTwoContours( &lstTmp1X,&lstTmp1Y,&lstTmp1Z , &lstTmp2aX,&lstTmp2aY,&lstTmp2aZ );
+ if (distAcum<minDistAcum)
+ {
+ beta = iBeta;
+ minDistAcum = distAcum;
+ } // if integerDist
+ } // for beta
+ Redistribution_SIN( alpha,beta, &lstTmp2X,&lstTmp2Y,&lstTmp2Z ,sizeContour2, &lstTmp2aX,&lstTmp2aY,&lstTmp2aZ );
+
+
+ beta = 0.05;
+ alpha = 0;
+ minDistAcum = 999999999;
+ for (iAlpha=0 ; iAlpha<1; iAlpha=iAlpha+0.1 )
+ {
+ Redistribution_SIN( iAlpha,beta, &lstTmp2X,&lstTmp2Y,&lstTmp2Z ,sizeContour2, &lstTmp2bX,&lstTmp2bY,&lstTmp2bZ );
+ distAcum = IntegralDistanceTwoContours( &lstTmp3X,&lstTmp3Y,&lstTmp3Z , &lstTmp2bX,&lstTmp2bY,&lstTmp2bZ );
+ if (distAcum<minDistAcum)
+ {
+ alpha = iAlpha;
+ minDistAcum = distAcum;
+ } // if integerDist
+ } // for alpha
+// find Beta
+ minDistAcum = 999999999;
+ for (iBeta=0.0 ; iBeta<0.2; iBeta=iBeta+0.01)
+ {
+ Redistribution_SIN( alpha,iBeta, &lstTmp2X,&lstTmp2Y,&lstTmp2Z ,sizeContour2, &lstTmp2bX,&lstTmp2bY,&lstTmp2bZ );
+ distAcum = IntegralDistanceTwoContours( &lstTmp3X,&lstTmp3Y,&lstTmp3Z , &lstTmp2bX,&lstTmp2bY,&lstTmp2bZ );
+ if (distAcum<minDistAcum)
+ {
+ beta = iBeta;
+ minDistAcum = distAcum;
+ } // if integerDist
+ } // for beta
+ Redistribution_SIN( alpha,beta, &lstTmp2X,&lstTmp2Y,&lstTmp2Z ,sizeContour2, &lstTmp2bX,&lstTmp2bY,&lstTmp2bZ );
+
+// Mixing2DistributionVectors(&lstTmp2aX,&lstTmp2aY,&lstTmp2aZ,&lstTmp2bX,&lstTmp2bY,&lstTmp2bZ, &lstTmp2cX,&lstTmp2cY,&lstTmp2cZ );
+ PutPointsInContour(&lstTmp2cX,&lstTmp2cY,&lstTmp2cZ, lstContourExeption[iExtra] ,lstOutX,lstOutY,lstOutZ,lstIndexsOut);
+
+ } // for iExtra
+
+
+
+
+
+
+
+printf("ManualContourModel_Box::RedistributionPointsAllContours_SIN End\n");
+
}