#include <line2d.h>
Public Member Functions | |
double & | a () |
const double & | a () const |
double & | b () |
const double & | b () const |
double & | c () |
const double & | c () const |
cv::Vec< double, 3 > & | cv () |
const cv::Vec< double, 3 > & | cv () const |
double | distanceTo (const double &x, const double &y) const |
double | distanceTo (const Point2D &p) const |
Point2D | intersection (const Line2D &l) const |
Line2D () | |
constructor More... | |
Line2D (const Line2D &l) | |
Line2D (cv::Vec< double, 3 > &l, bool normalize=true) | |
Line2D (const double &x0, const double &y0, const double &x1, const double &y1, bool normalize=true) | |
Line2D (const Point2D &pt1, const Point2D &pt2, bool normalize=true) | |
cv::Vec< double, 2 > | normal () const |
void | normalize () |
Point2D | pointOnLine (const double &x, const double &y) const |
Point2D | pointOnLine (const Point2D &p) const |
Line2D & | set (const double &x0, const double &y0, const double &x1, const double &y1, bool normalize=true) |
Line2D & | set (const Point2D &p0, const Point2D &p1, bool normalize=true) |
Polar2D | toPolar () const |
Friends | |
std::ostream & | operator<< (std::ostream &os, const Line2D &o) |
class to represent a 2D line as equation a*x + b*y + c = 0 The line has no endpoints
Line2D::Line2D | ( | ) |
constructor
Definition at line 5 of file line2d.cpp.
Line2D::Line2D | ( | const Line2D & | l | ) |
Line2D::Line2D | ( | cv::Vec< double, 3 > & | l, |
bool | normalize = true |
||
) |
constructor with optional normalization
l | equation |
normalize | normalizes equation on true |
Definition at line 9 of file line2d.cpp.
Line2D::Line2D | ( | const double & | x0, |
const double & | y0, | ||
const double & | x1, | ||
const double & | y1, | ||
bool | normalize = true |
||
) |
constructor to create a line from points
x0 | |
y0 | |
x1 | |
y1 | |
normalize | normalizes equation on true |
Definition at line 13 of file line2d.cpp.
constructor to create a line from points
pt1 | |
pt2 | |
normalize | normalizes equation on true |
Definition at line 16 of file line2d.cpp.
double & Line2D::a | ( | ) |
Definition at line 19 of file line2d.cpp.
const double & Line2D::a | ( | ) | const |
Definition at line 22 of file line2d.cpp.
double & Line2D::b | ( | ) |
Definition at line 25 of file line2d.cpp.
const double & Line2D::b | ( | ) | const |
Definition at line 28 of file line2d.cpp.
double & Line2D::c | ( | ) |
Definition at line 31 of file line2d.cpp.
const double & Line2D::c | ( | ) | const |
Definition at line 34 of file line2d.cpp.
cv::Vec< double, 3 > & Line2D::cv | ( | ) |
const cv::Vec< double, 3 > & Line2D::cv | ( | ) | const |
double Line2D::distanceTo | ( | const double & | x, |
const double & | y | ||
) | const |
computes the distance to a point
x | |
y |
Definition at line 41 of file line2d.cpp.
double Line2D::distanceTo | ( | const Point2D & | p | ) | const |
computes the distance to a point
p |
Definition at line 45 of file line2d.cpp.
computes the intersection point of two lines
l |
Definition at line 57 of file line2d.cpp.
cv::Vec< double, 2 > Line2D::normal | ( | ) | const |
void Line2D::normalize | ( | ) |
normalizes the equation to a*a + b*b = 1
Definition at line 37 of file line2d.cpp.
Point2D Line2D::pointOnLine | ( | const double & | x, |
const double & | y | ||
) | const |
computes a point on the line with the shortest distance to the point given
x | |
y |
Definition at line 49 of file line2d.cpp.
computes a point on the line with the shortest distance to the point given
p |
Definition at line 54 of file line2d.cpp.
Line2D & Line2D::set | ( | const double & | x0, |
const double & | y0, | ||
const double & | x1, | ||
const double & | y1, | ||
bool | normalize = true |
||
) |
constructor to create a line from points
x0 | |
y0 | |
x1 | |
y1 | |
normalize | normalizes equation on true |
cross product with homogenios vectors
Definition at line 64 of file line2d.cpp.
constructor to create a line from points
p0 | |
p1 | |
normalize | normalizes equation on true |
Definition at line 69 of file line2d.cpp.
Polar2D Line2D::toPolar | ( | ) | const |
|
friend |