28 lines
1.1 KiB
C++
28 lines
1.1 KiB
C++
#ifndef BALLISTICPREDICTOR_H
|
|
#define BALLISTICPREDICTOR_H
|
|
|
|
#include <opencv2/opencv.hpp>
|
|
|
|
class BallisticPredictor {
|
|
public:
|
|
BallisticPredictor(float bullet_speed = 16.0f);
|
|
|
|
// Predict ballistic point considering target movement and flight time
|
|
cv::Point2f* predict_ballistic_point(const cv::Point2f* predicted_center,
|
|
const cv::Point2f& img_center,
|
|
const cv::Point2f& target_speed);
|
|
|
|
// Get last ballistic point
|
|
const cv::Point2f* get_last_ballistic_point() const { return last_ballistic_point; }
|
|
|
|
private:
|
|
float bullet_speed; // Bullet speed (m/s)
|
|
float armor_half_width; // Armor half width (converted to meters)
|
|
float armor_half_height; // Armor half height (converted to meters)
|
|
cv::Point2f* last_ballistic_point; // Last ballistic prediction
|
|
|
|
// Calculate distance to target
|
|
float calculate_distance(const cv::Point2f& armor_center, const cv::Point2f& img_center, float focal_length = 800.0f);
|
|
};
|
|
|
|
#endif // BALLISTICPREDICTOR_H
|