Iso3D.cpp (mathmod-11.0-source) | : | Iso3D.cpp (mathmod-11.1-source) | ||
---|---|---|---|---|
skipping to change at line 639 | skipping to change at line 639 | |||
for (uint k= 0; k < limitX; k++) | for (uint k= 0; k < limitX; k++) | |||
workerthreads[nbthreads].xLocal2[IsoIndex*maxgridval+k] = masterthre ad->xLocal2[IsoIndex*maxgridval+k]; | workerthreads[nbthreads].xLocal2[IsoIndex*maxgridval+k] = masterthre ad->xLocal2[IsoIndex*maxgridval+k]; | |||
for (uint k= 0; k < limitY; k++) | for (uint k= 0; k < limitY; k++) | |||
workerthreads[nbthreads].yLocal2[IsoIndex*maxgridval+k] = masterthre ad->yLocal2[IsoIndex*maxgridval+k]; | workerthreads[nbthreads].yLocal2[IsoIndex*maxgridval+k] = masterthre ad->yLocal2[IsoIndex*maxgridval+k]; | |||
for (uint k= 0; k < limitZ; k++) | for (uint k= 0; k < limitZ; k++) | |||
workerthreads[nbthreads].zLocal2[IsoIndex*maxgridval+k] = masterthre ad->zLocal2[IsoIndex*maxgridval+k]; | workerthreads[nbthreads].zLocal2[IsoIndex*maxgridval+k] = masterthre ad->zLocal2[IsoIndex*maxgridval+k]; | |||
} | } | |||
} | } | |||
void IsoWorkerThread::VoxelEvaluation(uint IsoIndex) | void IsoWorkerThread::VoxelEvaluation(uint IsoIndex) | |||
{ | { | |||
double* vals; | ||||
double* Res; | ||||
uint maxgrscalemaxgr = GridVal*GridVal; | uint maxgrscalemaxgr = GridVal*GridVal; | |||
const uint limitY = XYZgrid, limitZ = XYZgrid; | const uint limitY = XYZgrid, limitZ = XYZgrid; | |||
uint I, J, IJK; | uint I_jp, J_jp, IJK_jp; | |||
uint id=0; | uint id=0; | |||
uint nbX=OrignbX, nbY=OrignbY, nbZ=OrignbZ; | uint nbX=OrignbX, nbY=OrignbY, nbZ=OrignbZ; | |||
uint nbstack=nbX*nbY*nbZ; | uint nbstack=nbX*nbY*nbZ; | |||
uint Iindice=0, Jindice=0, Kindice=0, nbvar=8; | uint Iindice=0, Jindice=0, Kindice=0, nbvar=8; | |||
int PreviousSignal=0; | int PreviousSignal=0; | |||
vals = new double[nbvar*nbstack]; | double vals[nbvar*nbstack]; | |||
Res = new double[nbstack]; | double Res[nbstack]; | |||
vals[3] = stepMorph; | vals[3] = stepMorph; | |||
//vals[4] = double(MyIndex); | ||||
uint taille=0; | uint taille=0; | |||
iStart = 0; | iStart = 0; | |||
iFinish = 0; | iFinish = 0; | |||
for(uint i=0; i<XYZgrid; i++) | for(uint i=0; i<XYZgrid; i++) | |||
{ | { | |||
if((i% (WorkerThreadsNumber)) == MyIndex ) | if((i% (WorkerThreadsNumber)) == MyIndex ) | |||
taille += 1; | taille += 1; | |||
if(MyIndex <= (i% (WorkerThreadsNumber))) | if(MyIndex <= (i% (WorkerThreadsNumber))) | |||
iFinish += 1; | iFinish += 1; | |||
} | } | |||
skipping to change at line 682 | skipping to change at line 680 | |||
implicitFunctionParser[IsoIndex].AllocateStackMemory(Stack_Factor, nbvariabl es); | implicitFunctionParser[IsoIndex].AllocateStackMemory(Stack_Factor, nbvariabl es); | |||
for(uint i=iStart; i<iFinish; i+=nbX ) | for(uint i=iStart; i<iFinish; i+=nbX ) | |||
{ | { | |||
Iindice = i; | Iindice = i; | |||
nbY=OrignbY; | nbY=OrignbY; | |||
if((remX>0) && ((Iindice+remX)==(iFinish))) | if((remX>0) && ((Iindice+remX)==(iFinish))) | |||
{ | { | |||
nbX = remX; | nbX = remX; | |||
i= iFinish; | i= iFinish; | |||
} | } | |||
I = Iindice*maxgrscalemaxgr; | I_jp = Iindice*maxgrscalemaxgr; | |||
for(uint j=0; j<limitY; j+=nbY) | for(uint j=0; j<limitY; j+=nbY) | |||
{ | { | |||
Jindice = j; | Jindice = j; | |||
nbZ=OrignbZ; | nbZ=OrignbZ; | |||
if((remY>0) && ((Jindice+remY)==(limitY))) | if((remY>0) && ((Jindice+remY)==(limitY))) | |||
{ | { | |||
nbY = remY; | nbY = remY; | |||
j= limitY; | j= limitY; | |||
} | } | |||
J = I + Jindice*GridVal; | J_jp = I_jp + Jindice*GridVal; | |||
for(uint k=0; k<limitZ; k+=nbZ) | for(uint k=0; k<limitZ; k+=nbZ) | |||
{ | { | |||
Kindice = k; | Kindice = k; | |||
if((remZ>0) && ((Kindice+remZ)==(limitZ))) | if((remZ>0) && ((Kindice+remZ)==(limitZ))) | |||
{ | { | |||
nbZ = remZ; | nbZ = remZ; | |||
k= limitZ; | k= limitZ; | |||
} | } | |||
nbstack = nbX*nbY*nbZ; | nbstack = nbX*nbY*nbZ; | |||
// X, Y and Z arrays construction: | // X, Y and Z arrays construction: | |||
for(uint l=0; l<nbstack; l++) | for(uint l=0; l<nbstack; l++) | |||
{ | { | |||
vals[l*nbvar ]= xLocal2[IsoIndex*GridVal+Iindice+uint(l*nbX /nbstack)]; | vals[l*nbvar ]= xLocal2[IsoIndex*GridVal+Iindice+uint(l*nbX /nbstack)]; | |||
vals[l*nbvar+1]= yLocal2[IsoIndex*GridVal+Jindice+((uint(l/n bZ))%nbY)]; | vals[l*nbvar+1]= yLocal2[IsoIndex*GridVal+Jindice+((uint(l/n bZ))%nbY)]; | |||
vals[l*nbvar+2]= zLocal2[IsoIndex*GridVal+Kindice+(l%nbZ)]; | vals[l*nbvar+2]= zLocal2[IsoIndex*GridVal+Kindice+(l%nbZ)]; | |||
vals[l*nbvar+4]=Iindice+uint(l*nbX/nbstack); | vals[l*nbvar+4]=Iindice+uint(l*nbX/nbstack); | |||
vals[l*nbvar+5]=Jindice+((uint(l/nbZ))%nbY); | vals[l*nbvar+5]=Jindice+((uint(l/nbZ))%nbY); | |||
vals[l*nbvar+6]=Kindice+(l%nbZ); | vals[l*nbvar+6]=Kindice+(l%nbZ); | |||
} | } | |||
IJK = J+Kindice; | IJK_jp = J_jp+Kindice; | |||
double res = implicitFunctionParser[IsoIndex].Eval2(vals, nbvar, Res, nbstack); | double res = implicitFunctionParser[IsoIndex].Eval2(vals, nbvar, Res, nbstack); | |||
if( abs(res - IF_FUNCT_ERROR) == 0.0) | if( abs(res - IF_FUNCT_ERROR) == 0.0) | |||
{ | { | |||
for(uint l=0; l<nbstack; l++) | for(uint l=0; l<nbstack; l++) | |||
Res[l] = implicitFunctionParser[IsoIndex].Eval(&(vals[l* nbvar])); | Res[l] = implicitFunctionParser[IsoIndex].Eval(&(vals[l* nbvar])); | |||
} | } | |||
else if( abs(res - DIVISION_BY_ZERO) == 0.0 || abs(res - VAR_OVE RFLOW) == 0.0) | else if( abs(res - DIVISION_BY_ZERO) == 0.0 || abs(res - VAR_OVE RFLOW) == 0.0) | |||
{ | { | |||
StopCalculations = true; | StopCalculations = true; | |||
} | } | |||
if(StopCalculations) | if(StopCalculations) | |||
return; | return; | |||
uint p=0; | uint p=0; | |||
uint sect=0; | uint sect=0; | |||
for(uint ii=0; ii<nbX; ii++) | for(uint ii=0; ii<nbX; ii++) | |||
for(uint jj=0; jj<nbY; jj++) | for(uint jj=0; jj<nbY; jj++) | |||
for(uint kk=0; kk<nbZ; kk++) | for(uint kk=0; kk<nbZ; kk++) | |||
{ | { | |||
sect= IJK + (ii)*GridVal*GridVal+ (jj)*GridVal + (kk ); | sect= IJK_jp + (ii)*GridVal*GridVal+ (jj)*GridVal + (kk); | |||
Results[sect] = Res[p]; | Results[sect] = Res[p]; | |||
GridVoxelVarPt[sect].Signature = 0; // Signature i nitialisation | GridVoxelVarPt[sect].Signature = 0; // Signature i nitialisation | |||
GridVoxelVarPt[sect].NbEdgePoint = 0; // No EdgePoin t yet! | GridVoxelVarPt[sect].NbEdgePoint = 0; // No EdgePoin t yet! | |||
p++; | p++; | |||
} | } | |||
//Signal emission: | //Signal emission: | |||
id+=nbstack; | id+=nbstack; | |||
if(MyIndex == 0 && activeMorph != 1) | if(MyIndex == 0 && activeMorph != 1) | |||
{ | { | |||
signalVal = int((id*100)/Totalpoints); | signalVal = int((id*100)/Totalpoints); | |||
if((signalVal - PreviousSignal) > 1 || id==Totalpoints) | if((signalVal - PreviousSignal) > 1 || id==Totalpoints) | |||
{ | { | |||
PreviousSignal = signalVal; | PreviousSignal = signalVal; | |||
emitMySignal(); | emitMySignal(); | |||
} | } | |||
} | } | |||
} | } | |||
} | } | |||
} | } | |||
delete[] vals; | ||||
delete[] Res; | ||||
} | } | |||
void Iso3D::ConstructIsoNormale(uint idx) | void Iso3D::ConstructIsoNormale(uint idx) | |||
{ | { | |||
float val1, val2, val3, val4, val5, val6, | float val1, val2, val3, val4, val5, val6, | |||
pt1_x, pt1_y, pt1_z, | pt1_x, pt1_y, pt1_z, | |||
pt2_x, pt2_y, pt2_z, | pt2_x, pt2_y, pt2_z, | |||
pt3_x, pt3_y, pt3_z, | pt3_x, pt3_y, pt3_z, | |||
scalar, n1, n2, n3; | scalar, n1, n2, n3; | |||
uint ThreeTimesI, IndexFirstPoint, IndexSecondPoint, IndexThirdPoint; | uint ThreeTimesI, IndexFirstPoint, IndexSecondPoint, IndexThirdPoint; | |||
NormOriginaltmpVector.resize(NormOriginaltmpVector.size()+ 3*NbTriangleIsoSu rface); | NormOriginaltmpVector.resize(NormOriginaltmpVector.size()+ 3*NbTriangleIsoSu rface); | |||
skipping to change at line 1409 | skipping to change at line 1405 | |||
{ | { | |||
uint NbTriangleIsoSurfaceTmp, PreviousGridVal=masterthread->XYZgrid; | uint NbTriangleIsoSurfaceTmp, PreviousGridVal=masterthread->XYZgrid; | |||
NbPointIsoMap= 0; | NbPointIsoMap= 0; | |||
NbVertexTmp = NbTriangleIsoSurfaceTmp = 0; | NbVertexTmp = NbTriangleIsoSurfaceTmp = 0; | |||
componentsPt->updateviewer= false; | componentsPt->updateviewer= false; | |||
clear(components); | clear(components); | |||
components->ParisoCondition = componentsPt->ParisoCondition; | components->ParisoCondition = componentsPt->ParisoCondition; | |||
if(componentsPt->pariso && componentsPt->ParisoCurrentComponentIndex>0) | if(componentsPt->pariso && componentsPt->ParisoCurrentComponentIndex>0) | |||
{ | { | |||
NbVertexTmp = uint(NormVertexTabVector.size()/10); | NbVertexTmp = uint(NormVertexTabVector.size()/10); | |||
NbTriangleIsoSurfaceTmp = uint(IndexPolyTabVector.size()/3); | ||||
//********************* | ||||
// probleme with pariso objects comes from here since IndexPolyTabVector | ||||
not only contains triangles but also lines | ||||
// inherited from it's parametric conterpart | ||||
NbTriangleIsoSurfaceTmp = uint(IndexPolyTabVector.size()/3); // <== | ||||
//********************* | ||||
copycomponent(components, componentsPt); | copycomponent(components, componentsPt); | |||
} | } | |||
else | else | |||
{ | { | |||
if(componentsPt->pariso) | if(componentsPt->pariso) | |||
{ | { | |||
components->pariso = true; | components->pariso = true; | |||
components->ParisoCurrentComponentIndex = componentsPt->ParisoCurren tComponentIndex; | components->ParisoCurrentComponentIndex = componentsPt->ParisoCurren tComponentIndex; | |||
components->ParisoNbComponents = componentsPt->ParisoNbComponents; | components->ParisoNbComponents = componentsPt->ParisoNbComponents; | |||
} | } | |||
skipping to change at line 1609 | skipping to change at line 1611 | |||
components->NoiseParam[components->ParisoCurrentComponentIndex].NoiseSha pe = 1; | components->NoiseParam[components->ParisoCurrentComponentIndex].NoiseSha pe = 1; | |||
CalculateColorsPoints(components, components->ThereisRGBA.size()-1); | CalculateColorsPoints(components, components->ThereisRGBA.size()-1); | |||
*PolyNumber = uint(IndexPolyTabVector.size()); | *PolyNumber = uint(IndexPolyTabVector.size()); | |||
*VertexNumberpt = uint(NormVertexTabVector.size()/10); | *VertexNumberpt = uint(NormVertexTabVector.size()/10); | |||
*VertxNumber = uint(IndexPolyTabMinVector.size()); | *VertxNumber = uint(IndexPolyTabMinVector.size()); | |||
if(masterthread->activeMorph != 1) | if(masterthread->activeMorph != 1) | |||
{ | { | |||
message = QString("Thr:"+QString::number(WorkerThreadsNumber)+"; Cmp:"+Q String::number(masterthread->componentsNumber)+"; T="+QString::number(times.elap sed()/1000.0)+"s"); | message = QString("Thr:"+QString::number(WorkerThreadsNumber)+"; Cmp:"+Q String::number(masterthread->componentsNumber)+"; T="+QString::number(times.elap sed()/1000.0)+"s"); | |||
emitUpdateMessageSignal(); | emitUpdateMessageSignal(); | |||
} | } | |||
NormVertexTabVector.resize(NormVertexTabVector.size()+ (12+60+36)*10); // To add memory space to store the cube 12 vertices (three quads) | NormVertexTabVector.resize(NormVertexTabVector.size()+ (12+60+36)*10); // To add memory space to store the cube 12 vertices (three quads) | |||
uint startpl = 0; | uint startpl = 0; | |||
uint actualpointindice=0; | uint actualpointindice=0; | |||
for (uint i = 0; i < *VertxNumber; i++) | for (uint i = 0; i < *VertxNumber; i++) | |||
{ | { | |||
uint polysize = IndexPolyTabMinVector[startpl++]; | uint polysize = IndexPolyTabMinVector[startpl++]; | |||
for (uint j = 0; j < polysize; j++) | for (uint j = 0; j < polysize; j++) | |||
{ | { | |||
actualpointindice = IndexPolyTabMinVector[startpl]; | actualpointindice = IndexPolyTabMinVector[startpl]; | |||
skipping to change at line 2176 | skipping to change at line 2177 | |||
return 1; | return 1; | |||
} | } | |||
Iso3D::~Iso3D() | Iso3D::~Iso3D() | |||
{ | { | |||
} | } | |||
uint Iso3D::SetMiniMmeshStruct() | uint Iso3D::SetMiniMmeshStruct() | |||
{ | { | |||
uint I, J, IJK, i, j, k, Index, lnew, iter, nbpl, iterpl; | uint I_mi, J_mi, IJK_mi, Index_mi, lnew_mi, iter_mi, nbpl_mi, iterpl_mi; | |||
uint maxgrscalemaxgr = masterthread->GridVal*masterthread->GridVal; | uint maxgrscalemaxgr = masterthread->GridVal*masterthread->GridVal; | |||
lnew = 0; | lnew_mi = 0; | |||
NbPolyMin = 0; | NbPolyMin = 0; | |||
/// Copy Index Polygons : | /// Copy Index Polygons : | |||
for(i=0; i+1 < masterthread->XYZgrid; i++) | for(uint i=0; i+1 < masterthread->XYZgrid; i++) | |||
{ | { | |||
I = i*maxgrscalemaxgr; | I_mi = i*maxgrscalemaxgr; | |||
for(j=0; j+1 < masterthread->XYZgrid; j++) | for(uint j=0; j+1 < masterthread->XYZgrid; j++) | |||
{ | { | |||
J = I+j*masterthread->GridVal; | J_mi = I_mi+j*masterthread->GridVal; | |||
for(k=0; k+1 < masterthread->XYZgrid; k++) | for(uint k=0; k+1 < masterthread->XYZgrid; k++) | |||
{ | { | |||
IJK = J+k; | IJK_mi = J_mi+k; | |||
Index = GridVoxelVarPt[IJK].Signature; | Index_mi = GridVoxelVarPt[IJK_mi].Signature; | |||
nbpl = triTable_min[Index][16]; | nbpl_mi = triTable_min[Index_mi][16]; | |||
if( nbpl == 1) | if( nbpl_mi == 1) | |||
{ | { | |||
NbPolyMin += nbpl; | NbPolyMin += nbpl_mi; | |||
IndexPolyTabMinVector.push_back(triTable_min[Index][17]); | IndexPolyTabMinVector.push_back(triTable_min[Index_mi][17]); | |||
lnew++; | lnew_mi++; | |||
for(iter = 0; iter < triTable_min[Index][17]; iter++) | for(iter_mi = 0; iter_mi < triTable_min[Index_mi][17]; iter_ | |||
IndexPolyTabMinVector.push_back(GridVoxelVarPt[IJK].Edge | mi++) | |||
_Points[triTable_min[Index][iter]] + NbVertexTmp); | IndexPolyTabMinVector.push_back(GridVoxelVarPt[IJK_mi].E | |||
lnew+=triTable_min[Index][17]; | dge_Points[triTable_min[Index_mi][iter_mi]] + NbVertexTmp); | |||
lnew_mi+=triTable_min[Index_mi][17]; | ||||
} | } | |||
else if( nbpl == 2) | else if( nbpl_mi == 2) | |||
{ | { | |||
NbPolyMin += nbpl; | NbPolyMin += nbpl_mi; | |||
/// First Poly: | /// First Poly: | |||
IndexPolyTabMinVector.push_back(triTable_min[Index][17]); | IndexPolyTabMinVector.push_back(triTable_min[Index_mi][17]); | |||
lnew++; | lnew_mi++; | |||
for(iter = 0; iter < triTable_min[Index][17]; iter++) | for(iter_mi = 0; iter_mi < triTable_min[Index_mi][17]; iter_ | |||
IndexPolyTabMinVector.push_back(GridVoxelVarPt[IJK].Edge | mi++) | |||
_Points[triTable_min[Index][iter]] + NbVertexTmp); | IndexPolyTabMinVector.push_back(GridVoxelVarPt[IJK_mi].E | |||
lnew+=triTable_min[Index][17]; | dge_Points[triTable_min[Index_mi][iter_mi]] + NbVertexTmp); | |||
lnew_mi+=triTable_min[Index_mi][17]; | ||||
/// Second Poly: | /// Second Poly: | |||
IndexPolyTabMinVector.push_back(triTable_min[Index][18]); | IndexPolyTabMinVector.push_back(triTable_min[Index_mi][18]); | |||
lnew++; | lnew_mi++; | |||
for(iter = triTable_min[Index][17]; iter < triTable_min[Inde | for(iter_mi = triTable_min[Index_mi][17]; iter_mi < triTable | |||
x][17]+triTable_min[Index][18]; iter++) | _min[Index_mi][17]+triTable_min[Index_mi][18]; iter_mi++) | |||
IndexPolyTabMinVector.push_back(GridVoxelVarPt[IJK].Edge | IndexPolyTabMinVector.push_back(GridVoxelVarPt[IJK_mi].E | |||
_Points[triTable_min[Index][iter]] + NbVertexTmp); | dge_Points[triTable_min[Index_mi][iter_mi]] + NbVertexTmp); | |||
lnew+=triTable_min[Index][17]+triTable_min[Index][18]; | lnew_mi+=triTable_min[Index_mi][17]+triTable_min[Index_mi][1 | |||
8]; | ||||
} | } | |||
else if( nbpl > 2) | else if( nbpl_mi > 2) | |||
{ | { | |||
NbPolyMin += nbpl; | NbPolyMin += nbpl_mi; | |||
/// In this case we have only Triangles (3 or 4): | /// In this case we have only Triangles (3 or 4): | |||
iter = 0; | iter_mi = 0; | |||
for(iterpl = 0; iterpl < nbpl; iterpl++) | for(iterpl_mi = 0; iterpl_mi < nbpl_mi; iterpl_mi++) | |||
{ | { | |||
IndexPolyTabMinVector.push_back(3); | IndexPolyTabMinVector.push_back(3); | |||
IndexPolyTabMinVector.push_back(GridVoxelVarPt[IJK].Edge | IndexPolyTabMinVector.push_back(GridVoxelVarPt[IJK_mi].E | |||
_Points[triTable_min[Index][iter ]] + NbVertexTmp); | dge_Points[triTable_min[Index_mi][iter_mi ]] + NbVertexTmp); | |||
IndexPolyTabMinVector.push_back(GridVoxelVarPt[IJK].Edge | IndexPolyTabMinVector.push_back(GridVoxelVarPt[IJK_mi].E | |||
_Points[triTable_min[Index][iter+1]] + NbVertexTmp); | dge_Points[triTable_min[Index_mi][iter_mi+1]] + NbVertexTmp); | |||
IndexPolyTabMinVector.push_back(GridVoxelVarPt[IJK].Edge | IndexPolyTabMinVector.push_back(GridVoxelVarPt[IJK_mi].E | |||
_Points[triTable_min[Index][iter+2]] + NbVertexTmp); | dge_Points[triTable_min[Index_mi][iter_mi+2]] + NbVertexTmp); | |||
lnew += 4; | lnew_mi += 4; | |||
iter +=3; | iter_mi +=3; | |||
} | } | |||
} | } | |||
} /// End of for(k=0; | } /// End of for(k=0; | |||
} /// End of for(j=0; | } /// End of for(j=0; | |||
} /// End of for(i=0; | } /// End of for(i=0; | |||
return 1; | return 1; | |||
} | } | |||
uint Iso3D::ConstructIsoSurface() | uint Iso3D::ConstructIsoSurface() | |||
{ | { | |||
uint Index, IndexFirstPoint, IndexSeconPoint, IndexThirdPoint; | uint Index, IndexFirstPoint, IndexSeconPoint, IndexThirdPoint; | |||
uint I, J, IJK; | uint I_co, J_co, IJK_co; | |||
uint maxgrscalemaxgr = masterthread->GridVal*masterthread->GridVal; | uint maxgrscalemaxgr = masterthread->GridVal*masterthread->GridVal; | |||
NbTriangleIsoSurface = 0; | NbTriangleIsoSurface = 0; | |||
for(uint i=0; i+1 < masterthread->XYZgrid; i++) | for(uint i=0; i+1 < masterthread->XYZgrid; i++) | |||
{ | { | |||
I = i*maxgrscalemaxgr; | I_co = i*maxgrscalemaxgr; | |||
for(uint j=0; j+1 < masterthread->XYZgrid; j++) | for(uint j=0; j+1 < masterthread->XYZgrid; j++) | |||
{ | { | |||
J = I+j*masterthread->GridVal; | J_co = I_co+j*masterthread->GridVal; | |||
for(uint k=0; k+1 < masterthread->XYZgrid; k++) | for(uint k=0; k+1 < masterthread->XYZgrid; k++) | |||
{ | { | |||
IJK = J+k; | IJK_co = J_co+k; | |||
Index = GridVoxelVarPt[IJK].Signature; | Index = GridVoxelVarPt[IJK_co].Signature; | |||
for (uint l = 0; triTable[Index][l] != 111; l += 3) | for (uint l = 0; triTable[Index][l] != 111; l += 3) | |||
{ | { | |||
IndexFirstPoint = GridVoxelVarPt[IJK].Edge_Points[triTable[I | IndexFirstPoint = GridVoxelVarPt[IJK_co].Edge_Points[triTabl | |||
ndex][l ]]; | e[Index][l ]]; | |||
IndexSeconPoint = GridVoxelVarPt[IJK].Edge_Points[triTable[I | IndexSeconPoint = GridVoxelVarPt[IJK_co].Edge_Points[triTabl | |||
ndex][l+1]]; | e[Index][l+1]]; | |||
IndexThirdPoint = GridVoxelVarPt[IJK].Edge_Points[triTable[I | IndexThirdPoint = GridVoxelVarPt[IJK_co].Edge_Points[triTabl | |||
ndex][l+2]]; | e[Index][l+2]]; | |||
IndexPolyTabVector.push_back(IndexFirstPoint + NbVertexTmp); | IndexPolyTabVector.push_back(IndexFirstPoint + NbVertexTmp); | |||
IndexPolyTabVector.push_back(IndexSeconPoint + NbVertexTmp); | IndexPolyTabVector.push_back(IndexSeconPoint + NbVertexTmp); | |||
IndexPolyTabVector.push_back(IndexThirdPoint + NbVertexTmp); | IndexPolyTabVector.push_back(IndexThirdPoint + NbVertexTmp); | |||
NbTriangleIsoSurface++; | NbTriangleIsoSurface++; | |||
} | } | |||
} | } | |||
} | } | |||
} | } | |||
return 1; | return 1; | |||
} | } | |||
uint Iso3D::PointEdgeComputation(uint isoindex) | uint Iso3D::PointEdgeComputation(uint isoindex) | |||
{ | { | |||
uint i_Start, i_End, j_Start, j_End, k_Start, k_End, i, j, k; | uint i_Start, i_End, j_Start, j_End, k_Start, k_End, i, j, k; | |||
double vals[7], IsoValue_1, IsoValue_2, rapport; | double vals[7], IsoValue_1, IsoValue_2, rapport; | |||
double factor; | double factor; | |||
uint maxgridval=masterthread->GridVal; | uint maxgridval=masterthread->GridVal; | |||
uint maxgrscalemaxgr = maxgridval*maxgridval; | uint maxgrscalemaxgr = maxgridval*maxgridval; | |||
uint I, J, JK, IJK, IPLUSONEJK, IMINUSONEJK, | uint I_pl, J_pl, JK_pl, IJK_pl, IPLUSONEJK_pl, IMINUSONEJK, | |||
IJPLUSONEK, IJMINUSONEK, IMINUSONEJMINUSONEK, IsoValue=0, NbPointIsoMap _local=0; | IJPLUSONEK, IJMINUSONEK, IMINUSONEJMINUSONEK, IsoValue=0, NbPointIsoMap _local=0; | |||
/// We have to compute the edges for the Grid limits ie: i=0, j=0 and k=0 | /// We have to compute the edges for the Grid limits ie: i=0, j=0 and k=0 | |||
i_Start = 1/*+masterthread->iStart*/; | i_Start = 1/*+masterthread->iStart*/; | |||
j_Start = 1; | j_Start = 1; | |||
k_Start = 1; | k_Start = 1; | |||
i_End = masterthread->XYZgrid-1; | i_End = masterthread->XYZgrid-1; | |||
j_End = masterthread->XYZgrid-1; | j_End = masterthread->XYZgrid-1; | |||
k_End = masterthread->XYZgrid-1; | k_End = masterthread->XYZgrid-1; | |||
/// The code is doubled to eliminate conditions tests | /// The code is doubled to eliminate conditions tests | |||
for(i = i_Start; i < i_End; i++) | for(i = i_Start; i < i_End; i++) | |||
{ | { | |||
I = i*maxgrscalemaxgr; | I_pl = i*maxgrscalemaxgr; | |||
for(j = j_Start; j < j_End; j++) | for(j = j_Start; j < j_End; j++) | |||
{ | { | |||
J = I + j*maxgridval; | J_pl = I_pl + j*maxgridval; | |||
for(k = k_Start; k < k_End; k++) | for(k = k_Start; k < k_End; k++) | |||
{ | { | |||
IJK = J+k; | IJK_pl = J_pl+k; | |||
IPLUSONEJK = IJK + maxgrscalemaxgr; | IPLUSONEJK_pl = IJK_pl + maxgrscalemaxgr; | |||
IMINUSONEJK = IJK - maxgrscalemaxgr; | IMINUSONEJK = IJK_pl - maxgrscalemaxgr; | |||
IJPLUSONEK = IJK + maxgridval; | IJPLUSONEK = IJK_pl + maxgridval; | |||
IJMINUSONEK = IJK - maxgridval; | IJMINUSONEK = IJK_pl - maxgridval; | |||
IMINUSONEJMINUSONEK = IMINUSONEJK - maxgridval; | IMINUSONEJMINUSONEK = IMINUSONEJK - maxgridval; | |||
IsoValue_1 = Results[IJK]; | IsoValue_1 = Results[IJK_pl]; | |||
/// First Case P(i+1)(j)(k) | /// First Case P(i+1)(j)(k) | |||
IsoValue_2 = Results[IPLUSONEJK]; | IsoValue_2 = Results[IPLUSONEJK_pl]; | |||
if(IsoValue_1 * IsoValue_2 <= 0 && (rapport=IsoValue_2 - IsoValu e_1) != 0.0 ) | if(IsoValue_1 * IsoValue_2 <= 0 && (rapport=IsoValue_2 - IsoValu e_1) != 0.0 ) | |||
{ | { | |||
// Edge Point computation and save in IsoPointMap | // Edge Point computation and save in IsoPointMap | |||
factor = (IsoValue - IsoValue_1)/rapport; | factor = (IsoValue - IsoValue_1)/rapport; | |||
vals[0] = masterthread->xLocal2[isoindex*masterthread->GridV al+i] - factor * masterthread->x_Step[isoindex]; | vals[0] = masterthread->xLocal2[isoindex*masterthread->GridV al+i] - factor * masterthread->x_Step[isoindex]; | |||
vals[1] = masterthread->yLocal2[isoindex*masterthread->GridV al+j]; | vals[1] = masterthread->yLocal2[isoindex*masterthread->GridV al+j]; | |||
vals[2] = masterthread->zLocal2[isoindex*masterthread->GridV al+k]; | vals[2] = masterthread->zLocal2[isoindex*masterthread->GridV al+k]; | |||
///========================================================= ==/// | ///========================================================= ==/// | |||
for(int iter=0; iter<7; iter++) | for(int iter=0; iter<7; iter++) | |||
NormVertexTabVector.push_back(1.0); | NormVertexTabVector.push_back(1.0); | |||
NormVertexTabVector.push_back(float(vals[0])); | NormVertexTabVector.push_back(float(vals[0])); | |||
NormVertexTabVector.push_back(float(vals[1])); | NormVertexTabVector.push_back(float(vals[1])); | |||
NormVertexTabVector.push_back(float(vals[2])); | NormVertexTabVector.push_back(float(vals[2])); | |||
// save The reference to this point | // save The reference to this point | |||
GridVoxelVarPt[IJK].Edge_Points[0] = NbPointIsoMap_local; | GridVoxelVarPt[IJK_pl].Edge_Points[0] = NbPointIsoMap_local; | |||
GridVoxelVarPt[IJK].NbEdgePoint += 1; | GridVoxelVarPt[IJK_pl].NbEdgePoint += 1; | |||
// The same Point is used in three other Voxels | // The same Point is used in three other Voxels | |||
GridVoxelVarPt[IJMINUSONEK].Edge_Points[4] = NbPointIsoMap_l ocal; | GridVoxelVarPt[IJMINUSONEK].Edge_Points[4] = NbPointIsoMap_l ocal; | |||
GridVoxelVarPt[IJMINUSONEK].NbEdgePoint += 1; | GridVoxelVarPt[IJMINUSONEK].NbEdgePoint += 1; | |||
GridVoxelVarPt[IJK-1].Edge_Points[2] = NbPointIsoMap_local | GridVoxelVarPt[IJK_pl-1].Edge_Points[2] = NbPointIsoMap_lo | |||
; | cal; | |||
GridVoxelVarPt[IJK-1].NbEdgePoint += 1; | GridVoxelVarPt[IJK_pl-1].NbEdgePoint += 1; | |||
GridVoxelVarPt[IJMINUSONEK-1].Edge_Points[6] = NbPointIsoMap _local; | GridVoxelVarPt[IJMINUSONEK-1].Edge_Points[6] = NbPointIsoMap _local; | |||
GridVoxelVarPt[IJMINUSONEK-1].NbEdgePoint += 1; | GridVoxelVarPt[IJMINUSONEK-1].NbEdgePoint += 1; | |||
NbPointIsoMap_local++; | NbPointIsoMap_local++; | |||
} | } | |||
///+++++++++++++++++++++++++++++++++++++++++ | ///+++++++++++++++++++++++++++++++++++++++++ | |||
/// Second Case P(i)(j+1)(k) | /// Second Case P(i)(j+1)(k) | |||
IsoValue_2 = Results[IJPLUSONEK]; | IsoValue_2 = Results[IJPLUSONEK]; | |||
skipping to change at line 2362 | skipping to change at line 2363 | |||
vals[0] = masterthread->xLocal2[isoindex*masterthread->GridV al+i]; | vals[0] = masterthread->xLocal2[isoindex*masterthread->GridV al+i]; | |||
vals[1] = masterthread->yLocal2[isoindex*masterthread->GridV al+j] - factor * masterthread->y_Step[isoindex]; | vals[1] = masterthread->yLocal2[isoindex*masterthread->GridV al+j] - factor * masterthread->y_Step[isoindex]; | |||
vals[2] = masterthread->zLocal2[isoindex*masterthread->GridV al+k]; | vals[2] = masterthread->zLocal2[isoindex*masterthread->GridV al+k]; | |||
for(int iter=0; iter<7; iter++) | for(int iter=0; iter<7; iter++) | |||
NormVertexTabVector.push_back(1.0); | NormVertexTabVector.push_back(1.0); | |||
NormVertexTabVector.push_back(float(vals[0])); | NormVertexTabVector.push_back(float(vals[0])); | |||
NormVertexTabVector.push_back(float(vals[1])); | NormVertexTabVector.push_back(float(vals[1])); | |||
NormVertexTabVector.push_back(float(vals[2])); | NormVertexTabVector.push_back(float(vals[2])); | |||
// save The reference to this point | // save The reference to this point | |||
GridVoxelVarPt[IJK].Edge_Points[8] = NbPointIsoMap_local; | GridVoxelVarPt[IJK_pl].Edge_Points[8] = NbPointIsoMap_local; | |||
GridVoxelVarPt[IJK].NbEdgePoint += 1; | GridVoxelVarPt[IJK_pl].NbEdgePoint += 1; | |||
// The same Point is used in three other Voxels | // The same Point is used in three other Voxels | |||
GridVoxelVarPt[IMINUSONEJK].Edge_Points[9] = NbPointIsoMa p_local; | GridVoxelVarPt[IMINUSONEJK].Edge_Points[9] = NbPointIsoMa p_local; | |||
GridVoxelVarPt[IMINUSONEJK].NbEdgePoint += 1; | GridVoxelVarPt[IMINUSONEJK].NbEdgePoint += 1; | |||
GridVoxelVarPt[IJK-1].Edge_Points[11] = NbPointIsoMap_loca | GridVoxelVarPt[IJK_pl-1].Edge_Points[11] = NbPointIsoMap_l | |||
l; | ocal; | |||
GridVoxelVarPt[IJK-1].NbEdgePoint += 1; | GridVoxelVarPt[IJK_pl-1].NbEdgePoint += 1; | |||
GridVoxelVarPt[IMINUSONEJK-1].Edge_Points[10] = NbPointIsoMa p_local; | GridVoxelVarPt[IMINUSONEJK-1].Edge_Points[10] = NbPointIsoMa p_local; | |||
GridVoxelVarPt[IMINUSONEJK-1].NbEdgePoint += 1; | GridVoxelVarPt[IMINUSONEJK-1].NbEdgePoint += 1; | |||
NbPointIsoMap_local++; | NbPointIsoMap_local++; | |||
} | } | |||
// Third Case P(i)(j)(k+1) | // Third Case P(i)(j)(k+1) | |||
IsoValue_2 = Results[IJK+1]; | IsoValue_2 = Results[IJK_pl+1]; | |||
// Edge Point computation and save in IsoPointMap | // Edge Point computation and save in IsoPointMap | |||
if(IsoValue_1 * IsoValue_2 <= 0 && (rapport=IsoValue_2 - IsoValu e_1) != 0.0) | if(IsoValue_1 * IsoValue_2 <= 0 && (rapport=IsoValue_2 - IsoValu e_1) != 0.0) | |||
{ | { | |||
factor = (IsoValue - IsoValue_1)/rapport; | factor = (IsoValue - IsoValue_1)/rapport; | |||
vals[0] = masterthread->xLocal2[isoindex*masterthread->GridV al+i]; | vals[0] = masterthread->xLocal2[isoindex*masterthread->GridV al+i]; | |||
vals[1] = masterthread->yLocal2[isoindex*masterthread->GridV al+j]; | vals[1] = masterthread->yLocal2[isoindex*masterthread->GridV al+j]; | |||
vals[2] = masterthread->zLocal2[isoindex*masterthread->GridV al+k] - factor * masterthread->z_Step[isoindex]; | vals[2] = masterthread->zLocal2[isoindex*masterthread->GridV al+k] - factor * masterthread->z_Step[isoindex]; | |||
for(int iter=0; iter<7; iter++) | for(int iter=0; iter<7; iter++) | |||
NormVertexTabVector.push_back(1.0); | NormVertexTabVector.push_back(1.0); | |||
NormVertexTabVector.push_back(float(vals[0])); | NormVertexTabVector.push_back(float(vals[0])); | |||
NormVertexTabVector.push_back(float(vals[1])); | NormVertexTabVector.push_back(float(vals[1])); | |||
NormVertexTabVector.push_back(float(vals[2])); | NormVertexTabVector.push_back(float(vals[2])); | |||
// save The reference to this point | // save The reference to this point | |||
GridVoxelVarPt[IJK].Edge_Points[3] = NbPointIsoMap_local; | GridVoxelVarPt[IJK_pl].Edge_Points[3] = NbPointIsoMap_local; | |||
GridVoxelVarPt[IJK].NbEdgePoint += 1; | GridVoxelVarPt[IJK_pl].NbEdgePoint += 1; | |||
// The same Point is used in three other Voxels | // The same Point is used in three other Voxels | |||
GridVoxelVarPt[IMINUSONEJK].Edge_Points[1] = NbPointIsoMap _local; | GridVoxelVarPt[IMINUSONEJK].Edge_Points[1] = NbPointIsoMap _local; | |||
GridVoxelVarPt[IMINUSONEJK].NbEdgePoint += 1; | GridVoxelVarPt[IMINUSONEJK].NbEdgePoint += 1; | |||
GridVoxelVarPt[IJMINUSONEK].Edge_Points[7] = NbPointIsoMap _local; | GridVoxelVarPt[IJMINUSONEK].Edge_Points[7] = NbPointIsoMap _local; | |||
GridVoxelVarPt[IJMINUSONEK].NbEdgePoint += 1; | GridVoxelVarPt[IJMINUSONEK].NbEdgePoint += 1; | |||
GridVoxelVarPt[IMINUSONEJMINUSONEK].Edge_Points[5] = NbPoint IsoMap_local; | GridVoxelVarPt[IMINUSONEJMINUSONEK].Edge_Points[5] = NbPoint IsoMap_local; | |||
GridVoxelVarPt[IMINUSONEJMINUSONEK].NbEdgePoint += 1; | GridVoxelVarPt[IMINUSONEJMINUSONEK].NbEdgePoint += 1; | |||
NbPointIsoMap_local++; | NbPointIsoMap_local++; | |||
} | } | |||
} | } | |||
skipping to change at line 2418 | skipping to change at line 2419 | |||
} | } | |||
/// Now we have to compute the Grid's limits... | /// Now we have to compute the Grid's limits... | |||
/// The code is quite big but this is much more easy to compute | /// The code is quite big but this is much more easy to compute | |||
/// 1) First case : i =0; | /// 1) First case : i =0; | |||
i =0; | i =0; | |||
for(j=0; j < masterthread->XYZgrid; j++) | for(j=0; j < masterthread->XYZgrid; j++) | |||
{ | { | |||
J = j*maxgridval; | J_pl = j*maxgridval; | |||
for(k=0; k < masterthread->XYZgrid; k++) | for(k=0; k < masterthread->XYZgrid; k++) | |||
{ | { | |||
JK = J +k; | JK_pl = J_pl +k; | |||
IsoValue_1 = Results[JK]; | IsoValue_1 = Results[JK_pl]; | |||
IsoValue_2 = Results[maxgrscalemaxgr+JK]; | IsoValue_2 = Results[maxgrscalemaxgr+JK_pl]; | |||
if(IsoValue_1 * IsoValue_2 <= 0 && (rapport=IsoValue_2 - IsoValue_1) != 0.0) | if(IsoValue_1 * IsoValue_2 <= 0 && (rapport=IsoValue_2 - IsoValue_1) != 0.0) | |||
{ | { | |||
// Edge Point computation and save in IsoPointMap | // Edge Point computation and save in IsoPointMap | |||
factor = (IsoValue - IsoValue_1)/rapport; | factor = (IsoValue - IsoValue_1)/rapport; | |||
vals[0] = masterthread->xLocal2[isoindex*masterthread->GridVal+i ] - factor * masterthread->x_Step[isoindex]; | vals[0] = masterthread->xLocal2[isoindex*masterthread->GridVal+i ] - factor * masterthread->x_Step[isoindex]; | |||
vals[1] = masterthread->yLocal2[isoindex*masterthread->GridVal+j ]; | vals[1] = masterthread->yLocal2[isoindex*masterthread->GridVal+j ]; | |||
vals[2] = masterthread->zLocal2[isoindex*masterthread->GridVal+k ]; | vals[2] = masterthread->zLocal2[isoindex*masterthread->GridVal+k ]; | |||
for(int iter=0; iter<7; iter++) | for(int iter=0; iter<7; iter++) | |||
NormVertexTabVector.push_back(1.0); | NormVertexTabVector.push_back(1.0); | |||
NormVertexTabVector.push_back(float(vals[0])); | NormVertexTabVector.push_back(float(vals[0])); | |||
NormVertexTabVector.push_back(float(vals[1])); | NormVertexTabVector.push_back(float(vals[1])); | |||
NormVertexTabVector.push_back(float(vals[2])); | NormVertexTabVector.push_back(float(vals[2])); | |||
// save The reference to this point | // save The reference to this point | |||
GridVoxelVarPt[JK].Edge_Points[0] = NbPointIsoMap_local; | GridVoxelVarPt[JK_pl].Edge_Points[0] = NbPointIsoMap_local; | |||
GridVoxelVarPt[JK].NbEdgePoint += 1; | GridVoxelVarPt[JK_pl].NbEdgePoint += 1; | |||
// The same Point is used in three other Voxels | // The same Point is used in three other Voxels | |||
if( j != 0) | if( j != 0) | |||
{ | { | |||
GridVoxelVarPt[JK-maxgridval].Edge_Points[4] = NbPointIsoMap | GridVoxelVarPt[JK_pl-maxgridval].Edge_Points[4] = NbPointIso | |||
_local; | Map_local; | |||
GridVoxelVarPt[JK-maxgridval].NbEdgePoint += 1; | GridVoxelVarPt[JK_pl-maxgridval].NbEdgePoint += 1; | |||
} | } | |||
if ( k != 0 ) | if ( k != 0 ) | |||
{ | { | |||
GridVoxelVarPt[JK-1].Edge_Points[2] = NbPointIsoMap_local; | GridVoxelVarPt[JK_pl-1].Edge_Points[2] = NbPointIsoMap_loc | |||
GridVoxelVarPt[JK-1].NbEdgePoint += 1; | al; | |||
GridVoxelVarPt[JK_pl-1].NbEdgePoint += 1; | ||||
} | } | |||
if( j != 0 && k != 0) | if( j != 0 && k != 0) | |||
{ | { | |||
GridVoxelVarPt[JK-maxgridval-1].Edge_Points[6] = NbPointIsoM | GridVoxelVarPt[JK_pl-maxgridval-1].Edge_Points[6] = NbPointI | |||
ap_local; | soMap_local; | |||
GridVoxelVarPt[JK-maxgridval-1].NbEdgePoint += 1; | GridVoxelVarPt[JK_pl-maxgridval-1].NbEdgePoint += 1; | |||
} | } | |||
NbPointIsoMap_local++; | NbPointIsoMap_local++; | |||
} | } | |||
// Second Case P(0)(j+1)(k) | // Second Case P(0)(j+1)(k) | |||
if ( j != (masterthread->XYZgrid -1)) | if ( j != (masterthread->XYZgrid -1)) | |||
{ | { | |||
IsoValue_2 = Results[JK+maxgridval]; | IsoValue_2 = Results[JK_pl+maxgridval]; | |||
// Edge Point computation and save in IsoPointMap | // Edge Point computation and save in IsoPointMap | |||
if(IsoValue_1 * IsoValue_2 <= 0 && (rapport=IsoValue_2 - IsoValu e_1) != 0.0) | if(IsoValue_1 * IsoValue_2 <= 0 && (rapport=IsoValue_2 - IsoValu e_1) != 0.0) | |||
{ | { | |||
factor = (IsoValue - IsoValue_1)/rapport; | factor = (IsoValue - IsoValue_1)/rapport; | |||
vals[0] = masterthread->xLocal2[isoindex*masterthread->GridV al+i]; | vals[0] = masterthread->xLocal2[isoindex*masterthread->GridV al+i]; | |||
vals[1] = masterthread->yLocal2[isoindex*masterthread->GridV al+j] - factor *masterthread->y_Step[isoindex]; | vals[1] = masterthread->yLocal2[isoindex*masterthread->GridV al+j] - factor *masterthread->y_Step[isoindex]; | |||
vals[2] = masterthread->zLocal2[isoindex*masterthread->GridV al+k]; | vals[2] = masterthread->zLocal2[isoindex*masterthread->GridV al+k]; | |||
for(int iter=0; iter<7; iter++) | for(int iter=0; iter<7; iter++) | |||
NormVertexTabVector.push_back(1.0); | NormVertexTabVector.push_back(1.0); | |||
NormVertexTabVector.push_back(float(vals[0])); | NormVertexTabVector.push_back(float(vals[0])); | |||
NormVertexTabVector.push_back(float(vals[1])); | NormVertexTabVector.push_back(float(vals[1])); | |||
NormVertexTabVector.push_back(float(vals[2])); | NormVertexTabVector.push_back(float(vals[2])); | |||
// save The reference to this point | // save The reference to this point | |||
GridVoxelVarPt[JK].Edge_Points[8] = NbPointIsoMap_local; | GridVoxelVarPt[JK_pl].Edge_Points[8] = NbPointIsoMap_local; | |||
GridVoxelVarPt[JK].NbEdgePoint += 1; | GridVoxelVarPt[JK_pl].NbEdgePoint += 1; | |||
// The same Point is used in three other Voxels | // The same Point is used in three other Voxels | |||
if ( k != 0) | if ( k != 0) | |||
{ | { | |||
GridVoxelVarPt[JK-1].Edge_Points[11] = NbPointIsoMap_l | GridVoxelVarPt[JK_pl-1].Edge_Points[11] = NbPointIsoMa | |||
ocal; | p_local; | |||
GridVoxelVarPt[JK-1].NbEdgePoint += 1; | GridVoxelVarPt[JK_pl-1].NbEdgePoint += 1; | |||
} | } | |||
NbPointIsoMap_local++; | NbPointIsoMap_local++; | |||
} | } | |||
} /// If ( j != nb_colon -1) ... | } /// If ( j != nb_colon -1) ... | |||
// Third Case P(0)(j)(k+1) | // Third Case P(0)(j)(k+1) | |||
if ( k != (masterthread->XYZgrid-1)) | if ( k != (masterthread->XYZgrid-1)) | |||
{ | { | |||
IsoValue_2 = Results[JK+1]; | IsoValue_2 = Results[JK_pl+1]; | |||
// Edge Point computation and save in IsoPointMap | // Edge Point computation and save in IsoPointMap | |||
if(IsoValue_1 * IsoValue_2 <= 0 && (rapport=IsoValue_2 - IsoValu e_1) != 0.0) | if(IsoValue_1 * IsoValue_2 <= 0 && (rapport=IsoValue_2 - IsoValu e_1) != 0.0) | |||
{ | { | |||
factor = (IsoValue - IsoValue_1)/rapport; | factor = (IsoValue - IsoValue_1)/rapport; | |||
vals[0] = masterthread->xLocal2[isoindex*masterthread->GridV al+i]; | vals[0] = masterthread->xLocal2[isoindex*masterthread->GridV al+i]; | |||
vals[1] = masterthread->yLocal2[isoindex*masterthread->GridV al+j]; | vals[1] = masterthread->yLocal2[isoindex*masterthread->GridV al+j]; | |||
vals[2] = masterthread->zLocal2[isoindex*masterthread->GridV al+k] - factor * masterthread->z_Step[isoindex]; | vals[2] = masterthread->zLocal2[isoindex*masterthread->GridV al+k] - factor * masterthread->z_Step[isoindex]; | |||
for(int iter=0; iter<7; iter++) | for(int iter=0; iter<7; iter++) | |||
NormVertexTabVector.push_back(1.0); | NormVertexTabVector.push_back(1.0); | |||
NormVertexTabVector.push_back(float(vals[0])); | NormVertexTabVector.push_back(float(vals[0])); | |||
NormVertexTabVector.push_back(float(vals[1])); | NormVertexTabVector.push_back(float(vals[1])); | |||
NormVertexTabVector.push_back(float(vals[2])); | NormVertexTabVector.push_back(float(vals[2])); | |||
// save The reference to this point | // save The reference to this point | |||
GridVoxelVarPt[JK].Edge_Points[3] = NbPointIsoMap_local; | GridVoxelVarPt[JK_pl].Edge_Points[3] = NbPointIsoMap_local; | |||
GridVoxelVarPt[JK].NbEdgePoint += 1; | GridVoxelVarPt[JK_pl].NbEdgePoint += 1; | |||
// The same Point is used in three other Voxels | // The same Point is used in three other Voxels | |||
if ( j != 0) | if ( j != 0) | |||
{ | { | |||
GridVoxelVarPt[JK-maxgridval].Edge_Points[7] =NbPointI | GridVoxelVarPt[JK_pl-maxgridval].Edge_Points[7] =NbPoi | |||
soMap_local; | ntIsoMap_local; | |||
GridVoxelVarPt[JK-maxgridval].NbEdgePoint += 1; | GridVoxelVarPt[JK_pl-maxgridval].NbEdgePoint += 1; | |||
} | } | |||
NbPointIsoMap_local++; | NbPointIsoMap_local++; | |||
} | } | |||
} /// End of ( if ( k != nb_depth -1).... | } /// End of ( if ( k != nb_depth -1).... | |||
} | } | |||
} | } | |||
/// 2) Case i = nb_ligne-1 | /// 2) Case i = nb_ligne-1 | |||
i = masterthread->XYZgrid-1; | i = masterthread->XYZgrid-1; | |||
I = i*maxgrscalemaxgr; | I_pl = i*maxgrscalemaxgr; | |||
for(j=0; j < masterthread->XYZgrid; j++) | for(j=0; j < masterthread->XYZgrid; j++) | |||
{ | { | |||
J = I + j*maxgridval; | J_pl = I_pl + j*maxgridval; | |||
for(k=0; k < masterthread->XYZgrid; k++) | for(k=0; k < masterthread->XYZgrid; k++) | |||
{ | { | |||
JK = J + k; | JK_pl = J_pl + k; | |||
IsoValue_1 = Results[JK]; | IsoValue_1 = Results[JK_pl]; | |||
// Second Case P(i)(j+1)(k) | // Second Case P(i)(j+1)(k) | |||
if ( j != (masterthread->XYZgrid -1)) | if ( j != (masterthread->XYZgrid -1)) | |||
{ | { | |||
IsoValue_2 = Results[JK+maxgridval]; | IsoValue_2 = Results[JK_pl+maxgridval]; | |||
// Edge Point computation and save in IsoPointMap | // Edge Point computation and save in IsoPointMap | |||
if(IsoValue_1 * IsoValue_2 <= 0 && (rapport=IsoValue_2 - IsoValu e_1) != 0.0) | if(IsoValue_1 * IsoValue_2 <= 0 && (rapport=IsoValue_2 - IsoValu e_1) != 0.0) | |||
{ | { | |||
factor = (IsoValue - IsoValue_1)/rapport; | factor = (IsoValue - IsoValue_1)/rapport; | |||
vals[0] = masterthread->xLocal2[isoindex*masterthread->GridV al+i]; | vals[0] = masterthread->xLocal2[isoindex*masterthread->GridV al+i]; | |||
vals[1] = masterthread->yLocal2[isoindex*masterthread->GridV al+j] - factor *masterthread->y_Step[isoindex]; | vals[1] = masterthread->yLocal2[isoindex*masterthread->GridV al+j] - factor *masterthread->y_Step[isoindex]; | |||
vals[2] = masterthread->zLocal2[isoindex*masterthread->GridV al+k]; | vals[2] = masterthread->zLocal2[isoindex*masterthread->GridV al+k]; | |||
for(int iter=0; iter<7; iter++) | for(int iter=0; iter<7; iter++) | |||
NormVertexTabVector.push_back(1.0); | NormVertexTabVector.push_back(1.0); | |||
NormVertexTabVector.push_back(float(vals[0])); | NormVertexTabVector.push_back(float(vals[0])); | |||
NormVertexTabVector.push_back(float(vals[1])); | NormVertexTabVector.push_back(float(vals[1])); | |||
NormVertexTabVector.push_back(float(vals[2])); | NormVertexTabVector.push_back(float(vals[2])); | |||
// save The reference to this point | // save The reference to this point | |||
GridVoxelVarPt[JK].Edge_Points[8] = NbPointIsoMap_local; | GridVoxelVarPt[JK_pl].Edge_Points[8] = NbPointIsoMap_local; | |||
GridVoxelVarPt[JK].NbEdgePoint += 1; | GridVoxelVarPt[JK_pl].NbEdgePoint += 1; | |||
// The same Point is used in three other Voxels | // The same Point is used in three other Voxels | |||
if(i != 0) | if(i != 0) | |||
{ | { | |||
GridVoxelVarPt[JK-maxgrscalemaxgr].Edge_Points[9] =Nb | GridVoxelVarPt[JK_pl-maxgrscalemaxgr].Edge_Points[9] | |||
PointIsoMap_local; | =NbPointIsoMap_local; | |||
GridVoxelVarPt[JK-maxgrscalemaxgr].NbEdgePoint += 1; | GridVoxelVarPt[JK_pl-maxgrscalemaxgr].NbEdgePoint += 1; | |||
} | } | |||
if(k != 0) | if(k != 0) | |||
{ | { | |||
GridVoxelVarPt[JK-1].Edge_Points[11] = NbPointIsoMap_l | GridVoxelVarPt[JK_pl-1].Edge_Points[11] = NbPointIsoMa | |||
ocal; | p_local; | |||
GridVoxelVarPt[JK-1].NbEdgePoint += 1; | GridVoxelVarPt[JK_pl-1].NbEdgePoint += 1; | |||
} | } | |||
if(i != 0 && k != 0) | if(i != 0 && k != 0) | |||
{ | { | |||
GridVoxelVarPt[JK-maxgrscalemaxgr-1].Edge_Points[10] = N | GridVoxelVarPt[JK_pl-maxgrscalemaxgr-1].Edge_Points[10] | |||
bPointIsoMap_local; | = NbPointIsoMap_local; | |||
GridVoxelVarPt[JK-maxgrscalemaxgr-1].NbEdgePoint += 1; | GridVoxelVarPt[JK_pl-maxgrscalemaxgr-1].NbEdgePoint += 1 | |||
; | ||||
} | } | |||
NbPointIsoMap_local++; | NbPointIsoMap_local++; | |||
} | } | |||
} /// End of if (j != nb_colon -1)... | } /// End of if (j != nb_colon -1)... | |||
// Third Case P(i)(j)(k+1) | // Third Case P(i)(j)(k+1) | |||
if ( k != (masterthread->XYZgrid -1)) | if ( k != (masterthread->XYZgrid -1)) | |||
{ | { | |||
IsoValue_2 = Results[JK+1]; | IsoValue_2 = Results[JK_pl+1]; | |||
// Edge Point computation and save in IsoPointMap | // Edge Point computation and save in IsoPointMap | |||
if(IsoValue_1 * IsoValue_2 <= 0 && (rapport=IsoValue_2 - IsoValu e_1) != 0.0) | if(IsoValue_1 * IsoValue_2 <= 0 && (rapport=IsoValue_2 - IsoValu e_1) != 0.0) | |||
{ | { | |||
factor = (IsoValue - IsoValue_1)/rapport; | factor = (IsoValue - IsoValue_1)/rapport; | |||
vals[0] = masterthread->xLocal2[isoindex*masterthread->GridV al+i]; | vals[0] = masterthread->xLocal2[isoindex*masterthread->GridV al+i]; | |||
vals[1] = masterthread->yLocal2[isoindex*masterthread->GridV al+j]; | vals[1] = masterthread->yLocal2[isoindex*masterthread->GridV al+j]; | |||
vals[2] = masterthread->zLocal2[isoindex*masterthread->GridV al+k] - factor * masterthread->z_Step[isoindex]; | vals[2] = masterthread->zLocal2[isoindex*masterthread->GridV al+k] - factor * masterthread->z_Step[isoindex]; | |||
for(int iter=0; iter<7; iter++) | for(int iter=0; iter<7; iter++) | |||
NormVertexTabVector.push_back(1.0); | NormVertexTabVector.push_back(1.0); | |||
NormVertexTabVector.push_back(float(vals[0])); | NormVertexTabVector.push_back(float(vals[0])); | |||
NormVertexTabVector.push_back(float(vals[1])); | NormVertexTabVector.push_back(float(vals[1])); | |||
NormVertexTabVector.push_back(float(vals[2])); | NormVertexTabVector.push_back(float(vals[2])); | |||
// save The reference to this point | // save The reference to this point | |||
GridVoxelVarPt[JK].Edge_Points[3] = NbPointIsoMap_local; | GridVoxelVarPt[JK_pl].Edge_Points[3] = NbPointIsoMap_local; | |||
GridVoxelVarPt[JK].NbEdgePoint += 1; | GridVoxelVarPt[JK_pl].NbEdgePoint += 1; | |||
// The same Point is used in three other Voxels | // The same Point is used in three other Voxels | |||
if( i != 0) | if( i != 0) | |||
{ | { | |||
GridVoxelVarPt[JK-maxgrscalemaxgr].Edge_Points[1] = Nb | GridVoxelVarPt[JK_pl-maxgrscalemaxgr].Edge_Points[1] = | |||
PointIsoMap_local; | NbPointIsoMap_local; | |||
GridVoxelVarPt[JK-maxgrscalemaxgr].NbEdgePoint += 1; | GridVoxelVarPt[JK_pl-maxgrscalemaxgr].NbEdgePoint += 1; | |||
} | } | |||
if(j != 0) | if(j != 0) | |||
{ | { | |||
GridVoxelVarPt[JK-maxgridval].Edge_Points[7] = NbPoint | GridVoxelVarPt[JK_pl-maxgridval].Edge_Points[7] = NbPo | |||
IsoMap_local; | intIsoMap_local; | |||
GridVoxelVarPt[JK-maxgridval].NbEdgePoint += 1; | GridVoxelVarPt[JK_pl-maxgridval].NbEdgePoint += 1; | |||
} | } | |||
if( i !=0 && j != 0) | if( i !=0 && j != 0) | |||
{ | { | |||
GridVoxelVarPt[JK-maxgrscalemaxgr-maxgridval].Edge_Point | GridVoxelVarPt[JK_pl-maxgrscalemaxgr-maxgridval].Edge_Po | |||
s[5] = NbPointIsoMap_local; | ints[5] = NbPointIsoMap_local; | |||
GridVoxelVarPt[JK-maxgrscalemaxgr-maxgridval].NbEdgePoin | GridVoxelVarPt[JK_pl-maxgrscalemaxgr-maxgridval].NbEdgeP | |||
t += 1; | oint += 1; | |||
} | } | |||
NbPointIsoMap_local++; | NbPointIsoMap_local++; | |||
} | } | |||
} /// End of if ( k != nb_depth -1)... | } /// End of if ( k != nb_depth -1)... | |||
} | } | |||
} | } | |||
/// 3) Case j = 0 | /// 3) Case j = 0 | |||
skipping to change at line 3041 | skipping to change at line 3042 | |||
} | } | |||
} /// End of if( j != (nb_colon -1) )... | } /// End of if( j != (nb_colon -1) )... | |||
} | } | |||
NbPointIsoMap = NbPointIsoMap_local; | NbPointIsoMap = NbPointIsoMap_local; | |||
return 1; | return 1; | |||
} | } | |||
///+++++++++++++++++++++++++++++++++++++++++++++++++++++/// | ///+++++++++++++++++++++++++++++++++++++++++++++++++++++/// | |||
void Iso3D::SignatureComputation() | void Iso3D::SignatureComputation() | |||
{ | { | |||
uint I, J, IJK, IPLUSONEJK, | uint I_si, J_si, IJK_si, IPLUSONEJK_si, | |||
IJPLUSONEK, IPLUSONEJPLUSONEK; | IJPLUSONEK_si, IPLUSONEJPLUSONEK_si; | |||
uint maxgrscalemaxgr = masterthread->GridVal*masterthread->GridVal; | uint maxgrscalemaxgr = masterthread->GridVal*masterthread->GridVal; | |||
for(uint i=0; i < masterthread->XYZgrid; i++) | for(uint i=0; i < masterthread->XYZgrid; i++) | |||
{ | { | |||
I = i*maxgrscalemaxgr; | I_si = i*maxgrscalemaxgr; | |||
for(uint j=0; j < masterthread->XYZgrid; j++) | for(uint j=0; j < masterthread->XYZgrid; j++) | |||
{ | { | |||
J = I + j*masterthread->GridVal; | J_si = I_si + j*masterthread->GridVal; | |||
for(uint k=0; k < masterthread->XYZgrid; k++) | for(uint k=0; k < masterthread->XYZgrid; k++) | |||
{ | { | |||
IJK = J + k; | IJK_si = J_si + k; | |||
IPLUSONEJK = IJK + maxgrscalemaxgr; | IPLUSONEJK_si = IJK_si + maxgrscalemaxgr; | |||
IJPLUSONEK = IJK + masterthread->GridVal; | IJPLUSONEK_si = IJK_si + masterthread->GridVal; | |||
IPLUSONEJPLUSONEK = IPLUSONEJK + masterthread->GridVal; | IPLUSONEJPLUSONEK_si = IPLUSONEJK_si + masterthread->GridVal; | |||
if(Results[IJK] <= 0) GridVoxelVarPt[IJK].Signature +=1; | if(Results[IJK_si] <= 0) GridVoxelVarPt[IJK_si].Signature +=1; | |||
if(i != (masterthread->XYZgrid-1)) | if(i != (masterthread->XYZgrid-1)) | |||
if(Results[IPLUSONEJK] <= 0) GridVoxelVarPt[IJK].Signature + =2; | if(Results[IPLUSONEJK_si] <= 0) GridVoxelVarPt[IJK_si].Signa ture +=2; | |||
if(i != (masterthread->XYZgrid-1) && k != (masterthread->XYZgrid -1)) | if(i != (masterthread->XYZgrid-1) && k != (masterthread->XYZgrid -1)) | |||
if(Results[IPLUSONEJK+1] <= 0) GridVoxelVarPt[IJK].Signature +=4; | if(Results[IPLUSONEJK_si+1] <= 0) GridVoxelVarPt[IJK_si].Sig nature +=4; | |||
if(k != (masterthread->XYZgrid-1)) | if(k != (masterthread->XYZgrid-1)) | |||
if(Results[IJK+1] <= 0) GridVoxelVarPt[IJK].Signature +=8; | if(Results[IJK_si+1] <= 0) GridVoxelVarPt[IJK_si].Signature +=8; | |||
if(j != (masterthread->XYZgrid-1)) | if(j != (masterthread->XYZgrid-1)) | |||
if(Results[IJPLUSONEK] <= 0) GridVoxelVarPt[IJK].Signature + =16; | if(Results[IJPLUSONEK_si] <= 0) GridVoxelVarPt[IJK_si].Signa ture +=16; | |||
if(i != (masterthread->XYZgrid-1) && j != (masterthread->XYZgrid -1)) | if(i != (masterthread->XYZgrid-1) && j != (masterthread->XYZgrid -1)) | |||
if(Results[IPLUSONEJPLUSONEK] <= 0) GridVoxelVarPt[IJK].Sign ature +=32; | if(Results[IPLUSONEJPLUSONEK_si] <= 0) GridVoxelVarPt[IJK_si ].Signature +=32; | |||
if(i != (masterthread->XYZgrid-1) && j != (masterthread->XYZgrid -1) && k != (masterthread->XYZgrid-1)) | if(i != (masterthread->XYZgrid-1) && j != (masterthread->XYZgrid -1) && k != (masterthread->XYZgrid-1)) | |||
if(Results[IPLUSONEJPLUSONEK+1] <= 0) GridVoxelVarPt[IJK].Si gnature +=64; | if(Results[IPLUSONEJPLUSONEK_si+1] <= 0) GridVoxelVarPt[IJK_ si].Signature +=64; | |||
if(j != (masterthread->XYZgrid-1) && k != (masterthread->XYZgrid -1)) | if(j != (masterthread->XYZgrid-1) && k != (masterthread->XYZgrid -1)) | |||
if(Results[IJPLUSONEK+1] <= 0) GridVoxelVarPt[IJK].Signature +=128; | if(Results[IJPLUSONEK_si+1] <= 0) GridVoxelVarPt[IJK_si].Sig nature +=128; | |||
} | } | |||
} | } | |||
}// End if(Grid... | }// End if(Grid... | |||
} | } | |||
End of changes. 82 change blocks. | ||||
166 lines changed or deleted | 173 lines changed or added |