2d straight line class
More...
#include <line_2d.h>
|
| | Line2D (const double &a, const double &b, const double &c) |
| | construct directly
|
| | Line2D (const Vector2D &p1, const Vector2D &p2) |
| | construct from 2 points
|
| | Line2D (const Vector2D &origin, const AngleDeg &linedir) |
| | construct from origin point + direction
|
| const Line2D & | assign (const Vector2D &p1, const Vector2D &p2) |
| | construct from 2 points
|
| const Line2D & | assign (const Vector2D &origin, const AngleDeg &linedir) |
| | construct from origin point + direction
|
| const double & | a () const |
| | accessor
|
| const double & | getA () const |
| | accessor
|
| const double & | b () const |
| | accessor
|
| const double & | getB () const |
| | accessor
|
| const double & | c () const |
| | accessor
|
| const double & | getC () const |
| | accessor
|
| double | getX (const double &y) const |
| | get X-coordinate correspond to 'y'
|
| double | getY (const double &x) const |
| | get Y-coordinate correspond to 'x'
|
| double | dist (const Vector2D &p) const |
| | calculate distance from point to this line
|
| double | dist2 (const Vector2D &p) const |
| | get squared distance from this line to point
|
| bool | isParallel (const Line2D &line) const |
| | check if the slope of this line is same to the slope of 'line'
|
| Vector2D | intersection (const Line2D &line) const |
| | get the intersection point with 'line'
|
| Line2D | perpendicular (const Vector2D &p) const |
| | calc perpendicular line (SUI-SEN)
|
| Vector2D | projection (const Vector2D &p) const |
| | calc projection point from p
|
|
|
static const double | EPSILON = 1.0e-10 |
| | tolerance threshold
|
|
static const double | ERROR_VALUE = std::numeric_limits< double >::max() |
| | error value
|
2d straight line class
Line Fomula: aX + bY + c = 0
◆ Line2D() [1/3]
| rcsc::Line2D::Line2D |
( |
const double & | a, |
|
|
const double & | b, |
|
|
const double & | c ) |
|
inline |
construct directly
- Parameters
-
| a | Line formula A, coefficient for x |
| b | Line formula B, coefficient for y |
| c | constant C |
◆ Line2D() [2/3]
construct from 2 points
- Parameters
-
| p1 | first point |
| p2 | second point |
◆ Line2D() [3/3]
construct from origin point + direction
- Parameters
-
| origin | origin point |
| linedir | direction from origin point |
◆ a()
| const double & rcsc::Line2D::a |
( |
| ) |
const |
|
inline |
accessor
- Returns
- coefficient 'A' of line formula
◆ angle_bisector()
make angle bisector line from two angles
- Parameters
-
| origin | origin point that is passed through by result line |
| left | left angle |
| right | right angle |
- Returns
- line object
◆ assign() [1/2]
construct from origin point + direction
- Parameters
-
| origin | origin point |
| linedir | direction from origin point |
- Returns
- const reference to itself
◆ assign() [2/2]
construct from 2 points
- Parameters
-
| p1 | first point |
| p2 | second point |
- Returns
- const reference to itself
◆ b()
| const double & rcsc::Line2D::b |
( |
| ) |
const |
|
inline |
accessor
- Returns
- coefficient 'B' of line formula
◆ c()
| const double & rcsc::Line2D::c |
( |
| ) |
const |
|
inline |
accessor
- Returns
- coefficient 'C' of line formula
◆ dist()
| double rcsc::Line2D::dist |
( |
const Vector2D & | p | ) |
const |
|
inline |
calculate distance from point to this line
- Parameters
-
- Returns
- distance value
◆ dist2()
| double rcsc::Line2D::dist2 |
( |
const Vector2D & | p | ) |
const |
|
inline |
get squared distance from this line to point
- Parameters
-
- Returns
- squared distance value
◆ getA()
| const double & rcsc::Line2D::getA |
( |
| ) |
const |
|
inline |
accessor
- Returns
- coefficient 'A' of line formula
◆ getB()
| const double & rcsc::Line2D::getB |
( |
| ) |
const |
|
inline |
accessor
- Returns
- coefficient 'A' of line formula
accessor
- Returns
- coefficient 'B' of line formula
◆ getC()
| const double & rcsc::Line2D::getC |
( |
| ) |
const |
|
inline |
accessor
- Returns
- coefficient 'C' of line formula
◆ getX()
| double rcsc::Line2D::getX |
( |
const double & | y | ) |
const |
|
inline |
get X-coordinate correspond to 'y'
- Parameters
-
- Returns
- X coordinate
◆ getY()
| double rcsc::Line2D::getY |
( |
const double & | x | ) |
const |
|
inline |
get Y-coordinate correspond to 'x'
- Parameters
-
- Returns
- Y coordinate
◆ intersection() [1/2]
get the intersection point with 'line'
- Parameters
-
- Returns
- intersection point. if it does not exist, the invaidated value vector is returned.
◆ intersection() [2/2]
get the intersection point of 2 lines
- Parameters
-
| line1 | the first line |
| line2 | the second line |
- Returns
- the intersection point. if no intersection, invalid vector is returned.
◆ isParallel()
| bool rcsc::Line2D::isParallel |
( |
const Line2D & | line | ) |
const |
|
inline |
check if the slope of this line is same to the slope of 'line'
- Parameters
-
- Return values
-
| true | almost same |
| false | not same |
◆ perpendicular()
calc perpendicular line (SUI-SEN)
- Parameters
-
| p | the point that perpendicular line pass through |
- Returns
- perpendicular line
◆ perpendicular_bisector()
make perpendicular bisector line from twt points
- Parameters
-
- Returns
- line object
◆ projection()
calc projection point from p
- Parameters
-
- Returns
- projection point
The documentation for this class was generated from the following files: