25 namespace Visualization {
36 double cdsq = std::pow((c00 - c11), 2) / 4.;
37 double cosq = c01 * c01;
40 double lambda0 = (c00 + c11) / 2. + std::sqrt(cdsq + cosq);
41 double lambda1 = (c00 + c11) / 2. - std::sqrt(cdsq + cosq);
42 double theta = atan2(lambda0 - c00, c01);
44 return {lambda0, lambda1, theta};
57 double lambda0,
double lambda1,
double theta,
size_t lseg,
60 double ctheta = std::cos(theta);
61 double stheta = std::sin(theta);
63 double l1sq = std::sqrt(lambda0);
64 double l2sq = std::sqrt(lambda1);
67 std::vector<Vector3D> ellipse;
68 ellipse.reserve(lseg);
69 double thetaStep = 2 *
M_PI / lseg;
70 for (
size_t it = 0;
it < lseg; ++
it) {
72 double cphi = std::cos(phi);
73 double sphi = std::sin(phi);
74 double x = lposition.x() + (l1sq * ctheta * cphi - l2sq * stheta * sphi);
75 double y = lposition.y() + (l1sq * stheta * cphi + l2sq * ctheta * sphi);
94 std::vector<int>
nsigma = {3},
double locErrorScale = 1,
size_t lseg = 72,
96 double outOfPlane = 0.1) {
101 lambda0, lambda1, theta, lseg, outOfPlane, lposition, transform);
103 ellipse.push_back(transform *
104 Vector3D(lposition.x(), lposition.y(), outOfPlane));
106 Polyhedron ellipseHedron(ellipse, faces.first, faces.second);
107 ellipseHedron.draw(helper,
false,
color);
124 double directionScale = 1,
double angularErrorScale = 1,
size_t lseg = 72,
129 Vector3D anker = position + directionScale * direction;
139 std::vector<Vector3D> ellipse =
140 createEllipse(angularErrorScale * directionScale * tan(lambda0),
141 angularErrorScale * directionScale * tan(lambda1), theta,
142 lseg, 0., {0., 0.}, eplane);
144 std::vector<Vector3D> coneTop = ellipse;
145 coneTop.push_back(anker);
147 Polyhedron coneTopHedron(coneTop, coneTopFaces.first, coneTopFaces.second);
148 coneTopHedron.draw(helper,
false,
color);
150 std::vector<Vector3D> cone = ellipse;
151 cone.push_back(position);
153 Polyhedron coneHedron(cone, coneFaces.first, coneFaces.second);
154 coneHedron.draw(helper,
true,
color);
169 template <
typename parameters_t>
173 double locErrorScale = 1.,
double angularErrorScale = 1.,
174 bool drawParameterSurface =
true,
size_t lseg = 72,
178 if (drawParameterSurface) {
180 Transform3D::Identity(), lseg,
false, scolor);
184 auto position = parameters.position();
185 auto direction = parameters.momentum().normalized();
186 double p = parameters.momentum().norm();
188 Vector3D startmod = parameters.covariance().has_value()
189 ? 0.25 * p * momentumScale * direction
192 drawArrowForward(helper, position, position + p * momentumScale * direction,
193 0.025, 0.05, 2., 72, pcolor);
195 if (parameters.covariance().has_value()) {
197 parameters.getParameterSet().getParameters().template
block<2, 1>(0, 0);
200 const auto& covariance = *parameters.covariance();
203 parameters.referenceSurface().transform(
gctx), {3},
204 locErrorScale, 72, pcolor, 0.01);
207 helper, parameters.position(), parameters.momentum().normalized(),
208 covariance.template
block<2, 2>(2, 2), {3}, 0.9 * p * momentumScale,
209 angularErrorScale, 72, pcolor);