44 double cdsq = std::pow((c00 - c11), 2) / 4.;
45 double cosq = c01 * c01;
48 double lambda0 = (c00 + c11) / 2. + std::sqrt(cdsq + cosq);
49 double lambda1 = (c00 + c11) / 2. - std::sqrt(cdsq + cosq);
50 double theta = atan2(lambda0 - c00, c01);
52 return {lambda0, lambda1, theta};
65 double lambda0,
double lambda1,
double theta,
size_t lseg,
double offset,
69 double stheta = std::sin(theta);
71 double l1sq = std::sqrt(lambda0);
72 double l2sq = std::sqrt(lambda1);
75 std::vector<Vector3D> ellipse;
76 ellipse.reserve(lseg);
77 double thetaStep = 2 *
M_PI / lseg;
78 for (
size_t it = 0;
it < lseg; ++
it) {
81 double sphi = std::sin(phi);
82 double x = lposition.x() + (l1sq * ctheta * cphi - l2sq * stheta * sphi);
83 double y = lposition.y() + (l1sq * stheta * cphi + l2sq * ctheta * sphi);
114 double directionScale = 1,
double angularErrorScale = 1,
128 template <
typename parameters_t>
132 double momentumScale = 1.,
double locErrorScale = 1.,
133 double angularErrorScale = 1.,
137 if (surfConfig.visible) {
139 Transform3D::Identity(), surfConfig);
144 auto direction = parameters.unitDirection();
145 double p = parameters.absoluteMomentum();
149 Vector3D parLength = p * momentumScale * direction;
155 position + parLength, 4., 2.5, lparConfig);
157 if (parameters.covariance().has_value()) {
158 auto paramVec = parameters.parameters();
159 auto lposition = paramVec.template block<2, 1>(0, 0);
162 const auto& covariance = *parameters.covariance();
164 covariance.template block<2, 2>(0, 0),
165 parameters.referenceSurface().transform(
gctx),
166 locErrorScale, covConfig);
169 helper,
position, direction, covariance.template block<2, 2>(2, 2),
170 0.9 * p * momentumScale, angularErrorScale, covConfig);
192 template <
typename source_link_t>
197 double momentumScale = 1.,
double locErrorScale = 1.,
198 double angularErrorScale = 1.,
213 if (state.index() == 0) {
215 angularErrorScale = 1;
219 if (surfaceConfig.visible) {
221 Transform3D::Identity(), surfaceConfig);
227 if (measurementConfig.visible and state.hasCalibrated() and
228 state.calibratedSize() == 2) {
229 const Vector2D& lposition = state.calibrated().template head<2>();
231 state.calibratedCovariance().template topLeftCorner<2, 2>();
233 state.referenceSurface().transform(
gctx),
234 locErrorScale, measurementConfig);
239 if (predictedConfig.visible and state.hasPredicted()) {
244 state.predictedCovariance()),
245 gctx, momentumScale, locErrorScale, angularErrorScale,
246 predictedConfig, predictedConfig,
ViewConfig(
false));
249 if (filteredConfig.visible and state.hasFiltered()) {
253 state.filtered(), state.filteredCovariance()),
254 gctx, momentumScale, locErrorScale, angularErrorScale,
255 filteredConfig, filteredConfig,
ViewConfig(
false));
258 if (smoothedConfig.visible and state.hasSmoothed()) {
262 state.smoothed(), state.smoothedCovariance()),
263 gctx, momentumScale, locErrorScale, angularErrorScale,
264 smoothedConfig, smoothedConfig,
ViewConfig(
false));