lanelet2_route_planning v2.0.0
Loading...
Searching...
No Matches
geometry.hpp
Go to the documentation of this file.
1// Copyright Institute for Automotive Engineering (ika), RWTH Aachen University
2// SPDX-License-Identifier: Apache-2.0
3
4#pragma once
5
6#include <optional>
7#include <vector>
8
9#include <Eigen/Core>
10
12
19double wrapAngle(const double angle);
20
30double angleBetweenVectors(const Eigen::Vector2d& v1, const Eigen::Vector2d& v2);
31
40
48std::optional<IntersectionOfLinesResult> intersectionOfLines(const std::vector<Eigen::Vector2d>& line1,
49 const std::vector<Eigen::Vector2d>& line2);
50
64Eigen::Vector2d tangentOfPointAlongLineString(const Eigen::Vector2d& point,
65 const Eigen::Vector2d& prev_point,
66 const Eigen::Vector2d& next_point);
67
78Eigen::Vector2d normalOfPointAlongLineString(const Eigen::Vector2d& point,
79 const Eigen::Vector2d& prev_point,
80 const Eigen::Vector2d& next_point);
81
92std::vector<Eigen::Vector3d> resampleLineString(const std::vector<Eigen::Vector3d>& line_string,
93 const double delta,
94 double& offset);
95
108std::vector<size_t> adaptivelySampleLineString(const std::vector<Eigen::Vector2d>& line_string,
109 double max_lateral_error,
110 const std::vector<size_t>& break_after_indices = {});
111
119Eigen::Vector2d projectPointToLineString(const Eigen::Vector2d& point, const std::vector<Eigen::Vector2d>& line_string);
120
128Eigen::Vector3d projectPointToLineString(const Eigen::Vector3d& point, const std::vector<Eigen::Vector3d>& line_string);
129
137
146std::optional<ProjectPointToLineStringAlongAxisResult> projectPointToLineStringAlongAxis(
147 const Eigen::Vector2d& point, const Eigen::Vector2d& axis, const std::vector<Eigen::Vector2d>& line_string);
148
158std::optional<ProjectPointToLineStringAlongAxisResult> projectPointToLineStringAlongNormal(
159 const Eigen::Vector2d& point,
160 const Eigen::Vector2d& prev_point,
161 const Eigen::Vector2d& next_point,
162 const std::vector<Eigen::Vector2d>& line_string);
163
164} // namespace lanelet2_route_planning
std::optional< ProjectPointToLineStringAlongAxisResult > projectPointToLineStringAlongAxis(const Eigen::Vector2d &point, const Eigen::Vector2d &axis, const std::vector< Eigen::Vector2d > &line_string)
Projects a point along an axis to the closest line segment of a line string.
Definition geometry.cpp:239
std::optional< ProjectPointToLineStringAlongAxisResult > projectPointToLineStringAlongNormal(const Eigen::Vector2d &point, const Eigen::Vector2d &prev_point, const Eigen::Vector2d &next_point, const std::vector< Eigen::Vector2d > &line_string)
Projects a point to the closest line segment of a line string along the normal to the tangent at the ...
Definition geometry.cpp:279
double angleBetweenVectors(const Eigen::Vector2d &v1, const Eigen::Vector2d &v2)
Computes the angle between two 2D vectors.
Definition geometry.cpp:80
Eigen::Vector2d tangentOfPointAlongLineString(const Eigen::Vector2d &point, const Eigen::Vector2d &prev_point, const Eigen::Vector2d &next_point)
Computes a unit vector tangential to a point along a line string.
Definition geometry.cpp:123
Eigen::Vector2d projectPointToLineString(const Eigen::Vector2d &point, const std::vector< Eigen::Vector2d > &line_string)
Projects a point to the closest line segment of a line string.
Definition geometry.cpp:231
std::vector< size_t > adaptivelySampleLineString(const std::vector< Eigen::Vector2d > &line_string, double max_lateral_error, const std::vector< size_t > &break_after_indices={})
Simplifies a 2D line string within a maximum lateral error.
Definition geometry.cpp:188
double wrapAngle(const double angle)
Wraps an angle to the range [-π, π].
Definition geometry.cpp:73
Eigen::Vector2d normalOfPointAlongLineString(const Eigen::Vector2d &point, const Eigen::Vector2d &prev_point, const Eigen::Vector2d &next_point)
Computes a unit vector normal to a point along a line string.
Definition geometry.cpp:143
std::vector< Eigen::Vector3d > resampleLineString(const std::vector< Eigen::Vector3d > &line_string, const double delta, double &offset)
Resamples a 3D line string with a constant sampling distance.
Definition geometry.cpp:152
std::optional< IntersectionOfLinesResult > intersectionOfLines(const std::vector< Eigen::Vector2d > &line1, const std::vector< Eigen::Vector2d > &line2)
Computes the intersection of two 2D lines.
Definition geometry.cpp:87
Return type of intersectionOfLines.
Definition geometry.hpp:35
bool intersects_line2
whether intersection is on second line segment
Definition geometry.hpp:38
bool intersects_line1
whether intersection is on first line segment
Definition geometry.hpp:37
Eigen::Vector2d intersection
intersection point
Definition geometry.hpp:36
Return type of projectPointToLineStringAlongAxis.
Definition geometry.hpp:133
bool found_intersection_with_line_segment
whether intersection is on line segment
Definition geometry.hpp:135