88 double heading()
const {
return heading_; }
179 Vec2d *
const point)
const;
209 Vec2d *
const foot_point)
const;
220 Vec2d unit_direction_;
221 double heading_ = 0.0;
222 double length_ = 0.0;
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.
bool HasIntersect(const LineSegment2d &other_segment) const
Check if the line segment has an intersect with another line segment in 2-D.
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.
double sin_heading() const
Get the sine of the heading.
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.
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.
Vec2d rotate(const double angle)
Get a new line-segment with the same start point, but rotated counterclock-wise by the given amount.
double cos_heading() const
Get the cosine of the heading.
double length() const
Get the length of the line segment.
LineSegment2d()
Empty constructor.
bool GetIntersect(const LineSegment2d &other_segment, Vec2d *const point) const
Compute the intersect with another line segment in 2-D if any.
double DistanceTo(const Vec2d &point) const
Compute the shortest distance from a point on the line segment to a point in 2-D.
const Vec2d & start() const
Get the start point.
double length_sqr() const
Get the square of length of the line segment.
std::string DebugString() const
Get the debug string including the essential information.
Vec2d center() const
Get the center of the line segment.
bool IsPointIn(const Vec2d &point) const
Check if a point is within the line segment.
double heading() const
Get the heading of the line segment.
Implements a class of 2-dimensional vectors.
double y() const
Getter for y component
double x() const
Getter for x component