@@ -27,7 +27,7 @@ namespace math
27
27
namespace geometry
28
28
{
29
29
auto CatmullRomSpline::getPolygon (
30
- const double width, const size_t num_points, const double z_offset)
30
+ const double width, const std:: size_t num_points, const double z_offset)
31
31
-> std::vector<geometry_msgs::msg::Point>
32
32
{
33
33
if (num_points == 0 ) {
@@ -36,7 +36,7 @@ auto CatmullRomSpline::getPolygon(
36
36
std::vector<geometry_msgs::msg::Point> points;
37
37
std::vector<geometry_msgs::msg::Point> left_bounds = getLeftBounds (width, num_points, z_offset);
38
38
std::vector<geometry_msgs::msg::Point> right_bounds = getRightBounds (width, num_points, z_offset);
39
- for (size_t i = 0 ; i < left_bounds.size () - 1 ; i++) {
39
+ for (std:: size_t i = 0 ; i < left_bounds.size () - 1 ; i++) {
40
40
geometry_msgs::msg::Point pr_0 = right_bounds[i];
41
41
geometry_msgs::msg::Point pl_0 = left_bounds[i];
42
42
geometry_msgs::msg::Point pr_1 = right_bounds[i + 1 ];
@@ -52,12 +52,12 @@ auto CatmullRomSpline::getPolygon(
52
52
}
53
53
54
54
auto CatmullRomSpline::getRightBounds (
55
- const double width, const size_t num_points, const double z_offset) const
55
+ const double width, const std:: size_t num_points, const double z_offset) const
56
56
-> std::vector<geometry_msgs::msg::Point>
57
57
{
58
58
std::vector<geometry_msgs::msg::Point> points;
59
59
double step_size = getLength () / static_cast <double >(num_points);
60
- for (size_t i = 0 ; i < num_points + 1 ; i++) {
60
+ for (std:: size_t i = 0 ; i < num_points + 1 ; i++) {
61
61
double s = step_size * static_cast <double >(i);
62
62
points.emplace_back (
63
63
[this ](const double local_width, const double local_s, const double local_z_offset) {
@@ -75,12 +75,12 @@ auto CatmullRomSpline::getRightBounds(
75
75
}
76
76
77
77
auto CatmullRomSpline::getLeftBounds (
78
- const double width, const size_t num_points, const double z_offset) const
78
+ const double width, const std:: size_t num_points, const double z_offset) const
79
79
-> std::vector<geometry_msgs::msg::Point>
80
80
{
81
81
std::vector<geometry_msgs::msg::Point> points;
82
82
double step_size = getLength () / static_cast <double >(num_points);
83
- for (size_t i = 0 ; i < num_points + 1 ; i++) {
83
+ for (std:: size_t i = 0 ; i < num_points + 1 ; i++) {
84
84
double s = step_size * static_cast <double >(i);
85
85
points.emplace_back (
86
86
[this ](const double local_width, const double local_s, const double local_z_offset) {
@@ -142,8 +142,8 @@ CatmullRomSpline::CatmullRomSpline(const std::vector<geometry_msgs::msg::Point>
142
142
// / @note In this case, spline is interpreted as curve.
143
143
default :
144
144
[this ](const auto & control_points) -> void {
145
- size_t n = control_points.size () - 1 ;
146
- for (size_t i = 0 ; i < n; i++) {
145
+ std:: size_t n = control_points.size () - 1 ;
146
+ for (std:: size_t i = 0 ; i < n; i++) {
147
147
if (i == 0 ) {
148
148
double ax = 0 ;
149
149
double bx = control_points[0 ].x - 2 * control_points[1 ].x + control_points[2 ].x ;
@@ -244,7 +244,7 @@ CatmullRomSpline::CatmullRomSpline(const std::vector<geometry_msgs::msg::Point>
244
244
}
245
245
}
246
246
247
- auto CatmullRomSpline::getCurveIndexAndS (const double s) const -> std::pair<size_t, double>
247
+ auto CatmullRomSpline::getCurveIndexAndS (const double s) const -> std::pair<std:: size_t, double>
248
248
{
249
249
if (s < 0 ) {
250
250
return std::make_pair (0 , s);
@@ -254,7 +254,7 @@ auto CatmullRomSpline::getCurveIndexAndS(const double s) const -> std::pair<size
254
254
curves_.size () - 1 , s - (total_length_ - curves_[curves_.size () - 1 ].getLength ()));
255
255
}
256
256
double current_s = 0 ;
257
- for (size_t i = 0 ; i < curves_.size (); i++) {
257
+ for (std:: size_t i = 0 ; i < curves_.size (); i++) {
258
258
double prev_s = current_s;
259
259
current_s = current_s + length_list_[i];
260
260
if (prev_s <= s && s < current_s) {
@@ -264,11 +264,12 @@ auto CatmullRomSpline::getCurveIndexAndS(const double s) const -> std::pair<size
264
264
THROW_SIMULATION_ERROR (" failed to calculate curve index" ); // LCOV_EXCL_LINE
265
265
}
266
266
267
- auto CatmullRomSpline::getSInSplineCurve (const size_t curve_index, const double s) const -> double
267
+ auto CatmullRomSpline::getSInSplineCurve (const std::size_t curve_index, const double s) const
268
+ -> double
268
269
{
269
- size_t n = curves_.size ();
270
+ std:: size_t n = curves_.size ();
270
271
double ret = 0 ;
271
- for (size_t i = 0 ; i < n; i++) {
272
+ for (std:: size_t i = 0 ; i < n; i++) {
272
273
if (i == curve_index) {
273
274
return ret + s;
274
275
} else {
@@ -295,7 +296,7 @@ auto CatmullRomSpline::getCollisionPointsIn2D(
295
296
const auto local_search_backward) {
296
297
std::set<double > s_value_candidates;
297
298
auto current_curve_start_s = 0.0 ;
298
- for (size_t i = 0 ; i < curves_.size (); ++i) {
299
+ for (std:: size_t i = 0 ; i < curves_.size (); ++i) {
299
300
if (
300
301
s_range == std::nullopt ||
301
302
(current_curve_start_s >= s_range->first && current_curve_start_s <= s_range->second )) {
@@ -383,17 +384,17 @@ auto CatmullRomSpline::getCollisionPointIn2D(
383
384
const geometry_msgs::msg::Point & point0, const geometry_msgs::msg::Point & point1,
384
385
const bool search_backward) const -> std::optional<double>
385
386
{
386
- size_t n = curves_.size ();
387
+ std:: size_t n = curves_.size ();
387
388
if (search_backward) {
388
- for (size_t i = 0 ; i < n; i++) {
389
+ for (std:: size_t i = 0 ; i < n; i++) {
389
390
auto s = curves_[n - 1 - i].getCollisionPointIn2D (point0, point1, search_backward, true );
390
391
if (s) {
391
392
return getSInSplineCurve (n - 1 - i, s.value ());
392
393
}
393
394
}
394
395
return std::nullopt ;
395
396
} else {
396
- for (size_t i = 0 ; i < n; i++) {
397
+ for (std:: size_t i = 0 ; i < n; i++) {
397
398
auto s = curves_[i].getCollisionPointIn2D (point0, point1, search_backward, true );
398
399
if (s) {
399
400
return getSInSplineCurve (i, s.value ());
@@ -435,7 +436,7 @@ auto CatmullRomSpline::getSValue(
435
436
return line_segments_[0 ].getSValue (pose, threshold_distance, true );
436
437
default :
437
438
double s = 0 ;
438
- for (size_t i = 0 ; i < curves_.size (); i++) {
439
+ for (std:: size_t i = 0 ; i < curves_.size (); i++) {
439
440
auto s_value = curves_[i].getSValue (pose, threshold_distance, true );
440
441
if (s_value) {
441
442
s = s + s_value.value ();
@@ -692,7 +693,7 @@ auto CatmullRomSpline::checkConnection() const -> bool
692
693
THROW_SIMULATION_ERROR ( // LCOV_EXCL_LINE
693
694
" number of control points and curves does not match." ); // LCOV_EXCL_LINE
694
695
}
695
- for (size_t i = 0 ; i < curves_.size (); i++) {
696
+ for (std:: size_t i = 0 ; i < curves_.size (); i++) {
696
697
const auto control_point0 = control_points[i];
697
698
const auto control_point1 = control_points[i + 1 ];
698
699
const auto p0 = curves_[i].getPoint (0 , false );
0 commit comments