32#ifndef RCSC_GEOM_SEGMENT2D_H
33#define RCSC_GEOM_SEGMENT2D_H
49 static const double EPSILON;
50 static const double CALC_ERROR;
58 bool checkIntersectsOnLine(
const Vector2D & p )
const;
80 const double origin_y,
81 const double terminal_x,
82 const double terminal_y )
83 : M_origin( origin_x, origin_y ),
84 M_terminal( terminal_x, terminal_y )
123 const double origin_y,
124 const double terminal_x,
125 const double terminal_y )
127 M_origin.
assign( origin_x, origin_y );
128 M_terminal.
assign( terminal_x, terminal_y );
213 M_origin = M_terminal;
295 const bool allow_end_point )
const;
408 std::ostream &
print( std::ostream & os )
const
degree wrapper class
Definition: angle_deg.h:45
2d straight line class
Definition: line_2d.h:47
static Line2D perpendicular_bisector(const Vector2D &p1, const Vector2D &p2)
make perpendicular bisector line from twt points
2d segment line class
Definition: segment_2d.h:46
const Segment2D & reverse()
swap segment edge point. This method is equivalent to swap(), provided for convenience.
Definition: segment_2d.h:222
Vector2D projection(const Vector2D &p) const
calculates projection point from p
bool existIntersection(const Line2D &l) const
check if this line segment intersects with target line.
double dist(const Vector2D &p) const
get minimum distance between this segment and point
double farthestDist(const Vector2D &p) const
get maximum distance between this segment and point
const Segment2D & assign(const Vector2D &origin, const double length, const AngleDeg &dir)
construct using origin, direction and length
Definition: segment_2d.h:139
bool contains(const Vector2D &p) const
check if the point is within the rectangle defined by this segment as a diagonal line.
Definition: segment_2d.h:250
const Vector2D & terminal() const
get 2nd point of segment edge
Definition: segment_2d.h:171
bool intersects(const Line2D &l) const
check if this line segment intersects with target line.
Definition: segment_2d.h:355
bool isValid() const
check if this line segment is valid or not. origin's coodinates value have to be different from termi...
Definition: segment_2d.h:153
const Segment2D & swap()
swap segment edge point
Definition: segment_2d.h:209
bool onSegment(const Vector2D &p) const
strictly check if point is on segment or not
double length() const
get the length of this segment
Definition: segment_2d.h:189
const Segment2D & assign(const double origin_x, const double origin_y, const double terminal_x, const double terminal_y)
construct directly using raw coordinate values
Definition: segment_2d.h:122
Vector2D nearestPoint(const Vector2D &p) const
get a point on segment where distance of point is minimal.
Segment2D reversedSegment() const
get the reversed line segment.
Definition: segment_2d.h:231
bool existIntersection(const Segment2D &other) const
check if segments cross each other or not.
AngleDeg direction() const
get the direction angle of this line segment
Definition: segment_2d.h:198
bool onSegmentWeakly(const Vector2D &p) const
weakly check if point is on segment or not
bool equals(const Segment2D &other) const
check if this line segment has completely same value as input line segment.
Definition: segment_2d.h:261
Line2D perpendicularBisector() const
make perpendicular bisector line from segment points
Definition: segment_2d.h:240
bool intersectsExceptEndpoint(const Segment2D &other) const
check if segments intersect each other on non terminal point.
Definition: segment_2d.h:338
Line2D line() const
get line generated from segment
Definition: segment_2d.h:180
std::ostream & print(std::ostream &os) const
print data to an output stream.
Definition: segment_2d.h:408
Segment2D(const Vector2D &origin, const double length, const AngleDeg &dir)
construct using origin, direction and length
Definition: segment_2d.h:93
bool existIntersectionExceptEndpoint(const Segment2D &other) const
check if segments intersect each other on non terminal point.
Segment2D(const Vector2D &origin, const Vector2D &terminal)
construct from 2 points
Definition: segment_2d.h:66
Segment2D(const double origin_x, const double origin_y, const double terminal_x, const double terminal_y)
construct directly using raw coordinate values
Definition: segment_2d.h:79
double dist(const Segment2D &seg) const
get minimum distance between 2 segments
Vector2D intersection(const Segment2D &other, const bool allow_end_point) const
check & get the intersection point with other line segment
const Vector2D & origin() const
get 1st point of segment edge
Definition: segment_2d.h:162
bool intersects(const Segment2D &other) const
check if segments cross each other or not.
Definition: segment_2d.h:317
const Segment2D & assign(const Vector2D &origin, const Vector2D &terminal)
construct from 2 points
Definition: segment_2d.h:106
bool equalsWeakly(const Segment2D &other) const
check if this line segment has weakly same value as input line segment.
Definition: segment_2d.h:272
Vector2D intersection(const Line2D &l) const
check & get the intersection point with other line
2D point vector class
Definition: vector_2d.h:46
Vector2D & assign(const double xx, const double yy)
assign XY value directly.
Definition: vector_2d.h:100
static Vector2D from_polar(const double mag, const AngleDeg &theta)
get new Vector created by POLAR value.
Definition: vector_2d.h:594
double dist(const Vector2D &p) const
get the distance from this to 'p'.
Definition: vector_2d.h:359
double y
Y coordinate.
Definition: vector_2d.h:64
double x
X coordinate.
Definition: vector_2d.h:63
bool equals(const Vector2D &other) const
check if this vector is strictly same as given vector.
Definition: vector_2d.h:551
bool equalsWeakly(const Vector2D &other) const
check if this vector is weakly same as given vector.
Definition: vector_2d.h:562
2D straight line Header File.
2d vector class Header File.