27 #ifndef MPBLOCKS_DUBINS_CURVES_CUDA2_SOLUTION_RSL_HPP_
28 #define MPBLOCKS_DUBINS_CURVES_CUDA2_SOLUTION_RSL_HPP_
35 namespace curves_cuda {
41 template <
typename Format_t>
65 template <
typename Format_t>
72 using namespace cuda::linalg2;
74 const Format_t _PI =
static_cast<Format_t
>(M_PI);
75 const Format_t
_2 =
static_cast<Format_t
>(2);
81 v << Dispatch::sin( get<2>(q0) ),
82 -Dispatch::cos( get<2>(q0) );
87 v << -Dispatch::sin( get<2>(q1) ),
88 Dispatch::cos( get<2>(q1) );
95 Format_t d =
norm( v );
104 Format_t
a = Dispatch::acos(
_2*r / d );
112 t[0] = c[0] +
mktmp( n*r );
113 t[1] = c[1] -
mktmp( n*r );
120 a = Dispatch::atan2( get<1>(n), get<0>(n) );
129 l[2] =
norm(t[0]-t[1]);
131 return Result_t( r*(l[0] + l[1]) + l[2] );
146 template <
typename Format_t>
154 using namespace cuda::linalg2;
156 const Format_t _PI =
static_cast<Format_t
>(M_PI);
157 const Format_t
_2 =
static_cast<Format_t
>(2);
162 x = view<0,2> ( q0 );
163 v << Dispatch::sin( get<2>(q0) ),
164 -Dispatch::cos( get<2>(q0) );
169 v << -Dispatch::sin( get<2>(q1) ),
170 Dispatch::cos( get<2>(q1) );
177 Format_t d =
norm( v );
186 Format_t
a = Dispatch::acos(
_2*r / d );
194 t[0] = c[0] +
mktmp( n*r );
195 t[1] = c[1] -
mktmp( n*r );
202 a = Dispatch::atan2( get<1>(n), get<0>(n) );
211 l[2] =
norm(t[0]-t[1]);
216 for(
int i=0; i < 2; i++)
225 for(
int i=0; i < 3; i++)
228 return Result_t( r*(l[0] + l[1]) + l[2] );
250 #endif // SOLUTIONLRLA_H_
__host__ __device__ Format_t cwArc(Format_t a, Format_t b)
returns the clockwise (right) distance from a to b
__device__ __host__ Normalize< Scalar, Exp > normalize(RValue< Scalar, Exp > const &A)
empty struct used to template "variant" of three arc primitives
__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
empty struct used to template "right turn" primitive
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