46 ProSHADE_internal_spheres::ProSHADE_sphere::ProSHADE_sphere ( proshade_unsign xDimMax, proshade_unsign yDimMax, proshade_unsign zDimMax, proshade_single xSize, proshade_single ySize, proshade_single zSize, proshade_unsign shOrder, std::vector<proshade_single>* spherePos,
bool progressiveMapping, proshade_unsign band, proshade_double* map, proshade_unsign* maxShellBand )
49 this->shellOrder = shOrder;
50 this->sphereWidth =
static_cast< proshade_single
> ( ( spherePos->at(0) + spherePos->at(1) ) / 2.0f );
51 this->sphereRadius =
static_cast< proshade_double
> ( spherePos->at(shOrder) );
54 proshade_double maxDist = 0.0;
55 if ( shOrder ==
static_cast<proshade_unsign
> ( spherePos->size() - 1 ) ) { maxDist =
static_cast<proshade_double
> ( spherePos->at(spherePos->size()-1) + ( spherePos->at(1) - spherePos->at(0) ) ); }
56 else { maxDist =
static_cast<proshade_double
> ( ( spherePos->at(shOrder) + spherePos->at(shOrder+1) ) / 2.0f ); }
59 this->maxSphereRange =
static_cast<proshade_single
> ( 2.0 * maxDist );
62 this->xDimSampling = xSize /
static_cast<proshade_single
> (xDimMax);
63 this->yDimSampling = ySize /
static_cast<proshade_single
> (yDimMax);
64 this->zDimSampling = zSize /
static_cast<proshade_single
> (zDimMax);
67 proshade_unsign maxCircumference = this->
getMaxCircumference ( xDimMax, yDimMax, zDimMax, this->maxSphereRange );
70 if ( progressiveMapping )
73 this->localAngRes = this->localBandwidth * 2;
77 this->localBandwidth = band;
78 this->localAngRes = this->localBandwidth * 2;
82 if ( *maxShellBand < this->localBandwidth ) { *maxShellBand = this->localBandwidth; }
85 this->mappedData =
new proshade_double[this->localAngRes * this->localAngRes];
89 this->mappedDataRot =
nullptr;
92 this->
mapData ( map, xDimMax, yDimMax, zDimMax );
104 delete[] this->mappedData;
106 if ( this->mappedDataRot !=
nullptr )
108 delete[] this->mappedDataRot;
124 proshade_signed xFromInd =
static_cast<proshade_signed
> ( xDimMax / 2 ) -
125 static_cast<proshade_signed
> ( (maxRange/2) / this->xDimSampling );
126 proshade_signed yFromInd =
static_cast<proshade_signed
> ( yDimMax / 2 ) -
127 static_cast<proshade_signed
> ( (maxRange/2) / this->yDimSampling );
128 proshade_signed zFromInd =
static_cast<proshade_signed
> ( zDimMax / 2 ) -
129 static_cast<proshade_signed
> ( (maxRange/2) / this->zDimSampling );
131 proshade_signed xToInd =
static_cast<proshade_signed
> ( xDimMax / 2 ) +
132 static_cast<proshade_signed
> ( (maxRange/2) / this->xDimSampling );
133 proshade_signed yToInd =
static_cast<proshade_signed
> ( yDimMax / 2 ) +
134 static_cast<proshade_signed
> ( (maxRange/2) / this->yDimSampling );
135 proshade_signed zToInd =
static_cast<proshade_signed
> ( zDimMax / 2 ) +
136 static_cast<proshade_signed
> ( (maxRange/2) / this->zDimSampling );
139 if ( xFromInd < 0 ) { xFromInd = 0; }
140 if ( yFromInd < 0 ) { yFromInd = 0; }
141 if ( zFromInd < 0 ) { zFromInd = 0; }
142 if ( xToInd >
static_cast<proshade_signed
> ( xDimMax ) ) { xToInd =
static_cast<proshade_signed
> ( xDimMax ); }
143 if ( yToInd >
static_cast<proshade_signed
> ( yDimMax ) ) { yToInd =
static_cast<proshade_signed
> ( yDimMax ); }
144 if ( zToInd >
static_cast<proshade_signed
> ( zDimMax ) ) { zToInd =
static_cast<proshade_signed
> ( zDimMax ); }
147 proshade_unsign xDimSZ =
static_cast< proshade_unsign
> ( xToInd - xFromInd );
148 proshade_unsign yDimSZ =
static_cast< proshade_unsign
> ( yToInd - yFromInd );
149 proshade_unsign zDimSZ =
static_cast< proshade_unsign
> ( zToInd - zFromInd );
152 if ( ( xDimSZ == 0 ) && ( yDimSZ == 0 ) && ( zDimSZ == 0 ) ) { xDimSZ = 1; yDimSZ = 1; zDimSZ = 1; }
155 std::vector<proshade_unsign> dimSizes;
159 std::sort ( dimSizes.begin(), dimSizes.end() );
160 proshade_unsign maxDim = dimSizes.at(2);
161 proshade_unsign midDim = dimSizes.at(1);
164 return ( maxDim + midDim );
181 proshade_double x, y, z, xRelative, yRelative, zRelative;
182 proshade_signed xBottom, yBottom, zBottom, xTop, yTop, zTop;
183 std::vector<proshade_double> lonCO ( this->localAngRes + 1 );
184 std::vector<proshade_double> latCO ( this->localAngRes + 1 );
185 std::vector<proshade_double> c000 = std::vector<proshade_double> ( 4 );
186 std::vector<proshade_double> c001 = std::vector<proshade_double> ( 4 );
187 std::vector<proshade_double> c010 = std::vector<proshade_double> ( 4 );
188 std::vector<proshade_double> c011 = std::vector<proshade_double> ( 4 );
189 std::vector<proshade_double> c100 = std::vector<proshade_double> ( 4 );
190 std::vector<proshade_double> c101 = std::vector<proshade_double> ( 4 );
191 std::vector<proshade_double> c110 = std::vector<proshade_double> ( 4 );
192 std::vector<proshade_double> c111 = std::vector<proshade_double> ( 4 );
193 std::vector<proshade_double> c00 = std::vector<proshade_double> ( 4 );
194 std::vector<proshade_double> c01 = std::vector<proshade_double> ( 4 );
195 std::vector<proshade_double> c10 = std::vector<proshade_double> ( 4 );
196 std::vector<proshade_double> c11 = std::vector<proshade_double> ( 4 );
197 std::vector<proshade_double> c0 = std::vector<proshade_double> ( 4 );
198 std::vector<proshade_double> c1 = std::vector<proshade_double> ( 4 );
201 this->getLongitudeCutoffs ( &lonCO );
202 this->getLattitudeCutoffs ( &latCO );
205 for (
unsigned int thIt = 0; thIt < this->localAngRes; thIt++ )
207 for (
unsigned int phIt = 0; phIt < this->localAngRes; phIt++ )
210 this->getInterpolationXYZ ( &x, &y, &z, thIt, &lonCO, phIt, &latCO );
213 this->getXYZTopBottoms ( xDimMax, yDimMax, zDimMax, x, y, z, &xBottom, &yBottom, &zBottom, &xTop, &yTop, &zTop );
216 if ( !getMapPoint ( map, xDimMax, yDimMax, zDimMax, xBottom, yBottom, zBottom, &c000 ) ) { this->mappedData[phIt * this->localAngRes + thIt] = 0.0;
continue; }
217 if ( !getMapPoint ( map, xDimMax, yDimMax, zDimMax, xBottom, yBottom, zTop , &c001 ) ) { this->mappedData[phIt * this->localAngRes + thIt] = 0.0;
continue; }
218 if ( !getMapPoint ( map, xDimMax, yDimMax, zDimMax, xBottom, yTop , zBottom, &c010 ) ) { this->mappedData[phIt * this->localAngRes + thIt] = 0.0;
continue; }
219 if ( !getMapPoint ( map, xDimMax, yDimMax, zDimMax, xBottom, yTop , zTop , &c011 ) ) { this->mappedData[phIt * this->localAngRes + thIt] = 0.0;
continue; }
220 if ( !getMapPoint ( map, xDimMax, yDimMax, zDimMax, xTop , yBottom, zBottom, &c100 ) ) { this->mappedData[phIt * this->localAngRes + thIt] = 0.0;
continue; }
221 if ( !getMapPoint ( map, xDimMax, yDimMax, zDimMax, xTop , yBottom, zTop , &c101 ) ) { this->mappedData[phIt * this->localAngRes + thIt] = 0.0;
continue; }
222 if ( !getMapPoint ( map, xDimMax, yDimMax, zDimMax, xTop , yTop , zBottom, &c110 ) ) { this->mappedData[phIt * this->localAngRes + thIt] = 0.0;
continue; }
223 if ( !getMapPoint ( map, xDimMax, yDimMax, zDimMax, xTop , yTop , zTop , &c111 ) ) { this->mappedData[phIt * this->localAngRes + thIt] = 0.0;
continue; }
226 xRelative = ( x - (
static_cast< proshade_double
> ( xBottom -
static_cast<proshade_signed
> ( ( ( xDimMax ) / 2 ) ) ) *
static_cast< proshade_double
> ( this->xDimSampling ) ) ) /
static_cast< proshade_double
> ( this->xDimSampling );
227 this->interpolateAlongFirst ( c000, c001, c010, c011, c100, c101, c110, c111, &c00, &c01, &c10, &c11, xRelative );
230 yRelative = ( y - (
static_cast< proshade_double
> ( yBottom -
static_cast<proshade_signed
> ( ( ( yDimMax ) / 2 ) ) ) *
static_cast< proshade_double
> ( this->yDimSampling ) ) ) /
static_cast< proshade_double
> ( this->yDimSampling );
231 this->interpolateAlongSecond ( c00, c01, c10, c11, &c0, &c1, yRelative );
234 zRelative = ( z - (
static_cast< proshade_double
> ( zBottom -
static_cast<proshade_signed
> ( ( ( zDimMax ) / 2 ) ) ) *
static_cast< proshade_double
> ( this->zDimSampling ) ) ) /
static_cast< proshade_double
> ( this->zDimSampling );
235 this->mappedData[phIt * this->localAngRes + thIt] = ( c0.at(3) * ( 1.0 - zRelative ) ) + ( c1.at(3) * zRelative );
263 proshade_signed posIter = zPos +
static_cast<proshade_signed
> ( zDimMax ) * ( yPos +
static_cast<proshade_signed
> ( yDimMax ) * xPos );
266 if ( ( xPos < 0 ) || ( xPos >=
static_cast<proshade_signed
> ( xDimMax ) ) ) {
return (
false ); }
267 if ( ( yPos < 0 ) || ( yPos >=
static_cast<proshade_signed
> ( yDimMax ) ) ) {
return (
false ); }
268 if ( ( zPos < 0 ) || ( zPos >=
static_cast<proshade_signed
> ( zDimMax ) ) ) {
return (
false ); }
271 interpVec->at(0) =
static_cast<proshade_double
> ( xPos ) *
static_cast<proshade_double
> ( this->xDimSampling );
272 interpVec->at(1) =
static_cast<proshade_double
> ( yPos ) *
static_cast<proshade_double
> ( this->yDimSampling );
273 interpVec->at(2) =
static_cast<proshade_double
> ( zPos ) *
static_cast<proshade_double
> ( this->zDimSampling );
274 interpVec->at(3) = map[posIter];
290 for ( proshade_unsign iter = 0; iter <= this->localAngRes; iter++ )
292 lonCO->at(iter) =
static_cast<proshade_double
> ( iter ) *
293 ( (
static_cast<proshade_double
> ( M_PI ) * 2.0 ) /
static_cast<proshade_double
> ( this->localAngRes ) ) -
294 (
static_cast<proshade_double
> ( M_PI ) );
311 for ( proshade_unsign iter = 0; iter <= this->localAngRes; iter++ )
313 latCO->at(iter) = (
static_cast<proshade_double
> ( iter ) *
314 (
static_cast<proshade_double
> ( M_PI ) /
static_cast<proshade_double
> ( this->localAngRes ) ) -
315 (
static_cast<proshade_double
> ( M_PI ) / 2.0 ) );
339 *x = this->sphereRadius * std::cos ( ( lonCO->at(
static_cast<proshade_unsign
> ( thetaIt ) ) + lonCO->at(
static_cast<proshade_unsign
> ( thetaIt+1 ) ) ) / 2.0 ) *
340 std::cos ( ( latCO->at(
static_cast<proshade_unsign
> ( phiIt ) ) + latCO->at(
static_cast<proshade_unsign
> ( phiIt+1 ) ) ) / 2.0 );
341 *y = this->sphereRadius * std::sin ( ( lonCO->at(
static_cast<proshade_unsign
> ( thetaIt ) ) + lonCO->at(
static_cast<proshade_unsign
> ( thetaIt+1 ) ) ) / 2.0 ) *
342 std::cos ( ( latCO->at(
static_cast<proshade_unsign
> ( phiIt ) ) + latCO->at(
static_cast<proshade_unsign
> ( phiIt+1 ) ) ) / 2.0 );
343 *z = this->sphereRadius * std::sin ( ( latCO->at(
static_cast<proshade_unsign
> ( phiIt ) ) + latCO->at(
static_cast<proshade_unsign
> ( phiIt+1 ) ) ) / 2.0 );
367 void ProSHADE_internal_spheres::ProSHADE_sphere::getXYZTopBottoms ( proshade_unsign xDimMax, proshade_unsign yDimMax, proshade_unsign zDimMax, proshade_double x, proshade_double y, proshade_double z, proshade_signed* xBottom, proshade_signed* yBottom, proshade_signed* zBottom, proshade_signed* xTop, proshade_signed* yTop, proshade_signed* zTop )
370 *xBottom =
static_cast< proshade_signed
> ( std::floor ( ( x /
static_cast< proshade_double
> ( this->xDimSampling ) ) ) + (
static_cast< proshade_double
> ( xDimMax ) / 2.0 ) );
371 *yBottom =
static_cast< proshade_signed
> ( std::floor ( ( y /
static_cast< proshade_double
> ( this->yDimSampling ) ) ) + (
static_cast< proshade_double
> ( yDimMax ) / 2.0 ) );
372 *zBottom =
static_cast< proshade_signed
> ( std::floor ( ( z /
static_cast< proshade_double
> ( this->zDimSampling ) ) ) + (
static_cast< proshade_double
> ( zDimMax ) / 2.0 ) );
374 *xTop = *xBottom + 1;
375 *yTop = *yBottom + 1;
376 *zTop = *zBottom + 1;
393 return ( this->localBandwidth );
406 return ( this->localAngRes );
419 return ( this->mappedData );
442 void ProSHADE_internal_spheres::ProSHADE_sphere::interpolateAlongFirst ( std::vector<proshade_double> c000, std::vector<proshade_double> c001, std::vector<proshade_double> c010, std::vector<proshade_double> c011, std::vector<proshade_double> c100, std::vector<proshade_double> c101, std::vector<proshade_double> c110, std::vector<proshade_double> c111, std::vector<proshade_double>* c00, std::vector<proshade_double>* c01, std::vector<proshade_double>* c10, std::vector<proshade_double>* c11, proshade_double xd )
445 c00->at(0) = (
static_cast< proshade_double
> ( this->xDimSampling ) * xd ) + c000.at(0);
446 c00->at(1) = c000.at(1);
447 c00->at(2) = c000.at(2);
448 c00->at(3) = ( c000.at(3) * ( 1.0 - xd ) ) + ( c100.at(3) * xd );
451 c01->at(0) = (
static_cast< proshade_double
> ( this->xDimSampling ) * xd ) + c001.at(0);
452 c01->at(1) = c001.at(1);
453 c01->at(2) = c001.at(2);
454 c01->at(3) = ( c001.at(3) * ( 1.0 - xd ) ) + ( c101.at(3) * xd );
457 c10->at(0) = (
static_cast< proshade_double
> ( this->xDimSampling ) * xd ) + c010.at(0);
458 c10->at(1) = c010.at(1);
459 c10->at(2) = c010.at(2);
460 c10->at(3) = ( c010.at(3) * ( 1.0 - xd ) ) + ( c110.at(3) * xd );
463 c11->at(0) = (
static_cast< proshade_double
> ( this->xDimSampling ) * xd ) + c011.at(0);
464 c11->at(1) = c011.at(1);
465 c11->at(2) = c011.at(2);
466 c11->at(3) = ( c011.at(3) * ( 1.0 - xd ) ) + ( c111.at(3) * xd );
491 c0->at(0) = c00.at(0);
492 c0->at(1) = (
static_cast< proshade_double
> ( this->yDimSampling ) * yd ) + c00.at(1);
493 c0->at(2) = c00.at(2);
494 c0->at(3) = ( c00.at(3) * ( 1.0 - yd ) ) + ( c10.at(3) * yd );
497 c1->at(0) = c01.at(0);
498 c1->at(1) = (
static_cast< proshade_double
> ( this->yDimSampling ) * yd ) + c01.at(1);
499 c1->at(2) = c01.at(2);
500 c1->at(3) = ( c01.at(3) * ( 1.0 - yd ) ) + ( c11.at(3) * yd );
518 if (
static_cast<proshade_unsign
> ( std::ceil ( circumference / 2 ) ) % 2 == 0 )
520 return (
static_cast<proshade_unsign
> ( std::ceil ( circumference / 2 ) ) );
524 return (
static_cast<proshade_unsign
> ( std::ceil ( circumference / 2 ) ) + 1 );
540 proshade_single ret = resolution / 2.0f;
543 while ( std::floor ( maxMapRange / ret ) < 10 )
564 proshade_double sphereDistanceAsFractionOfTotal =
static_cast<proshade_double
> ( sphereDist / ( maxMapRange / 2.0f ) );
565 proshade_unsign ret = 0;
568 for ( proshade_unsign iter = 2; iter < static_cast<proshade_unsign> ( 10000 ); iter++ )
570 if ( ProSHADE_internal_precomputedVals::glIntMaxDists[iter] >= sphereDistanceAsFractionOfTotal )
590 return ( this->sphereRadius );
599 this->mappedDataRot =
nullptr;
600 this->mappedDataRot =
new proshade_double[this->localAngRes * this->localAngRes];
616 this->mappedDataRot[pos] = value;
630 return ( this->mappedDataRot[pos] );
649 this->angularDim = dim;
650 this->radiusMin = this->radius - ( radRange / 2.0 );
651 this->radiusMax = this->radius + ( radRange / 2.0 );
652 this->representedAngle = repAng;
653 this->sphereNumber = sphNo;
656 this->axesValues =
new proshade_double[dim*dim];
660 for ( proshade_unsign iter = 0; iter < ( dim * dim ); iter++ ) { this->axesValues[iter] = 0.0; }
671 if ( this->axesValues !=
nullptr )
673 delete[] this->axesValues;
684 return ( this->radius );
694 return ( this->radiusMax );
705 return ( this->angularDim );
716 return ( this->radiusMin );
727 return ( this->representedAngle );
738 return ( this->sphereNumber );
749 return ( this->peaks );
765 proshade_double lonSampling = ( M_PI ) /
static_cast< proshade_double
> ( this->angularDim );
766 proshade_double latSampling = ( M_PI * 2.0 ) /
static_cast< proshade_double
> ( this->angularDim );
768 proshade_double lat, lon, cX, cY, cZ, c000, c001, c010, c011, c100, c101, c110, c111, c00, c01, c10, c11, c0, c1, xRelative, yRelative, zRelative, eulerAlpha, eulerBeta, eulerGamma, mapX, mapY, mapZ;
769 proshade_signed xBottom, xTop, yBottom, yTop, zBottom, zTop, mapIndex;
772 for ( proshade_signed lonIt = 0; lonIt < static_cast<proshade_signed> ( this->angularDim ); lonIt++ )
774 for ( proshade_signed latIt = 0; latIt < static_cast<proshade_signed> ( this->angularDim ); latIt++ )
777 lon =
static_cast<proshade_double
> ( lonIt ) * lonSampling;
778 lat =
static_cast<proshade_double
> ( latIt ) * latSampling;
779 cX = 1.0 * std::sin ( lon ) * std::cos ( lat );
780 cY = 1.0 * std::sin ( lon ) * std::sin ( lat );
781 cZ = 1.0 * std::cos ( lon );
790 xBottom =
static_cast< proshade_signed
> ( std::floor ( mapX ) );
if ( xBottom < 0 ) { xBottom += this->angularDim; }
if ( xBottom >=
static_cast<proshade_signed
> ( this->angularDim ) ) { xBottom -=
static_cast<proshade_signed
> ( this->angularDim ); }
791 yBottom =
static_cast< proshade_signed
> ( std::floor ( mapY ) );
if ( yBottom < 0 ) { yBottom += this->angularDim; }
if ( yBottom >=
static_cast<proshade_signed
> ( this->angularDim ) ) { yBottom -=
static_cast<proshade_signed
> ( this->angularDim ); }
792 zBottom =
static_cast< proshade_signed
> ( std::floor ( mapZ ) );
if ( zBottom < 0 ) { zBottom += this->angularDim; }
if ( zBottom >=
static_cast<proshade_signed
> ( this->angularDim ) ) { zBottom -=
static_cast<proshade_signed
> ( this->angularDim ); }
793 xTop =
static_cast< proshade_signed
> ( std::ceil ( mapX ) );
if ( xTop < 0 ) { xTop += this->angularDim; }
if ( xTop >=
static_cast<proshade_signed
> ( this->angularDim ) ) { xTop -=
static_cast<proshade_signed
> ( this->angularDim ); }
794 yTop =
static_cast< proshade_signed
> ( std::ceil ( mapY ) );
if ( yTop < 0 ) { yTop += this->angularDim; }
if ( yTop >=
static_cast<proshade_signed
> ( this->angularDim ) ) { yTop -=
static_cast<proshade_signed
> ( this->angularDim ); }
795 zTop =
static_cast< proshade_signed
> ( std::ceil ( mapZ ) );
if ( zTop < 0 ) { zTop += this->angularDim; }
if ( zTop >=
static_cast<proshade_signed
> ( this->angularDim ) ) { zTop -=
static_cast<proshade_signed
> ( this->angularDim ); }
798 mapIndex = zBottom +
static_cast< proshade_signed
> ( this->angularDim ) * ( yBottom +
static_cast< proshade_signed
> ( this->angularDim ) * xBottom );
799 c000 = pow( rotFun[mapIndex][0], 2.0 ) + pow( rotFun[mapIndex][1], 2.0 );
802 mapIndex = zTop +
static_cast< proshade_signed
> ( this->angularDim ) * ( yBottom +
static_cast< proshade_signed
> ( this->angularDim ) * xBottom );
803 c001 = pow( rotFun[mapIndex][0], 2.0 ) + pow( rotFun[mapIndex][1], 2.0 );
806 mapIndex = zBottom +
static_cast< proshade_signed
> ( this->angularDim ) * ( yTop +
static_cast< proshade_signed
> ( this->angularDim ) * xBottom );
807 c010 = pow( rotFun[mapIndex][0], 2.0 ) + pow( rotFun[mapIndex][1], 2.0 );
810 mapIndex = zTop +
static_cast< proshade_signed
> ( this->angularDim ) * ( yTop +
static_cast< proshade_signed
> ( this->angularDim ) * xBottom );
811 c011 = pow( rotFun[mapIndex][0], 2.0 ) + pow( rotFun[mapIndex][1], 2.0 );
814 mapIndex = zBottom +
static_cast< proshade_signed
> ( this->angularDim ) * ( yBottom +
static_cast< proshade_signed
> ( this->angularDim ) * xTop );
815 c100 = pow( rotFun[mapIndex][0], 2.0 ) + pow( rotFun[mapIndex][1], 2.0 );
818 mapIndex = zTop +
static_cast< proshade_signed
> ( this->angularDim ) * ( yBottom +
static_cast< proshade_signed
> ( this->angularDim ) * xTop );
819 c101 = pow( rotFun[mapIndex][0], 2.0 ) + pow( rotFun[mapIndex][1], 2.0 );
822 mapIndex = zBottom +
static_cast< proshade_signed
> ( this->angularDim ) * ( yTop +
static_cast< proshade_signed
> ( this->angularDim ) * xTop );
823 c110 = pow( rotFun[mapIndex][0], 2.0 ) + pow( rotFun[mapIndex][1], 2.0 );
826 mapIndex = zTop +
static_cast< proshade_signed
> ( this->angularDim ) * ( yTop +
static_cast< proshade_signed
> ( this->angularDim ) * xTop );
827 c111 = pow( rotFun[mapIndex][0], 2.0 ) + pow( rotFun[mapIndex][1], 2.0 );
830 xRelative = mapX - std::floor( mapX );
831 c00 = ( c000 * ( 1.0 - xRelative ) ) + ( c100 * xRelative );
832 c01 = ( c001 * ( 1.0 - xRelative ) ) + ( c101 * xRelative );
833 c10 = ( c010 * ( 1.0 - xRelative ) ) + ( c110 * xRelative );
834 c11 = ( c011 * ( 1.0 - xRelative ) ) + ( c111 * xRelative );
837 yRelative = mapY - std::floor( mapY );
838 c0 = ( c00 * ( 1.0 - yRelative ) ) + ( c10 * yRelative );
839 c1 = ( c01 * ( 1.0 - yRelative ) ) + ( c11 * yRelative );
842 zRelative = mapZ - std::floor( mapZ );
845 mapIndex = lonIt + ( latIt *
static_cast< proshade_signed
> ( this->angularDim ) );
846 this->axesValues[mapIndex] = ( c0 * ( 1.0 - zRelative ) ) + ( c1 * zRelative );
864 return ( this->axesValues[longitude + ( lattitude *
static_cast<proshade_unsign
> ( this->angularDim ) )] );
878 proshade_double c00, c01, c10, c11, c0, c1, latRelative, lonRelative;
879 proshade_signed latTop, latBottom, lonTop, lonBottom, gridIndex;
882 latBottom =
static_cast< proshade_signed
> ( std::floor ( lattitude ) );
if ( latBottom < 0 ) { latBottom += this->angularDim; }
if ( latBottom >=
static_cast<proshade_signed
> ( this->angularDim ) ) { latBottom -= this->angularDim; }
883 lonBottom =
static_cast< proshade_signed
> ( std::floor ( longitude ) );
if ( lonBottom < 0 ) { lonBottom += this->angularDim; }
if ( lonBottom >=
static_cast<proshade_signed
> ( this->angularDim ) ) { lonBottom -= this->angularDim; }
884 latTop =
static_cast< proshade_signed
> ( std::ceil ( lattitude ) );
if ( latTop < 0 ) { latTop += this->angularDim; }
if ( latTop >=
static_cast<proshade_signed
> ( this->angularDim ) ) { latTop -= this->angularDim; }
885 lonTop =
static_cast< proshade_signed
> ( std::ceil ( longitude ) );
if ( lonTop < 0 ) { lonTop += this->angularDim; }
if ( lonTop >=
static_cast<proshade_signed
> ( this->angularDim ) ) { lonTop -= this->angularDim; }
888 gridIndex = lonBottom + ( latBottom *
static_cast< proshade_signed
> ( this->angularDim ) );
889 c00 = this->axesValues[gridIndex];
891 gridIndex = lonBottom + ( latTop *
static_cast< proshade_signed
> ( this->angularDim ) );
892 c01 = this->axesValues[gridIndex];
894 gridIndex = lonTop + ( latBottom *
static_cast< proshade_signed
> ( this->angularDim ) );
895 c10 = this->axesValues[gridIndex];
897 gridIndex = lonTop + ( latTop *
static_cast< proshade_signed
> ( this->angularDim ) );
898 c11 = this->axesValues[gridIndex];
901 lonRelative = longitude - std::floor( longitude );
902 c0 = ( c00 * ( 1.0 - lonRelative ) ) + ( c10 * lonRelative );
903 c1 = ( c01 * ( 1.0 - lonRelative ) ) + ( c11 * lonRelative );
906 latRelative = lattitude - std::floor ( lattitude );
907 proshade_double res = ( c0 * ( 1.0 - latRelative ) ) + ( c1 * latRelative );
923 std::vector< std::vector< proshade_double > > ret ( this->angularDim );
924 std::vector< proshade_double > retHlp ( this->angularDim, 0.0 );
927 for (
size_t lonIt = 0; lonIt < this->angularDim; lonIt++ )
929 for (
size_t latIt = 0; latIt < this->angularDim; latIt++ )
931 retHlp.at(latIt) = this->getSphereLatLonPosition (
static_cast< proshade_unsign
> ( latIt ),
static_cast< proshade_unsign
> ( lonIt ) );
934 ret.at(lonIt) = retHlp;
952 proshade_double currentHeight;
953 proshade_signed nbLat, nbLon;
957 for ( proshade_signed latIt = 0; latIt < static_cast<proshade_signed> ( this->angularDim ); latIt++ )
959 for ( proshade_signed lonIt = 0; lonIt < static_cast<proshade_signed> ( this->angularDim ); lonIt++ )
962 currentHeight = this->getSphereLatLonPosition (
static_cast< proshade_unsign
> ( latIt ),
static_cast< proshade_unsign
> ( lonIt ) );
966 for ( proshade_signed latRound = -noSmNeighbours; latRound <= noSmNeighbours; latRound++ )
968 for ( proshade_signed lonRound = -noSmNeighbours; lonRound <= noSmNeighbours; lonRound++ )
971 if ( latRound == 0 && lonRound == 0 ) {
continue; }
974 nbLat = latIt + latRound;
975 nbLon = lonIt + lonRound;
976 if ( nbLat < 0 ) { nbLat += this->angularDim; }
if ( nbLat >=
static_cast<proshade_signed
> ( this->angularDim ) ) { nbLat -= this->angularDim; }
977 if ( nbLon < 0 ) { nbLon += this->angularDim; }
if ( nbLon >=
static_cast<proshade_signed
> ( this->angularDim ) ) { nbLon -= this->angularDim; }
980 if ( this->getSphereLatLonPosition (
static_cast< proshade_unsign
> ( nbLat ),
static_cast< proshade_unsign
> ( nbLon ) ) > currentHeight ) { isPeak =
false;
break; }
983 if ( !isPeak ) {
break; }
989 this->peaks.emplace_back ( std::pair<proshade_unsign,proshade_unsign> ( latIt, lonIt ) );
1014 proshade_double curHeight;
1015 std::vector< proshade_unsign > dels ( 0,
static_cast< proshade_unsign
> ( this->peaks.size() ) );
1018 for ( proshade_unsign peakIt = 0; peakIt < static_cast<proshade_unsign> ( this->peaks.size() ); peakIt++ )
1021 curHeight = this->getSphereLatLonPosition ( this->peaks.at(peakIt).first, this->peaks.at(peakIt).second );
1024 if ( curHeight < peakThres )
1031 std::sort ( dels.begin(), dels.end(), std::greater <proshade_unsign>() );
1034 for ( proshade_unsign delIt = 0; delIt < static_cast< proshade_unsign > ( dels.size() ); delIt++ )
1036 this->peaks.erase ( this->peaks.begin() +
static_cast< long int > ( dels.at(delIt) ) );
1057 this->dimension = angDim;
1058 this->lonSampling = ( M_PI ) /
static_cast<proshade_double
> ( this->dimension );
1059 this->latSampling = ( M_PI * 2.0 ) /
static_cast<proshade_double
> ( this->dimension );
1062 this->latFrom =
static_cast<proshade_double
> ( lat ) * this->latSampling;
1063 this->latTo =
static_cast<proshade_double
> ( lat ) * this->latSampling;
1064 this->lonFrom =
static_cast<proshade_double
> ( lon ) * this->lonSampling;
1065 this->lonTo =
static_cast<proshade_double
> ( lon ) * this->lonSampling;
1066 this->latFromInds = lat;
1067 this->latToInds = lat;
1068 this->lonFromInds = lon;
1069 this->lonToInds = lon;
1073 this->latMinLonMinXYZ =
new proshade_double[3];
1074 this->latMaxLonMinXYZ =
new proshade_double[3];
1075 this->latMinLonMaxXYZ =
new proshade_double[3];
1076 this->latMaxLonMaxXYZ =
new proshade_double[3];
1083 this->computeCornerPositions ( );
1096 delete[] this->latMinLonMinXYZ;
1097 delete[] this->latMaxLonMinXYZ;
1098 delete[] this->latMinLonMaxXYZ;
1099 delete[] this->latMaxLonMaxXYZ;
1107 this->latMinLonMinXYZ[0] = 1.0 * std::sin ( this->lonFrom ) * std::cos ( this->latFrom );
1108 this->latMinLonMinXYZ[1] = 1.0 * std::sin ( this->lonFrom ) * std::sin ( this->latFrom );
1109 this->latMinLonMinXYZ[2] = 1.0 * std::cos ( this->lonFrom );
1111 this->latMaxLonMinXYZ[0] = 1.0 * std::sin ( this->lonFrom ) * std::cos ( this->latTo );
1112 this->latMaxLonMinXYZ[1] = 1.0 * std::sin ( this->lonFrom ) * std::sin ( this->latTo );
1113 this->latMaxLonMinXYZ[2] = 1.0 * std::cos ( this->lonFrom );
1115 this->latMinLonMaxXYZ[0] = 1.0 * std::sin ( this->lonTo ) * std::cos ( this->latFrom );
1116 this->latMinLonMaxXYZ[1] = 1.0 * std::sin ( this->lonTo ) * std::sin ( this->latFrom );
1117 this->latMinLonMaxXYZ[2] = 1.0 * std::cos ( this->lonTo );
1119 this->latMaxLonMaxXYZ[0] = 1.0 * std::sin ( this->lonTo ) * std::cos ( this->latTo );
1120 this->latMaxLonMaxXYZ[1] = 1.0 * std::sin ( this->lonTo ) * std::sin ( this->latTo );
1121 this->latMaxLonMaxXYZ[2] = 1.0 * std::cos ( this->lonTo );
1137 proshade_signed smallerAngul = newAngul -
static_cast< proshade_signed
> ( this->dimension );
1138 proshade_signed largerAngul = newAngul +
static_cast< proshade_signed
> ( this->dimension );
1141 proshade_signed ret = std::min ( std::abs ( currentAngul - newAngul ), std::min ( std::abs ( currentAngul - smallerAngul ), std::abs ( currentAngul - largerAngul ) ) );
1166 bool peakAdded =
false;
1167 std::stringstream hlpSS;
1168 std::stringstream hlpSS2;
1171 proshade_double xPos = 1.0 * std::sin ( lon * this->lonSampling ) * std::cos ( lat * this->latSampling );
1172 proshade_double yPos = 1.0 * std::sin ( lon * this->lonSampling ) * std::sin ( lat * this->latSampling );
1173 proshade_double zPos = 1.0 * std::cos ( lon * this->lonSampling );
1174 hlpSS2 <<
"Peak " << xPos <<
" ; " << yPos <<
" ; " << zPos <<
" is close enough to group with corner ";
1177 if (
ProSHADE_internal_maths::vectorOrientationSimilaritySameDirection ( xPos, yPos, zPos, this->latMaxLonMinXYZ[0], this->latMaxLonMinXYZ[1], this->latMaxLonMinXYZ[2], cosTol ) && !peakAdded ) { peakAdded =
true; hlpSS2 << this->latMaxLonMinXYZ[0] <<
" ; " << this->latMaxLonMinXYZ[1] <<
" ; " << this->latMaxLonMinXYZ[2]; }
1178 if (
ProSHADE_internal_maths::vectorOrientationSimilaritySameDirection ( xPos, yPos, zPos, this->latMinLonMaxXYZ[0], this->latMinLonMaxXYZ[1], this->latMinLonMaxXYZ[2], cosTol ) && !peakAdded ) { peakAdded =
true; hlpSS2 << this->latMinLonMaxXYZ[0] <<
" ; " << this->latMinLonMaxXYZ[1] <<
" ; " << this->latMinLonMaxXYZ[2]; }
1179 if (
ProSHADE_internal_maths::vectorOrientationSimilaritySameDirection ( xPos, yPos, zPos, this->latMaxLonMaxXYZ[0], this->latMaxLonMaxXYZ[1], this->latMaxLonMaxXYZ[2], cosTol ) && !peakAdded ) { peakAdded =
true; hlpSS2 << this->latMaxLonMaxXYZ[0] <<
" ; " << this->latMaxLonMaxXYZ[1] <<
" ; " << this->latMaxLonMaxXYZ[2]; }
1185 hlpSS <<
"Peak group dimensions changed from LAT " << this->latFromInds <<
" - " << this->latToInds <<
" and LON " << this->lonFromInds <<
" - " << this->lonToInds <<
" to ";
1189 proshade_signed largerCorner, smallerCorner;
1190 bool latCornersDone =
false;
1191 bool lonCornersDone =
false;
1194 if ( ( this->latFromInds <= this->latToInds ) && !( ( lat >= this->latFromInds ) && ( lat <= this->latToInds ) ) )
1197 smallerCorner = angularDistanceWithBorders (
static_cast< proshade_signed
> ( lat ),
static_cast< proshade_signed
> ( this->latFromInds ) );
1198 largerCorner = angularDistanceWithBorders (
static_cast< proshade_signed
> ( lat ),
static_cast< proshade_signed
> ( this->latToInds ) );
1200 if ( smallerCorner < largerCorner )
1202 this->latFromInds = lat;
1203 latCornersDone =
true;
1205 if ( smallerCorner > largerCorner )
1207 this->latToInds = lat;
1208 latCornersDone =
true;
1210 if ( smallerCorner == largerCorner )
1212 if ( lat < this->latFromInds ) { this->latFromInds = lat; latCornersDone =
true; }
1213 else if ( lat > this->latToInds ) { this->latToInds = lat; latCornersDone =
true; }
1217 if ( ( this->latFromInds > this->latToInds ) && !( ( lat >= this->latFromInds ) || ( lat <= this->latToInds ) ) )
1220 smallerCorner = angularDistanceWithBorders (
static_cast< proshade_signed
> ( lat ),
static_cast< proshade_signed
> ( this->latFromInds ) );
1221 largerCorner = angularDistanceWithBorders (
static_cast< proshade_signed
> ( lat ),
static_cast< proshade_signed
> ( this->latToInds ) );
1223 if ( smallerCorner < largerCorner )
1225 this->latFromInds = lat;
1226 latCornersDone =
true;
1228 if ( smallerCorner > largerCorner )
1230 this->latToInds = lat;
1231 latCornersDone =
true;
1233 if ( smallerCorner == largerCorner )
1235 if ( lat < this->latFromInds ) { this->latFromInds = lat; latCornersDone =
true; }
1236 else if ( lat > this->latToInds ) { this->latToInds = lat; latCornersDone =
true; }
1242 if ( ( this->lonFromInds <= this->lonToInds ) && !( ( lon >= this->lonFromInds ) && ( lon <= this->lonToInds ) ) )
1245 smallerCorner = angularDistanceWithBorders (
static_cast< proshade_signed
> ( lon ),
static_cast< proshade_signed
> ( this->lonFromInds ) );
1246 largerCorner = angularDistanceWithBorders (
static_cast< proshade_signed
> ( lon ),
static_cast< proshade_signed
> ( this->lonToInds ) );
1248 if ( smallerCorner < largerCorner )
1250 this->lonFromInds = lon;
1251 lonCornersDone =
true;
1253 if ( smallerCorner > largerCorner )
1255 this->lonToInds = lon;
1256 lonCornersDone =
true;
1258 if ( smallerCorner == largerCorner )
1260 if ( lon < this->lonFromInds ) { this->lonFromInds = lon; lonCornersDone =
true; }
1261 else if ( lon > this->lonToInds ) { this->lonToInds = lon; lonCornersDone =
true; }
1265 if ( ( this->lonFromInds > this->lonToInds ) && !( ( lon >= this->lonFromInds ) || ( lon <= this->lonToInds ) ) )
1268 smallerCorner = angularDistanceWithBorders (
static_cast< proshade_signed
> ( lon ),
static_cast< proshade_signed
> ( this->lonFromInds ) );
1269 largerCorner = angularDistanceWithBorders (
static_cast< proshade_signed
> ( lon ),
static_cast< proshade_signed
> ( this->lonToInds ) );
1271 if ( smallerCorner < largerCorner )
1273 this->lonFromInds = lon;
1274 lonCornersDone =
true;
1276 if ( smallerCorner > largerCorner )
1278 this->lonToInds = lon;
1279 lonCornersDone =
true;
1281 if ( smallerCorner == largerCorner )
1283 if ( lon < this->lonFromInds ) { this->lonFromInds = lon; lonCornersDone =
true; }
1284 else if ( lon > this->lonToInds ) { this->lonToInds = lon; lonCornersDone =
true; }
1289 if ( latCornersDone )
1291 this->latFrom =
static_cast<proshade_double
> ( this->latFromInds ) * this->latSampling;
1292 this->latTo =
static_cast<proshade_double
> ( this->latToInds ) * this->latSampling;
1295 if ( lonCornersDone )
1297 this->lonFrom =
static_cast<proshade_double
> ( this->lonFromInds ) * this->lonSampling;
1298 this->lonTo =
static_cast<proshade_double
> ( this->lonToInds ) * this->lonSampling;
1302 this->computeCornerPositions ( );
1303 hlpSS <<
"LAT " << this->latFromInds <<
" - " << this->latToInds <<
" and LON " << this->lonFromInds <<
" - " << this->lonToInds <<
" ( peak position LAT " << lat <<
" LON " << lon <<
" )";
1307 bool isSphereNew =
true;
1308 for ( proshade_unsign iter = 0; iter < static_cast<proshade_unsign> ( this->spherePositions.size() ); iter++ ) {
if ( this->spherePositions.at(iter) == sphPos ) { isSphereNew =
false; } }
1313 return ( peakAdded );
1324 return ( this->latFromInds );
1335 return ( this->latToInds );
1346 return ( this->lonFromInds );
1357 return ( this->lonToInds );
1368 return ( this->spherePositions );
1395 if ( ( fold - 1 ) != spherePositions.size() ) { return ; }
1398 proshade_double bestPosVal, bestLatInd, bestLonInd;
1399 std::vector< proshade_unsign > spheresFormingFold;
1402 for ( proshade_unsign shIt = 0; shIt < static_cast<proshade_unsign> ( sphereVals.size() ); shIt++ )
1408 this->getBestIndexForFold ( &bestPosVal, &bestLatInd, &bestLonInd, &spheresFormingFold, sphereVals );
1411 if ( bicubicInterp )
1417 proshade_double* detectedSymmetry =
new proshade_double[7];
1420 detectedSymmetry[0] =
static_cast<proshade_double
> ( fold );
1421 detectedSymmetry[1] = 1.0 * std::sin ( bestLonInd * this->lonSampling ) * std::cos ( bestLatInd * this->latSampling );
1422 detectedSymmetry[2] = 1.0 * std::sin ( bestLonInd * this->lonSampling ) * std::sin ( bestLatInd * this->latSampling );
1423 detectedSymmetry[3] = 1.0 * std::cos ( bestLonInd * this->lonSampling );
1424 detectedSymmetry[4] = ( 2.0 * M_PI ) / detectedSymmetry[0];
1425 detectedSymmetry[5] = ( bestPosVal - 1.0 ) / ( detectedSymmetry[0] - 1 );
1426 detectedSymmetry[6] = -std::numeric_limits < proshade_double >::infinity();
1429 const FloatingPoint< proshade_double > lhs1 ( std::max ( std::abs ( detectedSymmetry[1] ), std::max ( std::abs ( detectedSymmetry[2] ), std::abs ( detectedSymmetry[3] ) ) ) );
1430 const FloatingPoint< proshade_double > rhs1 ( std::abs ( detectedSymmetry[1] ) );
1431 const FloatingPoint< proshade_double > rhs2 ( std::abs ( detectedSymmetry[2] ) );
1432 const FloatingPoint< proshade_double > rhs3 ( std::abs ( detectedSymmetry[3] ) );
1433 if ( ( lhs1.AlmostEquals ( rhs1 ) && ( detectedSymmetry[1] < 0.0 ) ) ||
1434 ( lhs1.AlmostEquals ( rhs2 ) && ( detectedSymmetry[2] < 0.0 ) ) ||
1435 ( lhs1.AlmostEquals ( rhs3 ) && ( detectedSymmetry[3] < 0.0 ) ) )
1437 detectedSymmetry[1] *= -1.0;
1438 detectedSymmetry[2] *= -1.0;
1439 detectedSymmetry[3] *= -1.0;
1440 detectedSymmetry[4] *= -1.0;
1444 const FloatingPoint< proshade_double > llhs1 ( detectedSymmetry[1] ), llhs2 ( detectedSymmetry[2] ), llhs3 ( detectedSymmetry[3] ), rrhs1 ( 0.0 );
1445 if ( llhs1.AlmostEquals ( rrhs1 ) ) { detectedSymmetry[1] = 0.0; }
1446 if ( llhs2.AlmostEquals ( rrhs1 ) ) { detectedSymmetry[2] = 0.0; }
1447 if ( llhs3.AlmostEquals ( rrhs1 ) ) { detectedSymmetry[3] = 0.0; }
1453 std::stringstream hlpSS;
1454 hlpSS <<
"Detected group with fold " << detectedSymmetry[0] <<
" along axis " << detectedSymmetry[1] <<
" ; " << detectedSymmetry[2] <<
" ; " << detectedSymmetry[3] <<
" and with peak height " << detectedSymmetry[5];
1470 std::vector< proshade_double > angs;
1473 for ( proshade_unsign shPos = 0; shPos < static_cast<proshade_unsign> ( this->spherePositions.size() ); shPos++ )
1479 for ( proshade_unsign ang1It = 0; ang1It < static_cast<proshade_unsign> ( angs.size() ); ang1It++ )
1481 for ( proshade_unsign ang2It = 1; ang2It < static_cast<proshade_unsign> ( angs.size() ); ang2It++ )
1484 if ( ang1It >= ang2It ) {
continue; }
1492 std::sort ( (*angDiffs).begin(), (*angDiffs).end() );
1493 (*angDiffs).erase ( std::unique ( (*angDiffs).begin(), (*angDiffs).end() ), (*angDiffs).end() );
1512 proshade_double divRem, divBasis, symmErr, angTolerance, angToleranceNext;
1513 proshade_double peakErr = ( M_PI * 2.0 ) / (
static_cast<proshade_double
> ( this->dimension ) );
1516 for ( proshade_unsign diffIt = 0; diffIt < static_cast<proshade_unsign> ( angDiffs->size() ); diffIt++ )
1519 divRem = std::modf (
static_cast<proshade_double
> ( ( 2.0 * M_PI ) / std::abs ( angDiffs->at(diffIt) ) ), &divBasis );
1529 const FloatingPoint< proshade_double > lhs1 ( divBasis ), rhs1 ( 1.0 );
1530 if ( lhs1.AlmostEquals ( rhs1 ) ) {
continue; }
1533 if (
static_cast< proshade_double
> ( this->spherePositions.size() ) < ( divBasis - 1.0 ) ) {
continue; }
1536 symmErr = divRem * ( ( 2.0 * M_PI ) /
static_cast<proshade_double
> ( divBasis ) );
1537 angTolerance = std::abs( symmErr / peakErr );
1538 angToleranceNext = ( ( ( 2.0 * M_PI ) /
static_cast<proshade_double
> ( divBasis ) ) - ( ( 2.0 * M_PI ) /
static_cast<proshade_double
> ( divBasis + 1 ) ) ) / peakErr;
1541 if ( angTolerance < std::max ( 3.0, ( 0.1 / peakErr ) ) )
1544 if ( angToleranceNext < std::max ( 1.5, ( 0.1 / peakErr ) ) )
1557 std::sort ( (*foldsToTry).begin(), (*foldsToTry).end(), std::greater <proshade_unsign>() );
1558 foldsToTry->erase ( std::unique ( (*foldsToTry).begin(), (*foldsToTry).end() ), (*foldsToTry).end() );
1575 proshade_double soughtAngle, minSphereVal;
1576 proshade_unsign minSpherePos = 0;
1579 for ( proshade_double fIt = 1.0; fIt < static_cast<proshade_double> ( foldToTry ); fIt += 1.0 )
1582 minSphereVal = 999.9;
1583 soughtAngle = fIt * ( 2.0 * M_PI /
static_cast<proshade_double
> ( foldToTry ) );
1586 for ( proshade_unsign angsIt = 0; angsIt < static_cast<proshade_unsign> ( this->spherePositions.size() ); angsIt++ )
1588 if ( std::abs ( sphereVals.at(this->spherePositions.at(angsIt))->getRepresentedAngle() - soughtAngle ) < sphereAngleTolerance )
1590 if ( minSphereVal > 1.0 - std::cos ( std::abs ( sphereVals.at(this->spherePositions.at(angsIt))->getRepresentedAngle() - soughtAngle ) ) )
1592 minSphereVal = 1.0 - std::cos ( std::abs ( sphereVals.at(this->spherePositions.at(angsIt))->getRepresentedAngle() - soughtAngle ) );
1593 minSpherePos = angsIt;
1599 const FloatingPoint< proshade_double > lhs1 ( minSphereVal ), rhs1 ( 999.9 );
1600 if ( lhs1.AlmostEquals ( rhs1 ) ) {
break; }
1623 proshade_double curPosVal;
1625 if ( this->latFromInds > this->latToInds ) { this->latToInds +=
static_cast< proshade_double
> ( this->dimension ); }
1626 if ( this->lonFromInds > this->lonToInds ) { this->lonToInds +=
static_cast< proshade_double
> ( this->dimension ); }
1629 for ( proshade_unsign latIt =
static_cast< proshade_unsign
> ( this->latFromInds ); latIt <= static_cast< proshade_unsign > ( this->latToInds ); latIt++ )
1632 if ( latIt >= this->dimension ) { latIt -= this->dimension; this->latToInds -=
static_cast< proshade_double
> ( this->dimension ); }
1634 for ( proshade_unsign lonIt =
static_cast< proshade_unsign
> ( this->lonFromInds ); lonIt <= static_cast< proshade_unsign > ( this->lonToInds ); lonIt++ )
1637 if ( lonIt >= this->dimension ) { lonIt -= this->dimension; this->lonToInds -=
static_cast< proshade_double
> ( this->dimension ); }
1643 for ( proshade_unsign sphIt = 0; sphIt < static_cast<proshade_unsign> ( spheresFormingFold->size() ); sphIt++ )
1645 curPosVal += sphereVals.at(spheresFormingFold->at(sphIt))->getSphereLatLonPosition ( latIt, lonIt );
1649 if ( curPosVal > *bestPosVal )
1651 *bestPosVal = curPosVal;
1652 *bestLatInd =
static_cast< proshade_double
> ( latIt );
1653 *bestLonInd =
static_cast< proshade_double
> ( lonIt );