Class Line2D
Defined in File line2d.hpp
Inheritance Relationships
Base Type
public cv::Vec< double, 3 >
Derived Type
public tuw::LineSegment2D
(Class LineSegment2D)
Class Documentation
-
class Line2D : public cv::Vec<double, 3>
class to represent a 2D line as equation a*x + b*y + c = 0 The line has no endpoints
Subclassed by tuw::LineSegment2D
Public Functions
-
Line2D()
constructor
-
Line2D(cv::Vec<double, 3> &l, bool normalize = true)
constructor with optional normalization
- Parameters:
l – equation
normalize – normalizes equation on true
-
Line2D(const double &x0, const double &y0, const double &x1, const double &y1, bool normalize = true)
constructor to create a line from points
- Parameters:
x0 –
y0 –
x1 –
y1 –
normalize – normalizes equation on true
-
Line2D(const Point2D &pt1, const Point2D &pt2, bool normalize = true)
constructor to create a line from points
- Parameters:
pt1 –
pt2 –
normalize – normalizes equation on true
-
double &a()
- Returns:
the first equation component for x
-
const double &a() const
- Returns:
the first equation component for x
-
double &b()
- Returns:
the second equation component for y
-
const double &b() const
- Returns:
the second equation component for y
-
double &c()
- Returns:
the third equation component
-
const double &c() const
- Returns:
the third equation component
-
void normalize()
normalizes the equation to a*a + b*b = 1
-
double distanceTo(const double &x, const double &y) const
computes the distance to a point
- Parameters:
x –
y –
- Returns:
the minimal distance to a point
- Pre:
normalize
-
double distanceTo(const Point2D &p) const
computes the distance to a point
- Parameters:
p –
- Returns:
the minimal distance to a point
- Pre:
normalize
- Pre:
normalize
-
Point2D pointOnLine(const double &x, const double &y) const
computes a point on the line with the shortest distance to the point given
- Parameters:
x –
y –
- Returns:
point on line
- Pre:
normalize
- Pre:
pointOnLine
-
Point2D pointOnLine(const Point2D &p) const
computes a point on the line with the shortest distance to the point given
- Parameters:
p –
- Returns:
point on line
- Pre:
normalize
- Pre:
pointOnLine
-
Point2D intersection(const Line2D &l) const
computes the intersection point of two lines
- Parameters:
l –
- Returns:
point on line
- Pre:
normalize
-
Line2D &set(const double &x0, const double &y0, const double &x1, const double &y1, bool normalize = true)
constructor to create a line from points
- Parameters:
x0 –
y0 –
x1 –
y1 –
normalize – normalizes equation on true
- Returns:
ref to this
-
Line2D()