33 lines
870 B
C++
33 lines
870 B
C++
#ifndef MY_QUAD_H
|
|
#define MY_QUAD_H
|
|
|
|
#include <Eigen/Geometry>
|
|
|
|
|
|
class MyQuad {
|
|
typedef Eigen::Vector<double, 5> Vector5d;
|
|
Vector5d _coefficients; // a₀² + a₁xy + a₂y² + a₃x + a₄y + a₅
|
|
Eigen::AngleAxisd _rotation;
|
|
Eigen::Translation3d _translation;
|
|
|
|
public:
|
|
MyQuad(Vector5d coefficients,
|
|
const Eigen::AngleAxisd &rotation,
|
|
const Eigen::Translation3d &translation)
|
|
:_coefficients(coefficients),
|
|
_rotation(rotation),
|
|
_translation(translation) {}
|
|
const Vector5d &coefficients() { return _coefficients; }
|
|
const Eigen::AngleAxisd &rotation() { return _rotation; }
|
|
const Eigen::Translation3d &translation() { return _translation; }
|
|
double operator()(double x, double y) {
|
|
return _coefficients[0] * x*x
|
|
+ _coefficients[1] * x*y
|
|
+ _coefficients[2] * y*y
|
|
+ _coefficients[3] * x
|
|
+ _coefficients[4] * y;
|
|
}
|
|
};
|
|
|
|
|
|
#endif |