From 5c56d971cfa6b5fce57d8110309160a0d90aacca Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=8D=9A?= <1486806484@qq.com> Date: Wed, 28 Jun 2023 10:04:21 +0800 Subject: [PATCH] recoverty --- src/林火预测/FP.cpp | 152 ------------------ src/林火预测/Ks_correction.h | 30 ---- src/林火预测/levelToSlope.h | 49 ------ src/林火预测/levelToSpeed.h | 62 ------- src/林火预测/pixel.cpp | 19 --- src/林火预测/pixel.h | 29 ---- src/林火预测/wind_direction.h | 38 ----- .../ForestPolice.cpp | 141 ---------------- .../levelToSpeed.h | 62 ------- .../风速补正综合指标法/model.cpp | 149 ----------------- src/登录页面—vue/Login.vue | 111 ------------- src/细节功能/Alarm.cpp | 23 --- src/细节功能/Alarm.h | 46 ------ src/细节功能/Distance.cpp | 19 --- src/细节功能/Distance.h | 19 --- src/细节功能/pixel.cpp | 19 --- src/细节功能/pixel.h | 29 ---- 17 files changed, 997 deletions(-) delete mode 100644 src/林火预测/FP.cpp delete mode 100644 src/林火预测/Ks_correction.h delete mode 100644 src/林火预测/levelToSlope.h delete mode 100644 src/林火预测/levelToSpeed.h delete mode 100644 src/林火预测/pixel.cpp delete mode 100644 src/林火预测/pixel.h delete mode 100644 src/林火预测/wind_direction.h delete mode 100644 src/林火预测/风速补正综合指标法/ForestPolice.cpp delete mode 100644 src/林火预测/风速补正综合指标法/levelToSpeed.h delete mode 100644 src/林火预测/风速补正综合指标法/model.cpp delete mode 100644 src/登录页面—vue/Login.vue delete mode 100644 src/细节功能/Alarm.cpp delete mode 100644 src/细节功能/Alarm.h delete mode 100644 src/细节功能/Distance.cpp delete mode 100644 src/细节功能/Distance.h delete mode 100644 src/细节功能/pixel.cpp delete mode 100644 src/细节功能/pixel.h diff --git a/src/林火预测/FP.cpp b/src/林火预测/FP.cpp deleted file mode 100644 index e1ca9a1..0000000 --- a/src/林火预测/FP.cpp +++ /dev/null @@ -1,152 +0,0 @@ -#include -#include -#include "levelToSpeed.h" - -using namespace std; -#define M_PI acos(-1) - - -class ForestFirePrediction { -public: - // 构造函数 - ForestFirePrediction(int wind_direction, double wind_level, double slope, double altitude, int cover_type, double fire_size, double temperature, double waterlevel) { - this->wind_direction = wind_direction; - this->wind_level = wind_level; - this->slope = slope; - this->altitude = altitude; - this->cover_type = cover_type; - this->fire_size = fire_size; - this->temperature = temperature; - this->waterlevel = waterlevel; - } - - // 计算受阻距离(单位:km) - double get_distance() { - double rad_slope = slope * M_PI / 180.0; // 将坡度转化为弧度 - double distance = sin(rad_slope) * altitude / 1000.0; // 计算受阻距离 - return distance; - } - - // 预测火灾蔓延范围 - void predict_range() { - double impact_factor; // 植被类型影响系数 - double correction_coef; // 风速补正系数 - double distance; // 受阻距离 - double composite_index; // 综合指数 - - // 根据植被类型获取影响系数 - switch (cover_type) { - case 1: // 针叶林 - impact_factor = 0.7; - break; - case 2: // 落叶林 - impact_factor = 0.5; - break; - case 3: // 灌木林 - impact_factor = 0.4; - break; - default: - cout << "植被类型输入错误!" << endl; - return; - } - - // 计算风速补正系数 - int angle = abs(wind_direction - 180); // 计算风向与火灾扩散方向之间的夹角 - if (angle <= 45 || angle >= 315) { // 如果夹角较小,则不需要进行风速补正 - correction_coef = 1; - } - else { - correction_coef = 0.65 + 0.35 * cos((angle - 45) * M_PI / 270.0); // 使用公式计算风速补正系数 - } - - // 计算受阻距离 - distance = get_distance(); - - // 计算综合指数 - composite_index = correction_coef * (1 + distance) * impact_factor; - - // 计算火灾蔓延半径 - double radius = sqrt(fire_size * 1000000 * composite_index) / M_PI; - double range = radius * pow(10, 1.5 * levelToSpeed(wind_level) / 30.0); - - // 输出预测结果 - cout << "火灾蔓延范围预测结果:" << endl; - cout << "火源最可能在" << radius << "米范围内发生。" << endl; - cout << "在风速为 " << wind_level << "级风的情况下,火源最可能的蔓延范围为 " << range << " 米。" << endl; - } - - // 预测火灾蔓延速度 - void predict_speed(int level) { - double slope_factor; // 坡度影响因子 - double speed_factor; // 风速影响因子 - double size_factor; // 火源面积影响因子 - - // 计算坡度影响因子 - if (slope > 0) { - slope_factor = pow(3.33, sqrt(slope)); - } - else { - slope_factor = 1; - } - - // 计算风速影响因子 - double wind_speed = levelToSpeed(wind_level); - speed_factor = 5.15 * pow(wind_speed, 0.39) + 0.299 * temperature + 0.009 * (100 - waterlevel) - 0.304; - - // 计算火源面积影响因子 - size_factor = pow(fire_size, 0.77); - - // 计算火灾蔓延速度 - double speed = 0.348 * sqrt(size_factor * slope_factor * speed_factor); - - - // 输出预测结果 - cout << "火灾蔓延速度预测结果:" << endl; - cout << "火灾蔓延速度可能为" << speed << "km/h。" << endl; - } - -private: - int wind_direction; // 风向(单位:度) - double wind_level; // 风力等级 - double slope; // 坡度(单位:度) - double altitude; // 海拔高度(单位:m) - int cover_type; // 植被类型(1:针叶林;2:落叶林;3:灌木林) - double fire_size; // 火源面积(单位:平方米) - double temperature; // 温度(单位:摄氏度) - double waterlevel; // 湿度(单位:%) -}; - -int main() { - // 读取参数 - int wind_direction; - int wind_level; - double slope; - double altitude; - int cover_type; - double fire_size; - double temperature; - double waterlevel; - cout << "请输入风向(0-360度):" << endl; - cin >> wind_direction; - cout << "请输入风力等级(级):" << endl; - cin >> wind_level; - cout << "请输入坡度(度):" << endl; - cin >> slope; - cout << "请输入海拔高度(m):" << endl; - cin >> altitude; - cout << "请输入植被类型(1:针叶林;2:落叶林;3:灌木林):" << endl; - cin >> cover_type; - cout << "请输入火源面积(m^2):" << endl; - cin >> fire_size; - cout << "请输入当天气温(°C):" << endl; - cin >> temperature; - cout << "请输入当天湿度(%):" << endl; - cin >> waterlevel; - - // 预测火灾蔓延范围和速度 - ForestFirePrediction ffp(wind_direction, wind_level, slope, altitude, cover_type, fire_size, temperature, waterlevel); - ffp.predict_range(); - ffp.predict_speed(wind_level); - - return 0; -} \ No newline at end of file diff --git a/src/林火预测/Ks_correction.h b/src/林火预测/Ks_correction.h deleted file mode 100644 index d97eede..0000000 --- a/src/林火预测/Ks_correction.h +++ /dev/null @@ -1,30 +0,0 @@ -#include -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; -} \ No newline at end of file diff --git a/src/林火预测/levelToSlope.h b/src/林火预测/levelToSlope.h deleted file mode 100644 index 28c3a6a..0000000 --- a/src/林火预测/levelToSlope.h +++ /dev/null @@ -1,49 +0,0 @@ -#include -#include -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; -} diff --git a/src/林火预测/levelToSpeed.h b/src/林火预测/levelToSpeed.h deleted file mode 100644 index 7098b2f..0000000 --- a/src/林火预测/levelToSpeed.h +++ /dev/null @@ -1,62 +0,0 @@ -#include -using namespace std; - -double levelToSpeed(int level) { - double speed = 0; - if (level >= 0 && level <= 12) { - double speed = 0; - switch (level) { - case 1: - speed = 0.3; - break; - case 2: - speed = 1.6; - break; - case 3: - speed = 3.4; - break; - case 4: - speed = 5.5; - break; - case 5: - speed = 8.0; - break; - case 6: - speed = 10.8; - break; - case 7: - speed = 13.9; - break; - case 8: - speed = 17.2; - break; - case 9: - speed = 20.8; - break; - case 10: - speed = 24.5; - break; - case 11: - speed = 28.5; - break; - case 12: - speed = 32.7; - break; - - } - - } - else if (level == 13) { - speed = 35.8; - } - else if (level == 14) { - speed = 41.5; - } - else if (level == 15) { - speed = 48.2; - } - else { - cout << "无效的风力等级!" << endl; - } - return speed; -} \ No newline at end of file diff --git a/src/林火预测/pixel.cpp b/src/林火预测/pixel.cpp deleted file mode 100644 index 20440aa..0000000 --- a/src/林火预测/pixel.cpp +++ /dev/null @@ -1,19 +0,0 @@ -#include "pixel.h" -#include - -using namespace std; - -int main() { - // ʵͼռ - PixelRatioConverter p(5, 10, 100, 200); - - // ȡرϵ - double ratio = p.getPixelRatio(); - cout << "رϵ" << ratio << endl; - - // һͼռ - int next_pixel_area = p.getNextPixelArea(15); - cout << "һͼռ" << next_pixel_area << endl; - - return 0; -} \ No newline at end of file diff --git a/src/林火预测/pixel.h b/src/林火预测/pixel.h deleted file mode 100644 index 5a590a6..0000000 --- a/src/林火预测/pixel.h +++ /dev/null @@ -1,29 +0,0 @@ -class PixelRatioConverter { -public: - // 캯ʵеͼռ - PixelRatioConverter(double real_area1, double real_area2, int pixel_area1, int pixel_area2) { - this->real_area1 = real_area1; - this->real_area2 = real_area2; - this->pixel_area1 = pixel_area1; - this->pixel_area2 = pixel_area2; - } - - // ȡرϵ - double getPixelRatio() { - double ratio = (real_area1 / real_area2) * (pixel_area2 / pixel_area1); - return ratio; // رϵ - } - - // رϵһͼռ - int getNextPixelArea(int next_real_area) { - double ratio = this->getPixelRatio(); - int next_pixel_area = static_cast(next_real_area / ratio); - return next_pixel_area; // һͼռ - } - -private: - double real_area1; // һʵе - double real_area2; // ڶʵе - int pixel_area1; // һͼռ - int pixel_area2; // ڶͼռ -}; diff --git a/src/林火预测/wind_direction.h b/src/林火预测/wind_direction.h deleted file mode 100644 index a9b39fc..0000000 --- a/src/林火预测/wind_direction.h +++ /dev/null @@ -1,38 +0,0 @@ -#include -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; -} \ No newline at end of file diff --git a/src/林火预测/风速补正综合指标法/ForestPolice.cpp b/src/林火预测/风速补正综合指标法/ForestPolice.cpp deleted file mode 100644 index ee1f49a..0000000 --- a/src/林火预测/风速补正综合指标法/ForestPolice.cpp +++ /dev/null @@ -1,141 +0,0 @@ -#include -#include -#include "levelToSpeed.h" - -using namespace std; -#define M_PI acos(-1) - - -class ForestFirePrediction { -public: - // 构造函数 - ForestFirePrediction(int wind_direction, double wind_level, double slope, double altitude, int cover_type, double fire_size) { - this->wind_direction = wind_direction; - this->wind_level = wind_level; - this->slope = slope; - this->altitude = altitude; - this->cover_type = cover_type; - this->fire_size = fire_size; - } - - // 计算受阻距离(单位:km) - double get_distance() { - double rad_slope = slope * M_PI / 180.0; // 将坡度转化为弧度 - double distance = sin(rad_slope) * altitude / 1000.0; // 计算受阻距离 - return distance; - } - - // 预测火灾蔓延范围 - void predict_range() { - double impact_factor; // 植被类型影响系数 - double correction_coef; // 风速补正系数 - double distance; // 受阻距离 - double composite_index; // 综合指数 - - // 根据植被类型获取影响系数 - switch (cover_type) { - case 1: // 针叶林 - impact_factor = 0.7; - break; - case 2: // 落叶林 - impact_factor = 0.5; - break; - case 3: // 灌木林 - impact_factor = 0.4; - break; - default: - cout << "植被类型输入错误!" << endl; - return; - } - - // 计算风速补正系数 - int angle = abs(wind_direction - 180); // 计算风向与火灾扩散方向之间的夹角 - if (angle <= 45 || angle >= 315) { // 如果夹角较小,则不需要进行风速补正 - correction_coef = 1; - } - else { - correction_coef = 0.65 + 0.35 * cos((angle - 45) * M_PI / 270.0); // 使用公式计算风速补正系数 - } - - // 计算受阻距离 - distance = get_distance(); - - // 计算综合指数 - composite_index = correction_coef * (1 + distance) * impact_factor; - - // 计算火灾蔓延半径 - double radius = sqrt(fire_size * 1000000 * composite_index) / M_PI; - double range = radius * pow(10, 1.5 * levelToSpeed(wind_level) / 30.0); - - // 输出预测结果 - cout << "火灾蔓延范围预测结果:" << endl; - cout << "火源最可能在" << radius << "米范围内发生。" << endl; - cout << "在风速为 " << wind_level << "级风的情况下,火源最可能的蔓延范围为 " << range << " 米。" << endl; - } - - // 预测火灾蔓延速度 - void predict_speed(int level) { - double slope_factor; // 坡度影响因子 - double speed_factor; // 风速影响因子 - double size_factor; // 火源面积影响因子 - - // 计算坡度影响因子 - if (slope > 0) { - slope_factor = pow(3.33, sqrt(slope)); - } - else { - slope_factor = 1; - } - - // 计算风速影响因子 - double wind_speed = levelToSpeed(wind_level); - speed_factor = 5.15 * pow(wind_speed, 0.39); - - // 计算火源面积影响因子 - size_factor = pow(fire_size, 0.77); - - // 计算火灾蔓延速度 - double speed = 0.348 * sqrt(size_factor * slope_factor * speed_factor); - - // 输出预测结果 - cout << "火灾蔓延速度预测结果:" << endl; - cout << "火灾蔓延速度可能为" << speed << "km/h。" << endl; - } - -private: - int wind_direction; // 风向(单位:度) - double wind_level; // 风力等级 - double slope; // 坡度(单位:度) - double altitude; // 海拔高度(单位:m) - int cover_type; // 植被类型(1:针叶林;2:落叶林;3:灌木林) - double fire_size; // 火源面积(单位:平方米) -}; - -int main() { - // 读取参数 - int wind_direction; - int wind_level; - double slope; - double altitude; - int cover_type; - double fire_size; - cout << "请输入风向(0-360度):" << endl; - cin >> wind_direction; - cout << "请输入风力等级(级):" << endl; - cin >> wind_level; - cout << "请输入坡度(度):" << endl; - cin >> slope; - cout << "请输入海拔高度(m):" << endl; - cin >> altitude; - cout << "请输入植被类型(1:针叶林;2:落叶林;3:灌木林):" << endl; - cin >> cover_type; - cout << "请输入火源面积(m^2):" << endl; - cin >> fire_size; - - // 预测火灾蔓延范围和速度 - ForestFirePrediction ffp(wind_direction, wind_level, slope, altitude, cover_type, fire_size); - ffp.predict_range(); - ffp.predict_speed(wind_level); - - return 0; -} \ No newline at end of file diff --git a/src/林火预测/风速补正综合指标法/levelToSpeed.h b/src/林火预测/风速补正综合指标法/levelToSpeed.h deleted file mode 100644 index 4a3a051..0000000 --- a/src/林火预测/风速补正综合指标法/levelToSpeed.h +++ /dev/null @@ -1,62 +0,0 @@ -#include -using namespace std; - -double levelToSpeed(int level) { - double speed = 0; - if (level >= 0 && level <= 12) { - double speed = 0; - switch (level) { - case 1: - speed = 0.3; - break; - case 2: - speed = 1.6; - break; - case 3: - speed = 3.4; - break; - case 4: - speed = 5.5; - break; - case 5: - speed = 8.0; - break; - case 6: - speed = 10.8; - break; - case 7: - speed = 13.9; - break; - case 8: - speed = 17.2; - break; - case 9: - speed = 20.8; - break; - case 10: - speed = 24.5; - break; - case 11: - speed = 28.5; - break; - case 12: - speed = 32.7; - break; - - } - - } - else if (level == 13) { - speed = 35.8; - } - else if (level == 14) { - speed = 41.5; - } - else if (level == 15) { - speed = 48.2; - } - else { - cout << "Чķȼ" << endl; - } - return speed; -} \ No newline at end of file diff --git a/src/林火预测/风速补正综合指标法/model.cpp b/src/林火预测/风速补正综合指标法/model.cpp deleted file mode 100644 index 1d8191f..0000000 --- a/src/林火预测/风速补正综合指标法/model.cpp +++ /dev/null @@ -1,149 +0,0 @@ -#include -#include - -using namespace std; - -class ForestFireModel { -private: - int rows; // ɭֵͼ - int cols; // ɭֵͼ - double ignitionProbability; // ȼ - double burningProbability; // Ӹ - double** forestMap; // ɭֵͼ - -public: - ForestFireModel(int rows, int cols, double ignitionProbability, double burningProbability) { - this->rows = rows; - this->cols = cols; - this->ignitionProbability = ignitionProbability; - this->burningProbability = burningProbability; - - // ʼɭֵͼ - forestMap = new double* [rows]; - for (int i = 0; i < rows; i++) { - forestMap[i] = new double[cols]; - for (int j = 0; j < cols; j++) { - forestMap[i][j] = (double)rand() / (RAND_MAX); - } - } - } - - // ģɢ - void simulate(int steps) { - for (int t = 0; t < steps; t++) { - double** nextMap = new double* [rows]; - for (int i = 0; i < rows; i++) { - nextMap[i] = new double[cols]; - for (int j = 0; j < cols; j++) { - bool isBurning = false; - bool isIgnited = (double)rand() / (RAND_MAX) < ignitionProbability; - if (isIgnited || forestMap[i][j] > 0) { - // ȼǰλѾŻжΧǷлɢ - for (int k = -1; k <= 1; k++) { - for (int l = -1; l <= 1; l++) { - if (k == 0 && l == 0) { - continue; - } - int ii = i + k; - int jj = j + l; - if (ii < 0 || ii >= rows || jj < 0 || jj >= cols) { - continue; - } - if (forestMap[ii][jj] > 0) { - // Χл𣬵ǰλҲŻ - isBurning = true; - } - else if ((double)rand() / (RAND_MAX) < burningProbability) { - // ͨʾǰλǷŻ - isBurning = true; - } - } - } - } - nextMap[i][j] = isBurning ? 1 : (isIgnited ? 0.5 : forestMap[i][j]); - } - } - // ɭֵͼ - for (int i = 0; i < rows; i++) { - for (int j = 0; j < cols; j++) { - forestMap[i][j] = nextMap[i][j]; - } - delete[] nextMap[i]; - } - delete[] nextMap; - } - } - - // ָλõĻٶ - double spreadSpeed(int x, int y) { - double speed = 0; - if (forestMap[x][y] == 0) { - return speed; - } - for (int i = 0; i < rows; i++) { - for (int j = 0; j < cols; j++) { - double distance = sqrt(pow(x - i, 2) + pow(y - j, 2)); - if (forestMap[i][j] > 0 && distance > 0) { - speed += forestMap[i][j] / distance; - } - } - } - return speed; - } - - // 㵱ǰΧİ뾶 - double fireRadius() { - double radius = 0; - for (int i = 0; i < rows; i++) { - for (int j = 0; j < cols; j++) { - if (forestMap[i][j] >= 1) { - double distance = sqrt(pow(i - rows / 2, 2) + pow(j - cols / 2, 2)); - radius = max(radius, distance); - } - } - } - return radius; - } - - // ɭֵͼ - void printMap() { - for (int i = 0; i < rows; i++) { - for (int j = 0; j < cols; j++) { - if (forestMap[i][j] >= 1) { - cout << "* "; - } - else if (forestMap[i][j] > 0) { - cout << "o "; - } - else { - cout << ". "; - } - } - cout << endl; - } - } - - ~ForestFireModel() { - for (int i = 0; i < rows; i++) { - delete[] forestMap[i]; - } - delete[] forestMap; - } -}; - -int main() { - srand(time(0)); - - // ģһ5x5ɭ֣ȼΪ0.2ӸΪ0.8ģ100 - ForestFireModel model(5, 5, 0.2, 0.8); - model.simulate(100); - model.printMap(); - - // ָλõĻٶ - cout << "Spread speed at position (2, 3): " << model.spreadSpeed(2, 3) << endl; - - // 㵱ǰΧİ뾶 - cout << "Fire radius: " << model.fireRadius() << endl; - - return 0; -} diff --git a/src/登录页面—vue/Login.vue b/src/登录页面—vue/Login.vue deleted file mode 100644 index e6489a7..0000000 --- a/src/登录页面—vue/Login.vue +++ /dev/null @@ -1,111 +0,0 @@ - - - - - - \ No newline at end of file diff --git a/src/细节功能/Alarm.cpp b/src/细节功能/Alarm.cpp deleted file mode 100644 index 7895190..0000000 --- a/src/细节功能/Alarm.cpp +++ /dev/null @@ -1,23 +0,0 @@ -#include "Alarm.h" -#include -#include - -using namespace std; - -int main() { - AlarmSystem alarm; // ϵͳ - - alarm.arm(); // ϵͳ - - // ģյϢ - string message = "¶쳣"; - alarm.receiveMessage(message); - - alarm.disarm(); // رվϵͳ - - // ٴģյϢھϵͳѹرգᴥ - string message2 = "־"; - alarm.receiveMessage(message2); - - return 0; -} diff --git a/src/细节功能/Alarm.h b/src/细节功能/Alarm.h deleted file mode 100644 index 982452e..0000000 --- a/src/细节功能/Alarm.h +++ /dev/null @@ -1,46 +0,0 @@ -#include -#include - -using namespace std; - -class AlarmSystem { -public: - // 캯ʼϵͳ - AlarmSystem() { - isArmed = false; - alarmMessage = "쳣"; - } - - // ϵͳ - void arm() { - isArmed = true; - cout << "ϵͳ" << endl; - } - - // رվϵͳ - void disarm() { - isArmed = false; - cout << "ϵͳѹر" << endl; - } - - // Ϣ - void receiveMessage(const string& message) { - if (isArmed) { - cout << "յϢ" << message << endl; - triggerAlarm(); - } - else { - cout << "δϵͳϢ" << message << endl; - } - } - -private: - bool isArmed; // ϵͳǷ - string alarmMessage; // Ϣ - - // - void triggerAlarm() { - cout << "" << alarmMessage << endl; - // ʵ־ľ紥֪ͨ - } -}; diff --git a/src/细节功能/Distance.cpp b/src/细节功能/Distance.cpp deleted file mode 100644 index bc74a67..0000000 --- a/src/细节功能/Distance.cpp +++ /dev/null @@ -1,19 +0,0 @@ -#include "Distance.h" -#include - -using namespace std; - -int main() { - // Ļ߳Ⱥľӽµλ - TreeDistanceEstimator treeEstimator(0.1, 30); - - // Ľ - treeEstimator.setFocalLength(100); - - // ľľ - double distance = treeEstimator.estimateDistance(); - - cout << "ľ룺" << distance << " " << endl; - - return 0; -} diff --git a/src/细节功能/Distance.h b/src/细节功能/Distance.h deleted file mode 100644 index 0f483b9..0000000 --- a/src/细节功能/Distance.h +++ /dev/null @@ -1,19 +0,0 @@ -class TreeDistanceEstimator { -public: - // 캯Ļ߳Ⱥľӽµλ - TreeDistanceEstimator(double baseline, double pixel_displacement) { - this->baseline = baseline; - this->pixel_displacement = pixel_displacement; - } - - // ľľ - double estimateDistance() { - double distance = (baseline * focal_length) / pixel_displacement; - return distance; // عľ - } - -private: - double baseline; // Ļ߳ - double pixel_displacement; // ľӽµλ - double focal_length; // -}; diff --git a/src/细节功能/pixel.cpp b/src/细节功能/pixel.cpp deleted file mode 100644 index 20440aa..0000000 --- a/src/细节功能/pixel.cpp +++ /dev/null @@ -1,19 +0,0 @@ -#include "pixel.h" -#include - -using namespace std; - -int main() { - // ʵͼռ - PixelRatioConverter p(5, 10, 100, 200); - - // ȡرϵ - double ratio = p.getPixelRatio(); - cout << "رϵ" << ratio << endl; - - // һͼռ - int next_pixel_area = p.getNextPixelArea(15); - cout << "һͼռ" << next_pixel_area << endl; - - return 0; -} \ No newline at end of file diff --git a/src/细节功能/pixel.h b/src/细节功能/pixel.h deleted file mode 100644 index 5a590a6..0000000 --- a/src/细节功能/pixel.h +++ /dev/null @@ -1,29 +0,0 @@ -class PixelRatioConverter { -public: - // 캯ʵеͼռ - PixelRatioConverter(double real_area1, double real_area2, int pixel_area1, int pixel_area2) { - this->real_area1 = real_area1; - this->real_area2 = real_area2; - this->pixel_area1 = pixel_area1; - this->pixel_area2 = pixel_area2; - } - - // ȡرϵ - double getPixelRatio() { - double ratio = (real_area1 / real_area2) * (pixel_area2 / pixel_area1); - return ratio; // رϵ - } - - // رϵһͼռ - int getNextPixelArea(int next_real_area) { - double ratio = this->getPixelRatio(); - int next_pixel_area = static_cast(next_real_area / ratio); - return next_pixel_area; // һͼռ - } - -private: - double real_area1; // һʵе - double real_area2; // ڶʵе - int pixel_area1; // һͼռ - int pixel_area2; // ڶͼռ -};