songhaibo_branch
2 years ago
parent 9bd26fb221
commit 6ae542218f

@ -0,0 +1,30 @@
#include <iostream>
using namespace std;
double Ks_cor(int cover_type)
{
double impact_factor = 0;
// 根据植被类型获取影响系数
switch (cover_type) {
case 1: // 针叶林
impact_factor = 0.7;
break;
case 2: // 落叶林
impact_factor = 0.5;
break;
case 3: // 灌木林
impact_factor = 0.4;
break;
case 4: //枯枝落叶
impact_factor = 1.2;
break;
case 5: //草原
impact_factor = 2;
break;
default:
cout << "植被类型输入错误!" << endl;
return -1;
}
return impact_factor;
}

@ -0,0 +1,49 @@
#include <iostream>
#include <math.h>
using namespace std;
//0°5°为平坡
//6°15°为缓坡
//16°25°为斜坡
//26°35°为陡坡
//36°40°为急陡坡
//41°45°为急坡
//46°以上为险坡。
double levelToSlope(int level) {
double slope = 0;
double theta = 0;
if (level >= 0 && level <= 7) {
switch (level) {
case 1:
theta = 0;
break;
case 2:
theta = 11;
break;
case 3:
theta = 21;
break;
case 4:
theta = 30;
break;
case 5:
theta = 38;
break;
case 6:
theta = 45;
break;
case 7:
theta = 60;
break;
}
}
else {
cout << "无效的坡度等级!" << endl;
}
slope = tan(theta);
return slope;
}

@ -0,0 +1,38 @@
#include <iostream>
using namespace std;
int windToDirection(int type)
{
int direction = 0;
// 根据类型获取风向
switch (type) {
case 1: // 北风
direction = 0;
break;
case 2: // 东北风
direction = 45;
break;
case 3: // 东风
direction = 90;
break;
case 4: // 东南风
direction = 135;
break;
case 5: // 南风
direction = 180;
break;
case 6: //西南风
direction = 225;
break;
case 7: //西风
direction = 270;
break;
case 8: //西北风
direction = 315;
default:
cout << "植被类型输入错误!" << endl;
return -1;
}
return direction;
}
Loading…
Cancel
Save