Untitled
unknown
c_cpp
2 years ago
1.8 kB
5
Indexable
Never
// Сравнение плота с треком на совпадение координат. static bool ComparePlotTrackCoord(const Track *track, const Plot *plot, const TargetInfo *targetInfo, const TrackerZoneSettings &zoneSettings) { // разность по времени CT9_DIFF timeDiff = plot->timeOfPoint - track->point.timeOfPoint; bool isShortGap = (timeDiff < MS_TO_NS(zoneSettings.shortGapTime)); // строб по координатам double posError = hypot(plot->coord.x - track->point.coord.x, plot->coord.y - track->point.coord.y); double posGate = isShortGap ? zoneSettings.shortGapGate : zoneSettings.longGapGate; bool fitGap = posError <= posGate; // строб по высоте double plotAlt = GetAltitudeFromTargetInfo(targetInfo); boost::tribool fitAlt = boost::indeterminate; if (!std::isnan(track->point.alt) && !std::isnan(plotAlt)) { double altError = fabs(plotAlt - track->point.alt); double altGate = isShortGap ? zoneSettings.shortGapAltGate : zoneSettings.longGapAltGate; fitAlt = altError <= altGate; } // ошибка по траектории boost::tribool fitTraj = boost::indeterminate; if (track->trajectory) { CartCoord predictedPos; if (track->trajectory->predictPoint(plot->timeOfPoint, predictedPos)) { double trajError = hypot(plot->coord.x - predictedPos.x, plot->coord.y - predictedPos.y); double maxTrajError = isShortGap ? zoneSettings.shortGapMaxTrajError : zoneSettings.longGapMaxTrajError; fitTraj = trajError <= maxTrajError; } } return (((boost::indeterminate(fitTraj) || !zoneSettings.onlyTrajError) && fitGap) || (bool)fitTraj) && (boost::indeterminate(fitAlt) || (bool)fitAlt); }