Public Types | Public Member Functions | Static Public Member Functions

QLineF Class Reference

Search for all occurrences

Detailed Description

Definition at line 212 of file qline.h.

#include <qline.h>

List of all members.

Public Types

enum   IntersectType { NoIntersection, BoundedIntersection, UnboundedIntersection }

Public Member Functions

  QLineF ()
  QLineF (const QPointF &pt1, const QPointF &pt2)
  QLineF (qreal x1, qreal y1, qreal x2, qreal y2)
  QLineF (const QLine &line)
bool  isNull () const
QPointF  p1 () const
QPointF  p2 () const
qreal  x1 () const
qreal  y1 () const
qreal  x2 () const
qreal  y2 () const
qreal  dx () const
qreal  dy () const
qreal  length () const
void  setLength (qreal len)
qreal  angle () const
void  setAngle (qreal angle)
qreal  angleTo (const QLineF &l) const
QLineF  unitVector () const
QLineF  normalVector () const
IntersectType  intersect (const QLineF &l, QPointF *intersectionPoint) const
qreal  angle (const QLineF &l) const
QPointF  pointAt (qreal t) const
void  translate (const QPointF &p)
void  translate (qreal dx, qreal dy)
QLineF  translated (const QPointF &p) const
QLineF  translated (qreal dx, qreal dy) const
void  setP1 (const QPointF &p1)
void  setP2 (const QPointF &p2)
void  setPoints (const QPointF &p1, const QPointF &p2)
void  setLine (qreal x1, qreal y1, qreal x2, qreal y2)
bool  operator== (const QLineF &d) const
bool  operator!= (const QLineF &d) const
QLine  toLine () const

Static Public Member Functions

static QLineF  fromPolar (qreal length, qreal angle)

Member Enumeration Documentation

Enumerator:
NoIntersection 
BoundedIntersection 
UnboundedIntersection 

Definition at line 215 of file qline.h.


Constructor & Destructor Documentation

QLineF ( ) [inline]

Definition at line 280 of file qline.h.

{
}
QLineF ( const QPointF pt1,
const QPointF pt2 
) [inline]

Definition at line 284 of file qline.h.

    : pt1(apt1), pt2(apt2)
{
}
QLineF ( qreal  x1,
qreal  y1,
qreal  x2,
qreal  y2 
) [inline]

Definition at line 289 of file qline.h.

    : pt1(x1pos, y1pos), pt2(x2pos, y2pos)
{
}
QLineF ( const QLine line ) [inline]

Definition at line 220 of file qline.h.

: pt1(line.p1()), pt2(line.p2()) { }

Member Function Documentation

static QLineF fromPolar ( qreal  length,
qreal  angle 
) [static]
bool isNull ( ) const
QPointF p1 ( ) const [inline]

Definition at line 314 of file qline.h.

{
    return pt1;
}
QPointF p2 ( ) const [inline]

Definition at line 319 of file qline.h.

{
    return pt2;
}
qreal x1 ( ) const [inline]

Definition at line 294 of file qline.h.

{
    return pt1.x();
}
qreal y1 ( ) const [inline]

Definition at line 299 of file qline.h.

{
    return pt1.y();
}
qreal x2 ( ) const [inline]

Definition at line 304 of file qline.h.

{
    return pt2.x();
}
qreal y2 ( ) const [inline]

Definition at line 309 of file qline.h.

{
    return pt2.y();
}
qreal dx ( ) const [inline]

Definition at line 324 of file qline.h.

{
    return pt2.x() - pt1.x();
}
qreal dy ( ) const [inline]

Definition at line 329 of file qline.h.

{
    return pt2.y() - pt1.y();
}
qreal length ( ) const
void setLength ( qreal  len ) [inline]

Definition at line 360 of file qline.h.

{
    if (isNull())
        return;
    QLineF v = unitVector();
    pt2 = QPointF(pt1.x() + v.dx() * len, pt1.y() + v.dy() * len);
}
qreal angle ( ) const
void setAngle ( qreal  angle )
qreal angleTo ( const QLineF l ) const
QLineF unitVector ( ) const
QLineF normalVector ( ) const [inline]

Definition at line 334 of file qline.h.

{
    return QLineF(p1(), p1() + QPointF(dy(), -dx()));
}
IntersectType intersect ( const QLineF l,
QPointF intersectionPoint 
) const
qreal angle ( const QLineF l ) const
QPointF pointAt ( qreal  t ) const [inline]

Definition at line 368 of file qline.h.

{
    qreal vx = pt2.x() - pt1.x();
    qreal vy = pt2.y() - pt1.y();
    return QPointF(pt1.x() + vx * t, pt1.y() + vy * t);
}
void translate ( const QPointF p ) [inline]

Definition at line 339 of file qline.h.

{
    pt1 += point;
    pt2 += point;
}
void translate ( qreal  dx,
qreal  dy 
) [inline]

Definition at line 345 of file qline.h.

{
    this->translate(QPointF(adx, ady));
}
QLineF translated ( const QPointF p ) const [inline]

Definition at line 350 of file qline.h.

{
    return QLineF(pt1 + p, pt2 + p);
}
QLineF translated ( qreal  dx,
qreal  dy 
) const [inline]

Definition at line 355 of file qline.h.

{
    return translated(QPointF(adx, ady));
}
void setP1 ( const QPointF p1 ) [inline]

Definition at line 381 of file qline.h.

{
    pt1 = aP1;
}
void setP2 ( const QPointF p2 ) [inline]

Definition at line 386 of file qline.h.

{
    pt2 = aP2;
}
void setPoints ( const QPointF p1,
const QPointF p2 
) [inline]

Definition at line 391 of file qline.h.

{
    pt1 = aP1;
    pt2 = aP2;
}
void setLine ( qreal  x1,
qreal  y1,
qreal  x2,
qreal  y2 
) [inline]

Definition at line 397 of file qline.h.

{
    pt1 = QPointF(aX1, aY1);
    pt2 = QPointF(aX2, aY2);
}
bool operator== ( const QLineF d ) const [inline]

Definition at line 404 of file qline.h.

{
    return pt1 == d.pt1 && pt2 == d.pt2;
}
bool operator!= ( const QLineF d ) const [inline]

Definition at line 267 of file qline.h.

{ return !(*this == d); }
QLine toLine ( ) const [inline]

Definition at line 375 of file qline.h.

{
    return QLine(pt1.toPoint(), pt2.toPoint());
}

The documentation for this class was generated from the following file:

QLineF QLineF QLineF QLineF QLineF QLineF QLineF QLineF QLineF QLineF
QLineF QLineF QLineF QLineF QLineF QLineF QLineF QLineF QLineF QLineF