Apollo 10.0
自动驾驶开放平台
|
Line segment in 2-D. 更多...
#include <line_segment2d.h>
Public 成员函数 | |
LineSegment2d () | |
Empty constructor. | |
LineSegment2d (const Vec2d &start, const Vec2d &end) | |
Constructor with start point and end point. | |
const Vec2d & | start () const |
Get the start point. | |
const Vec2d & | end () const |
Get the end point. | |
const Vec2d & | unit_direction () const |
Get the unit direction from the start point to the end point. | |
Vec2d | center () const |
Get the center of the line segment. | |
Vec2d | rotate (const double angle) |
Get a new line-segment with the same start point, but rotated counterclock-wise by the given amount. | |
double | heading () const |
Get the heading of the line segment. | |
double | cos_heading () const |
Get the cosine of the heading. | |
double | sin_heading () const |
Get the sine of the heading. | |
double | length () const |
Get the length of the line segment. | |
double | length_sqr () const |
Get the square of length of the line segment. | |
double | DistanceTo (const Vec2d &point) const |
Compute the shortest distance from a point on the line segment to a point in 2-D. | |
double | DistanceTo (const Vec2d &point, Vec2d *const nearest_pt) const |
Compute the shortest distance from a point on the line segment to a point in 2-D, and get the nearest point on the line segment. | |
double | DistanceSquareTo (const Vec2d &point) const |
Compute the square of the shortest distance from a point on the line segment to a point in 2-D. | |
double | DistanceSquareTo (const Vec2d &point, Vec2d *const nearest_pt) const |
Compute the square of the shortest distance from a point on the line segment to a point in 2-D, and get the nearest point on the line segment. | |
bool | IsPointIn (const Vec2d &point) const |
Check if a point is within the line segment. | |
bool | HasIntersect (const LineSegment2d &other_segment) const |
Check if the line segment has an intersect with another line segment in 2-D. | |
bool | GetIntersect (const LineSegment2d &other_segment, Vec2d *const point) const |
Compute the intersect with another line segment in 2-D if any. | |
double | ProjectOntoUnit (const Vec2d &point) const |
Compute the projection of a vector onto the line segment. | |
double | ProductOntoUnit (const Vec2d &point) const |
Compute the cross product of a vector onto the line segment. | |
double | GetPerpendicularFoot (const Vec2d &point, Vec2d *const foot_point) const |
Compute perpendicular foot of a point in 2-D on the straight line expanded from the line segment. | |
std::string | DebugString () const |
Get the debug string including the essential information. | |
Line segment in 2-D.
在文件 line_segment2d.h 第 40 行定义.
apollo::common::math::LineSegment2d::LineSegment2d | ( | ) |
Constructor with start point and end point.
start | The start point of the line segment. |
end | The end point of the line segment. |
在文件 line_segment2d.cc 第 44 行定义.
|
inline |
Get the center of the line segment.
在文件 line_segment2d.h 第 76 行定义.
|
inline |
std::string apollo::common::math::LineSegment2d::DebugString | ( | ) | const |
Get the debug string including the essential information.
在文件 line_segment2d.cc 第 222 行定义.
double apollo::common::math::LineSegment2d::DistanceSquareTo | ( | const Vec2d & | point | ) | const |
Compute the square of the shortest distance from a point on the line segment to a point in 2-D.
point | The point to compute the squared of the distance to. |
在文件 line_segment2d.cc 第 103 行定义.
double apollo::common::math::LineSegment2d::DistanceSquareTo | ( | const Vec2d & | point, |
Vec2d *const | nearest_pt | ||
) | const |
Compute the square of the shortest distance from a point on the line segment to a point in 2-D, and get the nearest point on the line segment.
point | The point to compute the squared of the distance to. |
nearest_pt | The nearest point on the line segment to the input point. |
在文件 line_segment2d.cc 第 119 行定义.
double apollo::common::math::LineSegment2d::DistanceTo | ( | const Vec2d & | point | ) | const |
Compute the shortest distance from a point on the line segment to a point in 2-D.
point | The point to compute the distance to. |
在文件 line_segment2d.cc 第 65 行定义.
double apollo::common::math::LineSegment2d::DistanceTo | ( | const Vec2d & | point, |
Vec2d *const | nearest_pt | ||
) | const |
Compute the shortest distance from a point on the line segment to a point in 2-D, and get the nearest point on the line segment.
point | The point to compute the distance to. |
nearest_pt | The nearest point on the line segment to the input point. |
在文件 line_segment2d.cc 第 81 行定义.
|
inline |
Get the end point.
在文件 line_segment2d.h 第 64 行定义.
bool apollo::common::math::LineSegment2d::GetIntersect | ( | const LineSegment2d & | other_segment, |
Vec2d *const | point | ||
) | const |
Compute the intersect with another line segment in 2-D if any.
other_segment | The line segment to compute the intersect. |
point | the computed intersect between the line segment and the input other_segment. |
在文件 line_segment2d.cc 第 167 行定义.
double apollo::common::math::LineSegment2d::GetPerpendicularFoot | ( | const Vec2d & | point, |
Vec2d *const | foot_point | ||
) | const |
Compute perpendicular foot of a point in 2-D on the straight line expanded from the line segment.
point | The point to compute the perpendicular foot from. |
foot_point | The computed perpendicular foot from the input point to the straight line expanded from the line segment. |
在文件 line_segment2d.cc 第 208 行定义.
bool apollo::common::math::LineSegment2d::HasIntersect | ( | const LineSegment2d & | other_segment | ) | const |
Check if the line segment has an intersect with another line segment in 2-D.
other_segment | The line segment to check if it has an intersect. |
在文件 line_segment2d.cc 第 162 行定义.
|
inline |
Get the heading of the line segment.
在文件 line_segment2d.h 第 88 行定义.
bool apollo::common::math::LineSegment2d::IsPointIn | ( | const Vec2d & | point | ) | const |
Check if a point is within the line segment.
point | The point to check if it is within the line segment. |
在文件 line_segment2d.cc 第 141 行定义.
double apollo::common::math::LineSegment2d::length | ( | ) | const |
Get the length of the line segment.
在文件 line_segment2d.cc 第 61 行定义.
double apollo::common::math::LineSegment2d::length_sqr | ( | ) | const |
Get the square of length of the line segment.
在文件 line_segment2d.cc 第 63 行定义.
double apollo::common::math::LineSegment2d::ProductOntoUnit | ( | const Vec2d & | point | ) | const |
Compute the cross product of a vector onto the line segment.
point | The end of the vector (starting from the start point of the line segment) to compute the cross product onto the line segment. |
在文件 line_segment2d.cc 第 158 行定义.
double apollo::common::math::LineSegment2d::ProjectOntoUnit | ( | const Vec2d & | point | ) | const |
Compute the projection of a vector onto the line segment.
point | The end of the vector (starting from the start point of the line segment) to compute the projection onto the line segment. |
在文件 line_segment2d.cc 第 154 行定义.
Vec2d apollo::common::math::LineSegment2d::rotate | ( | const double | angle | ) |
Get a new line-segment with the same start point, but rotated counterclock-wise by the given amount.
在文件 line_segment2d.cc 第 55 行定义.
|
inline |
|
inline |
Get the start point.
在文件 line_segment2d.h 第 58 行定义.
|
inline |
Get the unit direction from the start point to the end point.
在文件 line_segment2d.h 第 70 行定义.