38#include <Eigen/Eigenvalues>
54 Eigen::SelfAdjointEigenSolver<Matrix2F> eigenSolver(
56 _UMatrix = eigenSolver.eigenvectors();
61 float cxx, cxy, cxt, cyy, cyt, ctt;
62 is >> cxx >> cxy >> cxt >> cyy >> cyt >> ctt;
77 for (
int i = 0; i < size; i++) {
100VertexEllipseDrawAction::VertexEllipseDrawAction()
105bool VertexEllipseDrawAction::refreshPropertyPtrs(
106 HyperGraphElementAction::Parameters* params_) {
108 if (_previousParams) {
110 _previousParams->makeProperty<
DoubleProperty>(_typeName +
"::", 1);
117HyperGraphElementAction* VertexEllipseDrawAction::operator()(
118 HyperGraph::HyperGraphElement* element,
119 HyperGraphElementAction::Parameters* params_) {
120 if (
typeid(*element).name() != _typeName)
return nullptr;
122 refreshPropertyPtrs(params_);
123 if (!_previousParams) {
126 if (_show && !_show->value())
return this;
128 VertexEllipse* that =
dynamic_cast<VertexEllipse*
>(element);
132 float sigmaTheta =
sqrt(that->covariance()(2, 2));
133 float x = 0.1f * cosf(sigmaTheta);
134 float y = 0.1f * sinf(sigmaTheta);
136 glColor3f(1.f, 0.7f, 1.f);
137 glBegin(GL_LINE_STRIP);
140 glVertex3f(x, -y, 0);
143 glColor3f(0.f, 1.f, 0.f);
144 for (
size_t i = 0; i < that->matchingVertices().size(); i++) {
147 glVertex3f(that->matchingVertices()[i].x(), that->matchingVertices()[i].y(),
153 float angle = std::atan2(rot(1, 0), rot(0, 0));
154 glRotatef(angle * 180.0 /
const_pi(), 0., 0., 1.);
155 Vector2F sv = that->singularValues();
156 glScalef(
sqrt(sv(0)),
sqrt(sv(1)), 1);
158 glColor3f(1.f, 0.7f, 1.f);
159 glBegin(GL_LINE_LOOP);
160 for (
int i = 0; i < 36; i++) {
162 glVertex2f(std::cos(rad), std::sin(rad));
virtual bool refreshPropertyPtrs(HyperGraphElementAction::Parameters *params_)
data recorded by the robot
string ellipse to be attached to a vertex
virtual bool write(std::ostream &os) const
write the data to a stream
virtual bool read(std::istream &is)
read the data from a stream
void addMatchingVertex(float x, float y)
myVector2fVector _matchingVertices
some general case utility functions
Jet< T, N > sqrt(const Jet< T, N > &f)
Eigen::Matrix< float, 3, 3, Eigen::ColMajor > Matrix3F
Eigen::Matrix< float, 2, 2, Eigen::ColMajor > Matrix2F
Property< double > DoubleProperty
Eigen::Matrix< float, 2, 1, Eigen::ColMajor > Vector2F
constexpr double const_pi()