32#ifndef RCSC_GEOM_LINE2D_H
33#define RCSC_GEOM_LINE2D_H
109 M_a = -( p2.
y - p1.
y );
111 M_c = -M_a * p1.
x - M_b * p1.
y;
125 M_a = - linedir.
sin();
127 M_c = -M_a * origin.
x - M_b * origin.
y;
200 double getX(
const double & y )
const
202 if ( std::fabs( M_a ) <
EPSILON )
206 return -( M_b * y + M_c ) / M_a;
214 double getY(
const double & x )
const
216 if ( std::fabs( M_b ) <
EPSILON )
221 return -( M_a * x + M_c ) / M_b;
231 return std::fabs( ( M_a * p.
x + M_b * p.
y + M_c )
232 / std::sqrt( M_a * M_a + M_b * M_b ) );
241 double d = M_a * p.
x + M_b * p.
y + M_c;
242 return (d * d) / (M_a * M_a + M_b * M_b);
253 return std::fabs(
a() * line.
b() - line.
a() *
b() ) <
EPSILON;
274 return Line2D(
b(), -
a(),
a() * p.
y -
b() * p.
x );
degree wrapper class
Definition angle_deg.h:45
double cos() const
calculate cosine
Definition angle_deg.h:301
static AngleDeg bisect(const AngleDeg &left, const AngleDeg &right)
static utility that returns bisect angle of [left, right].
Definition angle_deg.cpp:177
double sin() const
calculate sine
Definition angle_deg.h:310
2d straight line class
Definition line_2d.h:47
static const double ERROR_VALUE
error value
Definition line_2d.h:51
Line2D(const Vector2D &origin, const AngleDeg &linedir)
construct from origin point + direction
Definition line_2d.h:93
static const double EPSILON
tolerance threshold
Definition line_2d.h:50
const double & getA() const
accessor
Definition line_2d.h:146
const Line2D & assign(const Vector2D &p1, const Vector2D &p2)
construct from 2 points
Definition line_2d.h:106
const Line2D & assign(const Vector2D &origin, const AngleDeg &linedir)
construct from origin point + direction
Definition line_2d.h:122
double dist2(const Vector2D &p) const
get squared distance from this line to point
Definition line_2d.h:239
const double & getC() const
accessor
Definition line_2d.h:190
static Line2D angle_bisector(const Vector2D &origin, const AngleDeg &left, const AngleDeg &right)
make angle bisector line from two angles
Definition line_2d.h:308
Line2D(const double &a, const double &b, const double &c)
construct directly
Definition line_2d.h:69
double dist(const Vector2D &p) const
calculate distance from point to this line
Definition line_2d.h:229
static Line2D perpendicular_bisector(const Vector2D &p1, const Vector2D &p2)
make perpendicular bisector line from twt points
Definition line_2d.cpp:69
bool isParallel(const Line2D &line) const
check if the slope of this line is same to the slope of 'line'
Definition line_2d.h:251
Vector2D projection(const Vector2D &p) const
calc projection point from p
Definition line_2d.h:282
const double & getB() const
accessor
Definition line_2d.h:170
Line2D(const Vector2D &p1, const Vector2D &p2)
construct from 2 points
Definition line_2d.h:82
double getY(const double &x) const
get Y-coordinate correspond to 'x'
Definition line_2d.h:214
double getX(const double &y) const
get X-coordinate correspond to 'y'
Definition line_2d.h:200
const double & a() const
accessor
Definition line_2d.h:136
const double & b() const
accessor
Definition line_2d.h:156
Line2D perpendicular(const Vector2D &p) const
calc perpendicular line (SUI-SEN)
Definition line_2d.h:272
Vector2D intersection(const Line2D &line) const
get the intersection point with 'line'
Definition line_2d.h:262
const double & c() const
accessor
Definition line_2d.h:180
2D point vector class
Definition vector_2d.h:47
double y
Y coordinate.
Definition vector_2d.h:65
double x
X coordinate.
Definition vector_2d.h:64
2d vector class Header File.