QLineF Class Reference

#include <qline.h>

Class Description

Definition at line 212 of file qline.h.

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.

281 {
282 }
QLineF ( const QPointF pt1,
const QPointF pt2 
)
inline

Definition at line 284 of file qline.h.

285  : pt1(apt1), pt2(apt2)
286 {
287 }
QLineF ( qreal  x1,
qreal  y1,
qreal  x2,
qreal  y2 
)
inline

Definition at line 289 of file qline.h.

290  : pt1(x1pos, y1pos), pt2(x2pos, y2pos)
291 {
292 }
QLineF ( const QLine line)
inline

Definition at line 220 of file qline.h.

220 : pt1(line.p1()), pt2(line.p2()) { }
QPoint p1() const
Definition: qline.h:132
QPoint p2() const
Definition: qline.h:137

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.

315 {
316  return pt1;
317 }
QPointF p2 ( ) const
inline

Definition at line 319 of file qline.h.

320 {
321  return pt2;
322 }
qreal x1 ( ) const
inline

Definition at line 294 of file qline.h.

295 {
296  return pt1.x();
297 }
qreal x() const
Definition: qpoint.h:282
qreal y1 ( ) const
inline

Definition at line 299 of file qline.h.

300 {
301  return pt1.y();
302 }
qreal y() const
Definition: qpoint.h:287
qreal x2 ( ) const
inline

Definition at line 304 of file qline.h.

305 {
306  return pt2.x();
307 }
qreal x() const
Definition: qpoint.h:282
qreal y2 ( ) const
inline

Definition at line 309 of file qline.h.

310 {
311  return pt2.y();
312 }
qreal y() const
Definition: qpoint.h:287
qreal dx ( ) const
inline

Definition at line 324 of file qline.h.

325 {
326  return pt2.x() - pt1.x();
327 }
qreal x() const
Definition: qpoint.h:282
qreal dy ( ) const
inline

Definition at line 329 of file qline.h.

330 {
331  return pt2.y() - pt1.y();
332 }
qreal y() const
Definition: qpoint.h:287
qreal length ( ) const
void setLength ( qreal  len)
inline

Definition at line 360 of file qline.h.

361 {
362  if (isNull())
363  return;
364  QLineF v = unitVector();
365  pt2 = QPointF(pt1.x() + v.dx() * len, pt1.y() + v.dy() * len);
366 }
qreal dy() const
Definition: qline.h:329
qreal dx() const
Definition: qline.h:324
qreal y() const
Definition: qpoint.h:287
const GLdouble * v
Definition: GLee.h:1174
qreal x() const
Definition: qpoint.h:282
Definition: qline.h:212
QLineF unitVector() const
bool isNull() const
GLenum GLsizei len
Definition: GLee.h:2695
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.

335 {
336  return QLineF(p1(), p1() + QPointF(dy(), -dx()));
337 }
qreal dy() const
Definition: qline.h:329
qreal dx() const
Definition: qline.h:324
QLineF()
Definition: qline.h:280
QPointF p1() const
Definition: qline.h:314
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.

369 {
370  qreal vx = pt2.x() - pt1.x();
371  qreal vy = pt2.y() - pt1.y();
372  return QPointF(pt1.x() + vx * t, pt1.y() + vy * t);
373 }
qreal y() const
Definition: qpoint.h:287
qreal x() const
Definition: qpoint.h:282
GLdouble GLdouble t
Definition: GLee.h:1181
void translate ( const QPointF p)
inline

Definition at line 339 of file qline.h.

340 {
341  pt1 += point;
342  pt2 += point;
343 }
void translate ( qreal  dx,
qreal  dy 
)
inline

Definition at line 345 of file qline.h.

346 {
347  this->translate(QPointF(adx, ady));
348 }
void translate(const QPointF &p)
Definition: qline.h:339
QLineF translated ( const QPointF p) const
inline

Definition at line 350 of file qline.h.

351 {
352  return QLineF(pt1 + p, pt2 + p);
353 }
QLineF()
Definition: qline.h:280
QLineF translated ( qreal  dx,
qreal  dy 
) const
inline

Definition at line 355 of file qline.h.

356 {
357  return translated(QPointF(adx, ady));
358 }
QLineF translated(const QPointF &p) const
Definition: qline.h:350
void setP1 ( const QPointF p1)
inline

Definition at line 381 of file qline.h.

382 {
383  pt1 = aP1;
384 }
void setP2 ( const QPointF p2)
inline

Definition at line 386 of file qline.h.

387 {
388  pt2 = aP2;
389 }
void setPoints ( const QPointF p1,
const QPointF p2 
)
inline

Definition at line 391 of file qline.h.

392 {
393  pt1 = aP1;
394  pt2 = aP2;
395 }
void setLine ( qreal  x1,
qreal  y1,
qreal  x2,
qreal  y2 
)
inline

Definition at line 397 of file qline.h.

398 {
399  pt1 = QPointF(aX1, aY1);
400  pt2 = QPointF(aX2, aY2);
401 }
bool operator== ( const QLineF d) const
inline

Definition at line 404 of file qline.h.

405 {
406  return pt1 == d.pt1 && pt2 == d.pt2;
407 }
bool operator!= ( const QLineF d) const
inline

Definition at line 267 of file qline.h.

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

Definition at line 375 of file qline.h.

376 {
377  return QLine(pt1.toPoint(), pt2.toPoint());
378 }
Definition: qline.h:57
QPoint toPoint() const
Definition: qpoint.h:376

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