27 #ifndef MPBLOCKS_DUBINS_CURVES_CUDA2_SOLUTION_LSL_HPP_
28 #define MPBLOCKS_DUBINS_CURVES_CUDA2_SOLUTION_LSL_HPP_
35 namespace curves_cuda {
40 template <
typename Format_t>
64 template <
typename Format_t>
71 using namespace cuda::linalg2;
73 const Format_t _PI =
static_cast<Format_t
>(M_PI);
74 const Format_t
_2 =
static_cast<Format_t
>(2);
80 v << -Dispatch::sin( get<2>(q0) ),
81 Dispatch::cos( get<2>(q0) );
86 v << -Dispatch::sin( get<2>(q1) ),
87 Dispatch::cos( get<2>(q1) );
99 Format_t
a = Dispatch::atan2( get<1>(v), get<0>(v) );
103 v << Dispatch::cos(
a - (_PI/
_2) ),
104 Dispatch::sin(
a - (_PI/
_2) );
112 l[0] =
ccwArc( get<2>(q0),
a );
113 l[1] =
ccwArc(
a, get<2>(q1) );
115 return Result_t( r*(l[0] + l[1]) + l[2] );
132 template <
typename Format_t>
140 using namespace cuda::linalg2;
142 const Format_t _PI =
static_cast<Format_t
>(M_PI);
143 const Format_t
_2 =
static_cast<Format_t
>(2);
149 v << -Dispatch::sin( get<2>(q0) ),
150 Dispatch::cos( get<2>(q0) );
155 v << -Dispatch::sin( get<2>(q1) ),
156 Dispatch::cos( get<2>(q1) );
168 Format_t
a = Dispatch::atan2( get<1>(v), get<0>(v) );
172 v << Dispatch::cos(
a - (_PI/
_2) ),
173 Dispatch::sin(
a - (_PI/
_2) );
178 for(
int i=0; i < 2; i++)
180 out.
t[i] = c[i] +
mktmp(r*v);
186 l[0] =
ccwArc( get<2>(q0),
a );
187 l[1] =
ccwArc(
a, get<2>(q1) );
192 for(
int i=0; i < 3; i++)
195 return Result_t( r*(l[0] + l[1]) + l[2] );
217 #endif // SOLUTION_LSL_H_
__device__ __host__ Matrix< Scalar, ROWS, COLS > mktmp(RValue< Scalar, ROWS, COLS, Exp > const &M)
forces the creation of a temporary
__host__ __device__ Format_t ccwArc(Format_t a, Format_t b)
returns the counter clockwise (left) distance from a to b
empty struct used to template "variant" of three arc primitives
Encapsulates the solution distance along with a feasibility bit for a particular primitive solution...
__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
static Result< Format_t > solve(const Vector3d_t &q0, const Vector3d_t &q1, const Format_t r)
basic interface returns only the total distance
interface for different solutions