cheshirekow  v0.1.0
trig_wrap.hpp
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2012 Josh Bialkowski (jbialk@mit.edu)
3  *
4  * This file is part of mpblocks.
5  *
6  * mpblocks is free software: you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License as published by
8  * the Free Software Foundation, either version 3 of the License, or
9  * (at your option) any later version.
10  *
11  * mpblocks is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14  * GNU General Public License for more details.
15  *
16  * You should have received a copy of the GNU General Public License
17  * along with mpblocks. If not, see <http://www.gnu.org/licenses/>.
18  */
26 #ifndef MPBLOCKS_DUBINS_CURVES_EIGEN_TRIGWRAP_HPP_
27 #define MPBLOCKS_DUBINS_CURVES_EIGEN_TRIGWRAP_HPP_
28 
29 namespace mpblocks {
30 namespace dubins {
31 namespace curves_eigen {
32 
33 template <typename Format_t>
34 struct TrigWrap<Format_t, L> {
35  static Format_t arc(Format_t a, Format_t b) {
36  return leftArc(a, b);
37  }
38 
39  static Eigen::Matrix<Format_t, 2, 1> center(
40  const Eigen::Matrix<Format_t, 3, 1>& q, Format_t r) {
41  return leftCenter(q, r);
42  }
43 
44  static Format_t angleOf(const Eigen::Matrix<Format_t, 3, 1>& q) {
45  return leftAngleOf(q);
46  }
47 
48  static Format_t addDirection(Format_t a) {
49  return -a;
50  }
51 };
52 
53 template <typename Format_t>
54 struct TrigWrap<Format_t, R> {
55  static Format_t arc(Format_t a, Format_t b) { return rightArc(a, b); }
56 
57  static Eigen::Matrix<Format_t, 2, 1> center(
58  const Eigen::Matrix<Format_t, 3, 1>& q, Format_t r) {
59  return rightCenter(q, r);
60  }
61 
62  static Format_t angleOf(const Eigen::Matrix<Format_t, 3, 1>& q) {
63  return rightAngleOf(q);
64  }
65 
66  static Format_t addDirection(Format_t a) {
67  return a;
68  }
69 };
70 
71 } // curves_eigen
72 } // dubins
73 } // mpblocks
74 
75 #endif // TRIGWRAP_H_
static Eigen::Matrix< Format_t, 2, 1 > center(const Eigen::Matrix< Format_t, 3, 1 > &q, Format_t r)
Definition: trig_wrap.hpp:39
Scalar leftAngleOf(const Scalar q_theta)
return the angle of the vector from the center of the counter clockwise (left) circle coincident to q...
Definition: funcs.hpp:87
empty struct used to template "variant" of three arc primitives
Definition: types.h:46
static Format_t arc(Format_t a, Format_t b)
Definition: trig_wrap.hpp:35
static Eigen::Matrix< Format_t, 2, 1 > center(const Eigen::Matrix< Format_t, 3, 1 > &q, Format_t r)
Definition: trig_wrap.hpp:57
empty struct used to template "variant" of three arc primitives
Definition: types.h:43
static Format_t angleOf(const Eigen::Matrix< Format_t, 3, 1 > &q)
Definition: trig_wrap.hpp:44
empty struct used to template "right turn" primitive
Definition: types.h:37
Scalar rightAngleOf(const Scalar q_theta)
return the angle of the vector from the center of the clockwise (right) circle coincident to q...
Definition: funcs.hpp:107
provides static functions which call the appropriate trig function based in the template parameter sp...
Definition: trig_wrap.h:37
__host__ __device__ Format_t rightArc(Format_t a, Format_t b)
returns the clockwise (right) distance from a to b
Definition: funcs.hpp:85
static Format_t angleOf(const Eigen::Matrix< Format_t, 3, 1 > &q)
Definition: trig_wrap.hpp:62
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
Definition: funcs.hpp:76
empty struct used to template "left turn" primitive
Definition: types.h:34
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 ...
Definition: funcs.hpp:54
__host__ __device__ Format_t leftArc(Format_t a, Format_t b)
returns the counter clockwise (left) distance from a to b
Definition: funcs.hpp:64
static Format_t arc(Format_t a, Format_t b)
Definition: trig_wrap.hpp:55