31 const double L = u.
norm();
44 const double b = -2 * u.
x*(o.
x - p0.
x) - 2 * u.
y*(o.
y - p0.
y);
50 if (nsols <= 0)
return false;
52 if (nsols == 1) r_min = r1;
else {
53 if (r1 < 0 && r2 < 0)
return false;
65 if (r_min > L)
return false;
73 const double arc_radius,
const double R,
80 const double center2obs_dist = (ptArcCenter - o).
norm();
81 if (std::abs(center2obs_dist - std::abs(arc_radius))>
R)
85 const double r = arc_radius;
86 const double discr = (
R*
r*2.0 - o.
y*
r*2.0 -
R*
R + o.
x*o.
x + o.
y*o.
y)*(
R*
r*2.0 + o.
y*
r*2.0 +
R*
R - o.
x*o.
x - o.
y*o.
y);
89 const double sol_x0 = ((
R*
R)*(-1.0 / 2.0) + (o.
x*o.
x)*(1.0 / 2.0) + (o.
y*o.
y)*(1.0 / 2.0) - (o.
y*(-(
R*
R)*o.
y + (
R*
R)*
r + (o.
x*o.
x)*o.
y + (o.
x*o.
x)*
r - (o.
y*o.
y)*
r + o.
y*o.
y*o.
y + o.
x*sqrt(discr))*(1.0 / 2.0)) / (o.
y*
r*-2.0 + o.
x*o.
x + o.
y*o.
y +
r*
r) + (
r*(-(
R*
R)*o.
y + (
R*
R)*
r + (o.
x*o.
x)*o.
y + (o.
x*o.
x)*
r - (o.
y*o.
y)*
r + o.
y*o.
y*o.
y + o.
x*sqrt(discr))*(1.0 / 2.0)) / (o.
y*
r*-2.0 + o.
x*o.
x + o.
y*o.
y +
r*
r)) / o.
x;
90 const double sol_x1 = ((
R*
R)*(-1.0 / 2.0) + (o.
x*o.
x)*(1.0 / 2.0) + (o.
y*o.
y)*(1.0 / 2.0) - (o.
y*(-(
R*
R)*o.
y + (
R*
R)*
r + (o.
x*o.
x)*o.
y + (o.
x*o.
x)*
r - (o.
y*o.
y)*
r + o.
y*o.
y*o.
y - o.
x*sqrt(discr))*(1.0 / 2.0)) / (o.
y*
r*-2.0 + o.
x*o.
x + o.
y*o.
y +
r*
r) + (
r*(-(
R*
R)*o.
y + (
R*
R)*
r + (o.
x*o.
x)*o.
y + (o.
x*o.
x)*
r - (o.
y*o.
y)*
r + o.
y*o.
y*o.
y - o.
x*sqrt(discr))*(1.0 / 2.0)) / (o.
y*
r*-2.0 + o.
x*o.
x + o.
y*o.
y +
r*
r)) / o.
x;
93 const double sol_y0 = ((
R*
R)*o.
y*(-1.0 / 2.0) + (
R*
R)*
r*(1.0 / 2.0) + (o.
x*o.
x)*o.
y*(1.0 / 2.0) + (o.
x*o.
x)*
r*(1.0 / 2.0) - (o.
y*o.
y)*
r*(1.0 / 2.0) + (o.
y*o.
y*o.
y)*(1.0 / 2.0) + o.
x*sqrt(discr)*(1.0 / 2.0)) / (o.
y*
r*-2.0 + o.
x*o.
x + o.
y*o.
y +
r*
r);
94 const double sol_y1 = ((
R*
R)*o.
y*(-1.0 / 2.0) + (
R*
R)*
r*(1.0 / 2.0) + (o.
x*o.
x)*o.
y*(1.0 / 2.0) + (o.
x*o.
x)*
r*(1.0 / 2.0) - (o.
y*o.
y)*
r*(1.0 / 2.0) + (o.
y*o.
y*o.
y)*(1.0 / 2.0) - o.
x*sqrt(discr)*(1.0 / 2.0)) / (o.
y*
r*-2.0 + o.
x*o.
x + o.
y*o.
y +
r*
r);
98 double th0 = atan2(sol0.x - ptArcCenter.
x, -( sol0.y - ptArcCenter.
y));
99 double th1 = atan2(sol1.
x - ptArcCenter.
x, -(sol1.
y - ptArcCenter.
y));
112 out_col_dist = std::abs(
r)*
std::min(th0, th1);
#define ASSERT_ABOVE_(__A, __B)
bool NAV_IMPEXP collision_free_dist_arc_circ_robot(const double arc_radius, const double robot_radius, const mrpt::math::TPoint2D &obstacle, double &out_col_dist)
Computes the collision-free distance for a forward path (+X) circular arc path segment from pose (0...
T square(const T x)
Inline function for the square of a number.
This base provides a set of functions for maths stuff.
T wrapTo2Pi(T a)
Modifies the given angle to translate it into the [0,2pi[ range.
bool NAV_IMPEXP collision_free_dist_segment_circ_robot(const mrpt::math::TPoint2D &p_start, const mrpt::math::TPoint2D &p_end, const double robot_radius, const mrpt::math::TPoint2D &obstacle, double &out_col_dist)
Computes the collision-free distance for a linear segment path between two points, for a circular robot, and a point obstacle (ox,oy).
double norm() const
Point norm.
This is the global namespace for all Mobile Robot Programming Toolkit (MRPT) libraries.
GLdouble GLdouble GLdouble r
int BASE_IMPEXP solve_poly2(double a, double b, double c, double &r1, double &r2) MRPT_NO_THROWS
Solves equation a*x^2 + b*x + c = 0.
GLubyte GLubyte GLubyte a
CONTAINER::Scalar norm(const CONTAINER &v)