Read@CVL
|
A basic line class including stroke width (thickness). More...
#include <Shapes.h>
Public Member Functions | |
Line (const QLineF &line=QLineF(), float thickness=1) | |
Initializes a new instance of the Line class. More... | |
Line (const Polygon &poly) | |
Line (const cv::Point p1, const cv::Point p2, float thickness=1) | |
Line (const Vector2D &p1, const Vector2D &p2, float thickness=1) | |
Line (double p1x, double p1y, double p2x, double p2y, float thickness=1) | |
bool | isEmpty () const |
Determines whether this instance is empty. More... | |
void | sortEndpoints (bool horizontal=true) |
void | setLine (const QLineF &line, float thickness=1) |
Sets the line. More... | |
void | setThickness (float thickness) |
float | thickness () const |
Returns the stroke width of the line. More... | |
double | squaredLength () const |
double | length () const |
Returns the line length. More... | |
double | weightedLength (const Vector2D &orVec) const |
Returns the orientation weighed length. Hence, if orVec is parallel to the line, the length is 0. If it is orthogonal, the line length is returned. More... | |
double | angle () const |
Returns the line angle. More... | |
double | minDistance (const Line &l) const |
Returns the minimum distance of the line endings of line l to the line endings of the current line instance. More... | |
void | translate (cv::Point offset) |
void | scale (double s) |
double | distance (const Vector2D &p) const |
Returns the minimal distance of point p to the current line instance. More... | |
double | horizontalOverlap (const Line &l) const |
double | horizontalDistance (const Line &l, double threshold=20) const |
double | verticalOverlap (const Line &l) const |
double | verticalDistance (const Line &l, double threshold=20) const |
Line | merge (const Line &l) const |
Merges the specified line l with the current line instance. More... | |
Line | mergeFit (const Line &l) const |
Line | gapLine (const Line &l) const |
Calculates the gap line between line l and the current line instance. More... | |
double | diffAngle (const Line &l) const |
The angle difference of line l and the current line instance. More... | |
bool | within (const Vector2D &p) const |
Calculated if point p is within the current line instance. More... | |
Line | moved (const Vector2D &mVec) const |
Returns a line moved by the vector mVec. More... | |
Vector2D | p1 () const |
Returns the start point. More... | |
Vector2D | p2 () const |
Returns the end point. More... | |
Vector2D | center () const |
QLineF | qLine () const |
Returns the line information. More... | |
QPolygonF | toPoly () const |
bool | isHorizontal (double mAngleTresh=0.5) const |
Determines whether the specified m angle tresh is horizontal. More... | |
bool | isVertical (double mAngleTresh=0.5) const |
bool | isColinear (const Line &line, double threshold=20) const |
bool | isClose (const Line &line, double threshold=20) const |
bool | intersects (const Line &line, QLineF::IntersectType t=QLineF::BoundedIntersection) const |
Vector2D | intersection (const Line &line, QLineF::IntersectType t=QLineF::BoundedIntersection) const |
Returns the intersection point of both lines. This function returns an empty vector if the lines do not intersect within the bounds More... | |
Vector2D | intersectionUnrestricted (const Line &line) const |
Vector2D | vector () const |
Returns the line's orientation vector. More... | |
void | draw (QPainter &p) const |
Line | extendBorder (const Rect &box) const |
Extends the line until the borders of the box. More... | |
Static Public Member Functions | |
static bool | lessX1 (const Line &l1, const Line &l2) |
static bool | lessY1 (const Line &l1, const Line &l2) |
Protected Member Functions | |
cv::Mat | toMat (const Line &l) const |
Protected Attributes | |
QLineF | mLine |
float | mThickness = 1 |
A basic line class including stroke width (thickness).
rdf::Line::Line | ( | const QLineF & | line = QLineF() , |
float | thickness = 1 |
||
) |
Initializes a new instance of the Line class.
line | The line. |
thickness | The stroke width. |
rdf::Line::Line | ( | const Polygon & | poly | ) |
rdf::Line::Line | ( | const cv::Point | p1, |
const cv::Point | p2, | ||
float | thickness = 1 |
||
) |
rdf::Line::Line | ( | double | p1x, |
double | p1y, | ||
double | p2x, | ||
double | p2y, | ||
float | thickness = 1 |
||
) |
double rdf::Line::angle | ( | ) | const |
Returns the line angle.
Vector2D rdf::Line::center | ( | ) | const |
double rdf::Line::diffAngle | ( | const Line & | l | ) | const |
The angle difference of line l and the current line instance.
l | The line l. |
double rdf::Line::distance | ( | const Vector2D & | p | ) | const |
Returns the minimal distance of point p to the current line instance.
p | The point p. |
void rdf::Line::draw | ( | QPainter & | p | ) | const |
Extends the line until the borders of the box.
box | the 'cropping' box. |
Calculates the gap line between line l and the current line instance.
l | The line l to which a gap line is calculated. |
double rdf::Line::horizontalDistance | ( | const Line & | l, |
double | threshold = 20 |
||
) | const |
double rdf::Line::horizontalOverlap | ( | const Line & | l | ) | const |
Vector2D rdf::Line::intersection | ( | const Line & | line, |
QLineF::IntersectType | t = QLineF::BoundedIntersection |
||
) | const |
Returns the intersection point of both lines. This function returns an empty vector if the lines do not intersect within the bounds
line | Another line. |
bool rdf::Line::intersects | ( | const Line & | line, |
QLineF::IntersectType | t = QLineF::BoundedIntersection |
||
) | const |
bool rdf::Line::isClose | ( | const Line & | line, |
double | threshold = 20 |
||
) | const |
bool rdf::Line::isColinear | ( | const Line & | line, |
double | threshold = 20 |
||
) | const |
bool rdf::Line::isEmpty | ( | ) | const |
Determines whether this instance is empty.
bool rdf::Line::isHorizontal | ( | double | mAngleTresh = 0.5 | ) | const |
Determines whether the specified m angle tresh is horizontal.
mAngleTresh | The m angle tresh. |
true
if the specified m angle tresh is horizontal; otherwise, false
. bool rdf::Line::isVertical | ( | double | mAngleTresh = 0.5 | ) | const |
double rdf::Line::length | ( | ) | const |
Returns the line length.
Merges the specified line l with the current line instance.
l | The line to merge. |
double rdf::Line::minDistance | ( | const Line & | l | ) | const |
Returns the minimum distance of the line endings of line l to the line endings of the current line instance.
l | The line l to which the minimum distance is computed. |
Returns a line moved by the vector mVec.
mVec | Move vector. |
Vector2D rdf::Line::p1 | ( | ) | const |
Returns the start point.
Vector2D rdf::Line::p2 | ( | ) | const |
Returns the end point.
QLineF rdf::Line::qLine | ( | ) | const |
Returns the line information.
void rdf::Line::scale | ( | double | s | ) |
void rdf::Line::setLine | ( | const QLineF & | line, |
float | thickness = 1 |
||
) |
Sets the line.
line | The line. |
thickness | The stroke width. |
void rdf::Line::setThickness | ( | float | thickness | ) |
void rdf::Line::sortEndpoints | ( | bool | horizontal = true | ) |
double rdf::Line::squaredLength | ( | ) | const |
float rdf::Line::thickness | ( | ) | const |
Returns the stroke width of the line.
|
protected |
QPolygonF rdf::Line::toPoly | ( | ) | const |
void rdf::Line::translate | ( | cv::Point | offset | ) |
Vector2D rdf::Line::vector | ( | ) | const |
Returns the line's orientation vector.
double rdf::Line::verticalDistance | ( | const Line & | l, |
double | threshold = 20 |
||
) | const |
double rdf::Line::verticalOverlap | ( | const Line & | l | ) | const |
double rdf::Line::weightedLength | ( | const Vector2D & | orVec | ) | const |
Returns the orientation weighed length. Hence, if orVec is parallel to the line, the length is 0. If it is orthogonal, the line length is returned.
orVec | An orientation vector. |
bool rdf::Line::within | ( | const Vector2D & | p | ) | const |
Calculated if point p is within the current line instance.
p | The point p to be checked. |
|
protected |
|
protected |