Go to the documentation of this file.
2 #include <boost/version.hpp>
3 #if BOOST_VERSION > 105800
6 #include <boost/geometry/algorithms/relate.hpp>
8 #include <boost/geometry/algorithms/detail/relate/relate.hpp>
18 struct GetGeometry<T,
IfLL<T, void>> {
19 static inline auto twoD(
const T& geometry) {
return geometry.polygon2d().basicPolygon(); }
20 static inline auto threeD(
const T& geometry) {
return geometry.polygon3d().basicPolygon(); }
24 template <
typename LaneletT>
26 return boost::geometry::covered_by(point,
lanelet.polygon2d());
29 template <
typename LaneletT>
34 template <
typename LaneletT>
39 template <
typename LaneletT>
46 template <
typename LaneletT>
53 template <
typename Lanelet1T,
typename Lanelet2T>
55 if (
lanelet.constData() == otherLanelet.constData()) {
60 return intersects(
p1,
p2);
63 template <
typename Lanelet1T,
typename Lanelet2T>
65 if (
lanelet.constData() == otherLanelet.constData()) {
69 if (
lanelet.rightBound() == otherLanelet.leftBound() ||
lanelet.leftBound() == otherLanelet.rightBound() ||
70 lanelet.leftBound().invert() == otherLanelet.leftBound() ||
82 #if BOOST_VERSION > 105800
83 using Mask = boost::geometry::de9im::static_mask<'T', '*', '*', '*', '*', '*', '*', '*', '*'>;
84 return boost::geometry::relate(
p1,
p2, Mask());
87 using Mask = boost::geometry::detail::relate::static_mask<'T', '*', '*', '*', '*', '*', '*', '*', '*'>;
88 return boost::geometry::detail::relate::relate<Mask>(
p1,
p2);
92 template <
typename Lanelet1T,
typename Lanelet2T>
94 std::vector<double>* distanceThis, std::vector<double>* distanceOther) {
98 boost::geometry::intersection(centerline, otherCenterline, intersections);
99 if (distanceThis !=
nullptr) {
100 std::transform(intersections.begin(), intersections.end(), std::back_inserter(*distanceThis),
101 [¢erline](
const auto& elem) { return toArcCoordinates(centerline, elem).length; });
103 if (distanceOther !=
nullptr) {
104 std::transform(intersections.begin(), intersections.end(), std::back_inserter(*distanceOther),
105 [¢erline](
const auto& elem) { return toArcCoordinates(centerline, elem).length; });
107 return intersections;
110 template <
typename Lanelet1T,
typename Lanelet2T>
114 return std::abs(projPts.first.z() - projPts.second.z()) < heightTolerance;
119 template <
typename Lanelet1T,
typename Lanelet2T>
123 return std::abs(projPts.first.z() - projPts.second.z()) < heightTolerance;
128 template <
typename Lanelet1T,
typename Lanelet2T>
130 return left.rightBound() == right.leftBound();
133 template <
typename Lanelet1T,
typename Lanelet2T>
135 return leftOf(left, right);
138 template <
typename Lanelet1T,
typename Lanelet2T>
140 return !prev.leftBound().empty() && !prev.rightBound().empty() && !next.leftBound().empty() &&
141 !next.rightBound().empty() && prev.leftBound().back() == next.leftBound().front() &&
142 prev.rightBound().back() == next.rightBound().front();
145 template <
typename Lanelet1T,
typename Lanelet2T>
147 const Lanelet2T& other,
148 bool allowInverted) {
150 return ll.leftBound();
153 return ll.rightBound();
156 if (
leftOf(other.invert(), ll)) {
157 return ll.leftBound();
159 if (
rightOf(other.invert(), ll)) {
160 return ll.rightBound();
166 template <
typename LaneletT>
173 template <
typename LaneletT>
176 auto line =
lanelet.leftBound2d();
177 auto step = std::max(
size_t{1}, line.size() / 10);
178 for (
auto i1 =
size_t{}, i2 = step; i2 < line.size(); i1 += step, i2 += step) {
179 length +=
distance(line[i1], line[i2]);
180 if (i2 + step >= line.size()) {
181 length +=
distance(line[i2], line[line.size() - 1]);
187 template <
typename LaneletT>
189 return double(length(
lanelet.centerline2d()));
192 template <
typename LaneletT>
194 return double(length(
lanelet.centerline3d()));
double length2d(const LaneletT &lanelet)
calculate length of centerline in 2d
IfAr< Area1T, bool > intersects2d(const Area1T &area, const Area2T &otherArea)
test whether two areas intersect in 2d.
units::MPSQuantity Velocity
IfAr< AreaT, BoundingBox3d > boundingBox3d(const AreaT &area)
calculates 3d bounding box
units::MPS2Quantity Acceleration
bool follows(const ConstLanelet &prev, const ConstArea &next)
Test whether area follows lanelet.
double length3d(const LaneletT &lanelet)
calculate length of centerline in 3d
IfAr< AreaT, bool > inside(const AreaT &area, const BasicPoint2d &point)
Checks whether a point is within or at the border of a area.
std::enable_if_t< traits::isLaneletT< T >(), RetT > IfLL
Eigen::Vector3d BasicPoint3d
a simple 3d-point
constexpr auto toHybrid(const LineStringT ls)
IfLL< Lanelet1T, bool > intersects3d(const Lanelet1T &lanelet, const Lanelet2T &otherLanelet, double heightTolerance)
test whether two lanelets intersect in 2d.
static auto twoD(const T &geometry)
double approximatedLength2d(const LaneletT &lanelet)
approximates length by sampling points along left bound
double distanceToCenterline2d(const LaneletT &lanelet, const BasicPoint2d &point)
calculates distance in 2d to the centerline of a lanelet.
Axis-Aligned bounding box in 2d.
double distanceToCenterline3d(const LaneletT &lanelet, const BasicPoint3d &point)
calculates distance in 3d to centerline of a lanelet.
BoundingBox2d & extend(const Eigen::MatrixBase< Derived > &p)
auto transform(Container &&c, Func f)
Eigen::AlignedBox3d BoundingBox3d
Convenience type for an axis aligned bounding box in 3d.
Optional< ConstLineString3d > determineCommonLine(const ConstArea &ar, const ConstLanelet &ll)
Combines multiple linestrings to one polygon in 2d that returns BasicPoint2d.
BasicPoints2d intersectCenterlines2d(const Lanelet1T &lanelet, const Lanelet2T &otherLanelet, std::vector< double > *distanceThis, std::vector< double > *distanceOther)
calculates points of intersection between centerlines in 2d.
static auto threeD(const T &geometry)
IfAr< AreaT, bool > overlaps2d(const AreaT &area, const AreaT &otherArea)
Eigen::Matrix< double, 2, 1, Eigen::DontAlign > BasicPoint2d
a simple 2d-point
IfAr< AreaT, bool > overlaps3d(const AreaT &area, const AreaT &otherArea, double heightTolerance)
IfAr< AreaT, BoundingBox2d > boundingBox2d(const AreaT &area)
calculates an up-right 2d bounding box
bool leftOf(const ConstLanelet &right, const ConstArea &left)
Test whether area is left of lanelet.
Velocity maxCurveSpeed(const LaneletT &, const BasicPoint2d &, const Acceleration &)
calculates the maximum velocity without exceding a maximum lateral acceleration.
Generic lanelet error class. All errors lanelet2 will throw derive from this type.
Optional< double > distance
bool rightOf(const ConstLanelet &left, const ConstArea &area)
Test whether area is right of lanelet.
std::vector< Eigen::Vector2d, Eigen::aligned_allocator< Eigen::Vector2d > > BasicPoints2d
multiple simple 2d-points
IfLS< LineString3dT, std::pair< BasicPoint3d, BasicPoint3d > > projectedPoint3d(const LineString3dT &l1, const LineString3dT &l2)
Computes the projected points on the two linestrings for the shortest distance.
lanelet2_core
Author(s): Fabian Poggenhans
autogenerated on Thu Mar 6 2025 03:25:52