selfdriving
within_bbox.h
Go to the documentation of this file.
1 /* -------------------------------------------------------------------------
2  * SelfDriving C++ library based on PTGs and mrpt-nav
3  * Copyright (C) 2019-2022 Jose Luis Blanco, University of Almeria
4  * See LICENSE for license information.
5  * ------------------------------------------------------------------------- */
6 
7 #pragma once
8 
9 #include <mrpt/math/TPose2D.h>
10 
11 namespace mpp
12 {
13 static inline bool within_bbox(
14  const mrpt::math::TPose2D& p, const mrpt::math::TPose2D& max,
15  const mrpt::math::TPose2D& min)
16 {
17  return p.x < max.x && p.y < max.y && p.phi < max.phi + 1e-6 && //
18  p.x > min.x && p.y > min.y && p.phi > min.phi - 1e-6;
19 }
20 
21 static inline bool within_bbox(
22  const mrpt::math::TPoint2D& p, const mrpt::math::TPose2D& max,
23  const mrpt::math::TPose2D& min)
24 {
25  return p.x < max.x && p.y < max.y && //
26  p.x > min.x && p.y > min.y;
27 }
28 
29 } // namespace mpp
Definition: bestTrajectory.h:15