本文整理汇总了C++中Array2D::getCellLengthX方法的典型用法代码示例。如果您正苦于以下问题:C++ Array2D::getCellLengthX方法的具体用法?C++ Array2D::getCellLengthX怎么用?C++ Array2D::getCellLengthX使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Array2D
的用法示例。
在下文中一共展示了Array2D::getCellLengthX方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: sqrt
static inline double Terrain_Slope_RiseRun(const Array2D<T> &elevations, const int x, const int y, const float zscale){
const auto tsv = TerrainSetup(elevations,x,y,zscale);
//See p. 18 of Horn (1981)
double dzdx = ( (tsv.c+2*tsv.f+tsv.i) - (tsv.a+2*tsv.d+tsv.g) ) / 8 / elevations.getCellLengthX();
double dzdy = ( (tsv.g+2*tsv.h+tsv.i) - (tsv.a+2*tsv.b+tsv.c) ) / 8 / elevations.getCellLengthY();
//The above fits are surface to a 3x3 neighbour hood. This returns the slope
//along the direction of maximum gradient.
return sqrt(dzdx*dzdx+dzdy*dzdy);
}
示例2: if
static inline double Terrain_Aspect(const Array2D<T> &elevations, const int x, const int y, const float zscale){
const auto tsv = TerrainSetup(elevations,x,y,zscale);
//See p. 18 of Horn (1981)
double dzdx = ( (tsv.c+2*tsv.f+tsv.i) - (tsv.a+2*tsv.d+tsv.g) ) / 8 / elevations.getCellLengthX();
double dzdy = ( (tsv.g+2*tsv.h+tsv.i) - (tsv.a+2*tsv.b+tsv.c) ) / 8 / elevations.getCellLengthY();
double the_aspect = 180.0/M_PI*atan2(dzdy,-dzdx);
if(the_aspect<0)
return 90-the_aspect;
else if(the_aspect>90.0)
return 360.0-the_aspect+90.0;
else
return 90.0-the_aspect;
}
示例3: TerrainCurvatureSetup
static inline TA_Setup_Curves_Vars TerrainCurvatureSetup(const Array2D<T> &elevations, const int x, const int y, const float zscale){
const TA_Setup_Vars tsv = TerrainSetup(elevations, x, y, zscale);
TA_Setup_Curves_Vars tscv;
//Z1 Z2 Z3 a b c
//Z4 Z5 Z6 d e f
//Z7 Z8 Z9 g h i
//Curvatures in the manner of Zevenbergen and Thorne 1987
tscv.L = elevations.getCellLengthX();
tscv.D = ( (tsv.d+tsv.f)/2 - tsv.e) / tscv.L / tscv.L; //D = [(Z4 + Z6) /2 - Z5] / L^2
tscv.E = ( (tsv.b+tsv.h)/2 - tsv.e) / tscv.L / tscv.L; //E = [(Z2 + Z8) /2 - Z5] / L^2
tscv.F = (-tsv.a+tsv.c+tsv.g-tsv.i)/4/tscv.L/tscv.L; //F = (-Z1+Z3+Z7-Z9)/(4L^2)
tscv.G = (-tsv.d+tsv.f)/2/tscv.L; //G = (-Z4+Z6)/(2L)
tscv.H = (tsv.b-tsv.h)/2/tscv.L; //H = (Z2-Z8)/(2L)
return tscv;
}
示例4: TerrainProcessor
static inline void TerrainProcessor(F func, const Array2D<T> &elevations, const float zscale, Array2D<float> &output){
if(elevations.getCellLengthX()!=elevations.getCellLengthY())
RDLOG_WARN<<"Cell X and Y dimensions are not equal!";
output.resize(elevations);
ProgressBar progress;
progress.start(elevations.size());
#pragma omp parallel for
for(int y=0;y<elevations.height();y++){
progress.update(y*elevations.width());
for(int x=0;x<elevations.width();x++)
if(elevations.isNoData(x,y))
output(x,y) = output.noData();
else
output(x,y) = func(elevations,x,y,zscale);
}
RDLOG_TIME_USE<<"Wall-time = "<<progress.stop();
}