26 #ifndef MPBLOCKS_DUBINS_CURVES_EIGEN_FUNCS_HPP_
27 #define MPBLOCKS_DUBINS_CURVES_EIGEN_FUNCS_HPP_
35 namespace curves_eigen {
39 template <
typename Scalar>
40 Eigen::Matrix<Scalar, 2, 1>
ccwCenter(
const Eigen::Matrix<Scalar, 3, 1>& q,
42 typedef Eigen::Matrix<Scalar, 2, 1>
Vector2d;
47 v << -sin(q[2]), cos(q[2]);
53 template <
typename Scalar>
54 Eigen::Matrix<Scalar, 2, 1>
leftCenter(
const Eigen::Matrix<Scalar, 3, 1>& q,
61 template <
typename Scalar>
62 Eigen::Matrix<Scalar, 2, 1>
cwCenter(
const Eigen::Matrix<Scalar, 3, 1>& q,
64 typedef Eigen::Matrix<Scalar, 2, 1>
Vector2d;
68 v << sin(q[2]), -cos(q[2]);
75 template <
typename Scalar>
76 Eigen::Matrix<Scalar, 2, 1>
rightCenter(
const Eigen::Matrix<Scalar, 3, 1>& q,
81 template <
typename Scalar>
86 template <
typename Scalar>
91 template <
typename Scalar>
96 template <
typename Scalar>
101 template <
typename Scalar>
106 template <
typename Scalar>
111 template <
typename Scalar>
116 template <
typename Scalar>
121 template <
typename Scalar>
126 template <
typename Scalar>
131 template <
typename Scalar>
132 Scalar
cwAngleOf(
const Eigen::Matrix<Scalar, 3, 1>& q) {
136 template <
typename Scalar>
143 template <
typename Scalar>
145 const Eigen::Matrix<Scalar, 2, 1>& c1,
146 Eigen::Matrix<Scalar, 2, 1>& c2, Scalar r, Scalar&
a) {
148 Scalar d = (c0 - c1).
norm();
152 if (d > 4 * r)
return false;
156 a = acos(d / (4 * r));
159 Eigen::Rotation2D<Scalar>
R(-a);
172 template <
typename Scalar>
174 const Eigen::Matrix<Scalar, 2, 1>& c1,
175 Eigen::Matrix<Scalar, 2, 1>& c2, Scalar r, Scalar&
a) {
177 Scalar d = (c0 - c1).
norm();
181 if (d > 4 * r)
return false;
185 a = acos(d / (4 * r));
188 Eigen::Rotation2D<Scalar>
R(-a);
bool coincidentCenterA(const Eigen::Matrix< Scalar, 2, 1 > &c0, const Eigen::Matrix< Scalar, 2, 1 > &c1, Eigen::Matrix< Scalar, 2, 1 > &c2, Scalar r, Scalar &a)
returns the center of a circle which is coincident to the two circles whose centers are given...
Scalar leftAngle_inv(const Scalar alpha)
Scalar leftAngleOf(const Scalar q_theta)
return the angle of the vector from the center of the counter clockwise (left) circle coincident to q...
bool coincidentCenterB(const Eigen::Matrix< Scalar, 2, 1 > &c0, const Eigen::Matrix< Scalar, 2, 1 > &c1, Eigen::Matrix< Scalar, 2, 1 > &c2, Scalar r, Scalar &a)
returns the center of a circle which is coincident to the two circles whose centers are given...
Scalar cwAngle_inv(const Scalar alpha)
Scalar ccwAngleOf(const Scalar q_theta)
return the angle of the vector from the center of the counter clockwise (left) circle coincident to q...
Eigen::Matrix< Scalar, 2, 1 > cwCenter(const Eigen::Matrix< Scalar, 3, 1 > &q, Scalar r)
return the center of a clockwise (right) circle coincident to q with radius r
empty struct used to template "variant" of three arc primitives
Scalar cwAngleOf(const Scalar q_theta)
return the angle of the vector from the center of the clockwise (right) circle coincident to q...
empty struct used to template "right turn" primitive
Eigen::Matrix< Scalar, 2, 1 > ccwCenter(const Eigen::Matrix< Scalar, 3, 1 > &q, Scalar r)
return the center of a counter clockwise (left) circle coincident to q with radius r ...
Scalar rightAngle_inv(const Scalar alpha)
Scalar rightAngleOf(const Scalar q_theta)
return the angle of the vector from the center of the clockwise (right) circle coincident to q...
__host__ __device__ Format_t clampRadian(Format_t a)
wraps the input onto [-pi,pi]
__device__ __host__ Scalar norm(const RValue< Scalar, ROWS, COLS, Exp > &M)
compute the norm
Matrix< double, 2, 1 > Vector2d
Eigen::Matrix< Scalar, 2, 1 > rightCenter(const Eigen::Matrix< Scalar, 3, 1 > &q, Scalar r)
return the center of a clockwise (right) circle coincident to q with radius r
__host__ __device__ Normalized< Scalar, Exp, Spec > normalized(const RValue< Scalar, Exp, Spec > &exp)
Scalar ccwAngle_inv(const Scalar alpha)
Eigen::Matrix< Scalar, 2, 1 > leftCenter(const Eigen::Matrix< Scalar, 3, 1 > &q, Scalar r)
return the center of a counter clockwise (left) circle coincident to q with radius r ...