QtBase  v6.3.1
tst_qline.cpp
Go to the documentation of this file.
1 /****************************************************************************
2 **
3 ** Copyright (C) 2020 The Qt Company Ltd.
4 ** Contact: https://www.qt.io/licensing/
5 **
6 ** This file is part of the test suite of the Qt Toolkit.
7 **
8 ** $QT_BEGIN_LICENSE:GPL-EXCEPT$
9 ** Commercial License Usage
10 ** Licensees holding valid commercial Qt licenses may use this file in
11 ** accordance with the commercial license agreement provided with the
12 ** Software or, alternatively, in accordance with the terms contained in
13 ** a written agreement between you and The Qt Company. For licensing terms
14 ** and conditions see https://www.qt.io/terms-conditions. For further
15 ** information use the contact form at https://www.qt.io/contact-us.
16 **
17 ** GNU General Public License Usage
18 ** Alternatively, this file may be used under the terms of the GNU
19 ** General Public License version 3 as published by the Free Software
20 ** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
21 ** included in the packaging of this file. Please review the following
22 ** information to ensure the GNU General Public License requirements will
23 ** be met: https://www.gnu.org/licenses/gpl-3.0.html.
24 **
25 ** $QT_END_LICENSE$
26 **
27 ****************************************************************************/
28 
29 #include <QTest>
30 #include <qline.h>
31 #include <qmath.h>
32 
33 class tst_QLine : public QObject
34 {
35  Q_OBJECT
36 private slots:
37  void testIntersection();
38  void testIntersection_data();
39 
40  void testLength();
41  void testLength_data();
42 
43  void testCenter();
44  void testCenter_data();
45 
46  void testCenterF();
47  void testCenterF_data();
48 
49  void testNormalVector();
50  void testNormalVector_data();
51 
52  void testAngle2();
53  void testAngle2_data();
54 
55  void testAngle3();
56 
57  void testAngleTo();
58  void testAngleTo_data();
59 
60  void testSet();
61 };
62 
63 const qreal epsilon = sizeof(qreal) == sizeof(double) ? 1e-8 : 1e-4;
64 
65 void tst_QLine::testSet()
66 {
67  {
68  QLine l;
69  l.setP1(QPoint(1, 2));
70  l.setP2(QPoint(3, 4));
71 
72  QCOMPARE(l.x1(), 1);
73  QCOMPARE(l.y1(), 2);
74  QCOMPARE(l.x2(), 3);
75  QCOMPARE(l.y2(), 4);
76 
77  l.setPoints(QPoint(5, 6), QPoint(7, 8));
78  QCOMPARE(l.x1(), 5);
79  QCOMPARE(l.y1(), 6);
80  QCOMPARE(l.x2(), 7);
81  QCOMPARE(l.y2(), 8);
82 
83  l.setLine(9, 10, 11, 12);
84  QCOMPARE(l.x1(), 9);
85  QCOMPARE(l.y1(), 10);
86  QCOMPARE(l.x2(), 11);
87  QCOMPARE(l.y2(), 12);
88  }
89 
90  {
91  QLineF l;
92  l.setP1(QPointF(1, 2));
93  l.setP2(QPointF(3, 4));
94 
95  QCOMPARE(l.x1(), 1.0);
96  QCOMPARE(l.y1(), 2.0);
97  QCOMPARE(l.x2(), 3.0);
98  QCOMPARE(l.y2(), 4.0);
99 
100  l.setPoints(QPointF(5, 6), QPointF(7, 8));
101  QCOMPARE(l.x1(), 5.0);
102  QCOMPARE(l.y1(), 6.0);
103  QCOMPARE(l.x2(), 7.0);
104  QCOMPARE(l.y2(), 8.0);
105 
106  l.setLine(9.0, 10.0, 11.0, 12.0);
107  QCOMPARE(l.x1(), 9.0);
108  QCOMPARE(l.y1(), 10.0);
109  QCOMPARE(l.x2(), 11.0);
110  QCOMPARE(l.y2(), 12.0);
111  }
112 
113 }
114 
115 void tst_QLine::testIntersection_data()
116 {
117  QTest::addColumn<double>("xa1");
118  QTest::addColumn<double>("ya1");
119  QTest::addColumn<double>("xa2");
120  QTest::addColumn<double>("ya2");
121  QTest::addColumn<double>("xb1");
122  QTest::addColumn<double>("yb1");
123  QTest::addColumn<double>("xb2");
124  QTest::addColumn<double>("yb2");
125  QTest::addColumn<int>("type");
126  QTest::addColumn<double>("ix");
127  QTest::addColumn<double>("iy");
128 
129  QTest::newRow("parallel") << 1.0 << 1.0 << 3.0 << 4.0
130  << 5.0 << 6.0 << 7.0 << 9.0
131  << int(QLineF::NoIntersection) << 0.0 << 0.0;
132  QTest::newRow("unbounded") << 1.0 << 1.0 << 5.0 << 5.0
133  << 0.0 << 4.0 << 3.0 << 4.0
134  << int(QLineF::UnboundedIntersection) << 4.0 << 4.0;
135  QTest::newRow("bounded") << 1.0 << 1.0 << 5.0 << 5.0
136  << 0.0 << 4.0 << 5.0 << 4.0
137  << int(QLineF::BoundedIntersection) << 4.0 << 4.0;
138 
139  QTest::newRow("almost vertical") << 0.0 << 10.0 << 20.0000000000001 << 10.0
140  << 10.0 << 0.0 << 10.0 << 20.0
141  << int(QLineF::BoundedIntersection) << 10.0 << 10.0;
142 
143  QTest::newRow("almost horizontal") << 0.0 << 10.0 << 20.0 << 10.0
144  << 10.0000000000001 << 0.0 << 10.0 << 20.0
145  << int(QLineF::BoundedIntersection) << 10.0 << 10.0;
146 
147  QTest::newRow("long vertical") << 100.1599256468623
148  << 100.7861905065196
149  << 100.1599256468604
150  << -9999.78619050651
151  << 10.0 << 50.0 << 190.0 << 50.0
153  << 100.1599256468622
154  << 50.0;
155 
156  for (int i = 0; i < 1000; ++i) {
157  QLineF a = QLineF::fromPolar(50, i);
158  a.setP1(-a.p2());
159 
160  QLineF b = QLineF::fromPolar(50, i * 0.997 + 90);
161  b.setP1(-b.p2());
162 
163  // make the qFuzzyCompare be a bit more lenient
164  a = a.translated(1, 1);
165  b = b.translated(1, 1);
166 
167  QTest::newRow(("rotation-" + QByteArray::number(i)).constData())
168  << (double)a.x1() << (double)a.y1() << (double)a.x2() << (double)a.y2()
169  << (double)b.x1() << (double)b.y1() << (double)b.x2() << (double)b.y2()
171  << 1.0
172  << 1.0;
173  }
174 }
175 
176 void tst_QLine::testIntersection()
177 {
178  QFETCH(double, xa1);
179  QFETCH(double, ya1);
180  QFETCH(double, xa2);
181  QFETCH(double, ya2);
182  QFETCH(double, xb1);
183  QFETCH(double, yb1);
184  QFETCH(double, xb2);
185  QFETCH(double, yb2);
186  QFETCH(int, type);
187  QFETCH(double, ix);
188  QFETCH(double, iy);
189 
190  QLineF a(xa1, ya1, xa2, ya2);
191  QLineF b(xb1, yb1, xb2, yb2);
192 
193 
194  QPointF ip;
195  QLineF::IntersectionType itype = a.intersects(b, &ip);
196 
197  QCOMPARE(int(itype), type);
198  if (type != QLineF::NoIntersection) {
199  QVERIFY(qAbs(ip.x() - ix) < epsilon);
200  QVERIFY(qAbs(ip.y() - iy) < epsilon);
201  }
202 }
203 
204 void tst_QLine::testLength_data()
205 {
206  QTest::addColumn<double>("x1");
207  QTest::addColumn<double>("y1");
208  QTest::addColumn<double>("x2");
209  QTest::addColumn<double>("y2");
210  QTest::addColumn<double>("length");
211  QTest::addColumn<double>("lengthToSet");
212  QTest::addColumn<double>("vx");
213  QTest::addColumn<double>("vy");
214 
215  // Test name: [dx,dy]->|lenToSet| (x1,x2)
216  // with the last part omitted if (0,0)
217  QTest::newRow("[1,0]->|2|") << 0.0 << 0.0 << 1.0 << 0.0 << 1.0 << 2.0 << 2.0 << 0.0;
218  QTest::newRow("[0,1]->|2|") << 0.0 << 0.0 << 0.0 << 1.0 << 1.0 << 2.0 << 0.0 << 2.0;
219  QTest::newRow("[-1,0]->|2|") << 0.0 << 0.0 << -1.0 << 0.0 << 1.0 << 2.0 << -2.0 << 0.0;
220  QTest::newRow("[0,-1]->|2|") << 0.0 << 0.0 << 0.0 << -1.0 << 1.0 << 2.0 << 0.0 << -2.0;
221  QTest::newRow("[1,1]->->|1|") << 0.0 << 0.0 << 1.0 << 1.0
222  << M_SQRT2 << 1.0 << M_SQRT1_2 << M_SQRT1_2;
223  QTest::newRow("[-1,1]->|1|") << 0.0 << 0.0 << -1.0 << 1.0
224  << M_SQRT2 << 1.0 << -M_SQRT1_2 << M_SQRT1_2;
225  QTest::newRow("[1,-1]->|1|") << 0.0 << 0.0 << 1.0 << -1.0
226  << M_SQRT2 << 1.0 << M_SQRT1_2 << -M_SQRT1_2;
227  QTest::newRow("[-1,-1]->|1|") << 0.0 << 0.0 << -1.0 << -1.0
228  << M_SQRT2 << 1.0 << -M_SQRT1_2 << -M_SQRT1_2;
229  QTest::newRow("[1,0]->|2| (2,2)") << 2.0 << 2.0 << 3.0 << 2.0 << 1.0 << 2.0 << 2.0 << 0.0;
230  QTest::newRow("[0,1]->|2| (2,2)") << 2.0 << 2.0 << 2.0 << 3.0 << 1.0 << 2.0 << 0.0 << 2.0;
231  QTest::newRow("[-1,0]->|2| (2,2)") << 2.0 << 2.0 << 1.0 << 2.0 << 1.0 << 2.0 << -2.0 << 0.0;
232  QTest::newRow("[0,-1]->|2| (2,2)") << 2.0 << 2.0 << 2.0 << 1.0 << 1.0 << 2.0 << 0.0 << -2.0;
233  QTest::newRow("[1,1]->|1| (2,2)") << 2.0 << 2.0 << 3.0 << 3.0
234  << M_SQRT2 << 1.0 << M_SQRT1_2 << M_SQRT1_2;
235  QTest::newRow("[-1,1]->|1| (2,2)") << 2.0 << 2.0 << 1.0 << 3.0
236  << M_SQRT2 << 1.0 << -M_SQRT1_2 << M_SQRT1_2;
237  QTest::newRow("[1,-1]->|1| (2,2)") << 2.0 << 2.0 << 3.0 << 1.0
238  << M_SQRT2 << 1.0 << M_SQRT1_2 << -M_SQRT1_2;
239  QTest::newRow("[-1,-1]->|1| (2,2)") << 2.0 << 2.0 << 1.0 << 1.0
240  << M_SQRT2 << 1.0 << -M_SQRT1_2 << -M_SQRT1_2;
241  const double small = qSqrt(std::numeric_limits<qreal>::denorm_min()) / 8;
242  QTest::newRow("[small,small]->|2| (-small/2,-small/2)")
243  << -(small * .5) << -(small * .5) << (small * .5) << (small * .5)
244  << (small * M_SQRT2) << (2 * M_SQRT2) << 2.0 << 2.0;
245  const double tiny = std::numeric_limits<qreal>::min() / 2;
246  QTest::newRow("[tiny,tiny]->|2| (-tiny/2,-tiny/2)")
247  << -(tiny * .5) << -(tiny * .5) << (tiny * .5) << (tiny * .5)
248  << (tiny * M_SQRT2) << (2 * M_SQRT2) << 2.0 << 2.0;
249  QTest::newRow("[1+3e-13,1+4e-13]|1895| (1, 1)")
250  << 1.0 << 1.0 << (1 + 3e-13) << (1 + 4e-13)
251  << 5e-13 << 1895.0 << 1137.0 << 1516.0;
252  QTest::newRow("[4e-323,5e-324]|1892|") // Unavoidable underflow: denormals
253  << 0.0 << 0.0 << 4e-323 << 5e-324
254  << 4e-323 << 1892.0 << 4e-323 << 5e-324; // vx, vy values ignored
255 }
256 
257 void tst_QLine::testLength()
258 {
259  QFETCH(double, x1);
260  QFETCH(double, y1);
261  QFETCH(double, x2);
262  QFETCH(double, y2);
263  QFETCH(double, length);
264  QFETCH(double, lengthToSet);
265  QFETCH(double, vx);
266  QFETCH(double, vy);
267 
268  QLineF l(x1, y1, x2, y2);
269  QCOMPARE(l.length(), qreal(length));
270 
271  l.setLength(lengthToSet);
272 
273  if constexpr (std::numeric_limits<double>::has_denorm != std::denorm_present) {
274  if (qstrcmp(QTest::currentDataTag(), "[tiny,tiny]->|2| (-tiny/2,-tiny/2)") == 0
275  || qstrcmp(QTest::currentDataTag(), "[4e-323,5e-324]|1892|") == 0) {
276  QSKIP("Skipping 'denorm' as this type lacks denormals on this system");
277  }
278  }
279  // Scaling tiny values up to big can be imprecise: don't try to test vx, vy
280  if (length > 0 && qFuzzyIsNull(length)) {
281  QVERIFY(l.length() > lengthToSet / 2 && l.length() < lengthToSet * 2);
282  } else {
283  QCOMPARE(l.length(), length > 0 ? qreal(lengthToSet) : qreal(length));
284  QCOMPARE(l.dx(), qreal(vx));
285  QCOMPARE(l.dy(), qreal(vy));
286  }
287 }
288 
289 void tst_QLine::testCenter()
290 {
291  QFETCH(int, x1);
292  QFETCH(int, y1);
293  QFETCH(int, x2);
294  QFETCH(int, y2);
295  QFETCH(int, centerX);
296  QFETCH(int, centerY);
297 
298  const QPoint c = QLine(x1, y1, x2, y2).center();
299  QCOMPARE(centerX, c.x());
300  QCOMPARE(centerY, c.y());
301 }
302 
303 void tst_QLine::testCenter_data()
304 {
305  QTest::addColumn<int>("x1");
306  QTest::addColumn<int>("y1");
307  QTest::addColumn<int>("x2");
308  QTest::addColumn<int>("y2");
309  QTest::addColumn<int>("centerX");
310  QTest::addColumn<int>("centerY");
311 
312  QTest::newRow("[0, 0]") << 0 << 0 << 0 << 0 << 0 << 0;
313  QTest::newRow("top") << 0 << 0 << 2 << 0 << 1 << 0;
314  QTest::newRow("right") << 0 << 0 << 0 << 2 << 0 << 1;
315  QTest::newRow("bottom") << 0 << 0 << -2 << 0 << -1 << 0;
316  QTest::newRow("left") << 0 << 0 << 0 << -2 << 0 << -1;
317 
318  QTest::newRow("precision+") << 0 << 0 << 1 << 1 << 0 << 0;
319  QTest::newRow("precision-") << -1 << -1 << 0 << 0 << 0 << 0;
320 
321  const int max = std::numeric_limits<int>::max();
322  const int min = std::numeric_limits<int>::min();
323  QTest::newRow("max") << max << max << max << max << max << max;
324  QTest::newRow("min") << min << min << min << min << min << min;
325  QTest::newRow("minmax") << min << min << max << max << 0 << 0;
326 }
327 
328 void tst_QLine::testCenterF()
329 {
330  QFETCH(double, x1);
331  QFETCH(double, y1);
332  QFETCH(double, x2);
333  QFETCH(double, y2);
334  QFETCH(double, centerX);
335  QFETCH(double, centerY);
336 
337  const QPointF c = QLineF(x1, y1, x2, y2).center();
338  QCOMPARE(centerX, c.x());
339  QCOMPARE(centerY, c.y());
340 }
341 
342 void tst_QLine::testCenterF_data()
343 {
344  QTest::addColumn<double>("x1");
345  QTest::addColumn<double>("y1");
346  QTest::addColumn<double>("x2");
347  QTest::addColumn<double>("y2");
348  QTest::addColumn<double>("centerX");
349  QTest::addColumn<double>("centerY");
350 
351  QTest::newRow("[0, 0]") << 0.0 << 0.0 << 0.0 << 0.0 << 0.0 << 0.0;
352  QTest::newRow("top") << 0.0 << 0.0 << 1.0 << 0.0 << 0.5 << 0.0;
353  QTest::newRow("right") << 0.0 << 0.0 << 0.0 << 1.0 << 0.0 << 0.5;
354  QTest::newRow("bottom") << 0.0 << 0.0 << -1.0 << 0.0 << -0.5 << 0.0;
355  QTest::newRow("left") << 0.0 << 0.0 << 0.0 << -1.0 << 0.0 << -0.5;
356 
357  const double max = std::numeric_limits<qreal>::max();
358  QTest::newRow("max") << max << max << max << max << max << max;
359 }
360 
361 void tst_QLine::testNormalVector_data()
362 {
363  QTest::addColumn<double>("x1");
364  QTest::addColumn<double>("y1");
365  QTest::addColumn<double>("x2");
366  QTest::addColumn<double>("y2");
367  QTest::addColumn<double>("nvx");
368  QTest::addColumn<double>("nvy");
369 
370  QTest::newRow("[1, 0]") << 0.0 << 0.0 << 1.0 << 0.0 << 0.0 << -1.0;
371  QTest::newRow("[-1, 0]") << 0.0 << 0.0 << -1.0 << 0.0 << 0.0 << 1.0;
372  QTest::newRow("[0, 1]") << 0.0 << 0.0 << 0.0 << 1.0 << 1.0 << 0.0;
373  QTest::newRow("[0, -1]") << 0.0 << 0.0 << 0.0 << -1.0 << -1.0 << 0.0;
374  QTest::newRow("[2, 3]") << 2.0 << 3.0 << 4.0 << 6.0 << 3.0 << -2.0;
375 }
376 
377 void tst_QLine::testNormalVector()
378 {
379  QFETCH(double, x1);
380  QFETCH(double, y1);
381  QFETCH(double, x2);
382  QFETCH(double, y2);
383  QFETCH(double, nvx);
384  QFETCH(double, nvy);
385 
386  QLineF l(x1, y1, x2, y2);
387  QLineF n = l.normalVector();
388 
389  QCOMPARE(l.x1(), n.x1());
390  QCOMPARE(l.y1(), n.y1());
391 
392  QCOMPARE(n.dx(), qreal(nvx));
393  QCOMPARE(n.dy(), qreal(nvy));
394 }
395 
396 void tst_QLine::testAngle2_data()
397 {
398  QTest::addColumn<qreal>("x1");
399  QTest::addColumn<qreal>("y1");
400  QTest::addColumn<qreal>("x2");
401  QTest::addColumn<qreal>("y2");
402  QTest::addColumn<qreal>("angle");
403 
404  QTest::newRow("right") << qreal(0.0) << qreal(0.0) << qreal(10.0) << qreal(0.0) << qreal(0.0);
405  QTest::newRow("left") << qreal(0.0) << qreal(0.0) << qreal(-10.0) << qreal(0.0) << qreal(180.0);
406  QTest::newRow("up") << qreal(0.0) << qreal(0.0) << qreal(0.0) << qreal(-10.0) << qreal(90.0);
407  QTest::newRow("down") << qreal(0.0) << qreal(0.0) << qreal(0.0) << qreal(10.0) << qreal(270.0);
408 
409  QTest::newRow("diag a") << qreal(0.0) << qreal(0.0) << qreal(10.0) << qreal(-10.0) << qreal(45.0);
410  QTest::newRow("diag b") << qreal(0.0) << qreal(0.0) << qreal(-10.0) << qreal(-10.0) << qreal(135.0);
411  QTest::newRow("diag c") << qreal(0.0) << qreal(0.0) << qreal(-10.0) << qreal(10.0) << qreal(225.0);
412  QTest::newRow("diag d") << qreal(0.0) << qreal(0.0) << qreal(10.0) << qreal(10.0) << qreal(315.0);
413 }
414 
415 void tst_QLine::testAngle2()
416 {
417  QFETCH(qreal, x1);
418  QFETCH(qreal, y1);
419  QFETCH(qreal, x2);
420  QFETCH(qreal, y2);
421  QFETCH(qreal, angle);
422 
423  QLineF line(x1, y1, x2, y2);
424  QCOMPARE(line.angle(), angle);
425 
427 
428  QVERIFY(qAbs(line.x1() - polar.x1()) < epsilon);
429  QVERIFY(qAbs(line.y1() - polar.y1()) < epsilon);
430  QVERIFY(qAbs(line.x2() - polar.x2()) < epsilon);
431  QVERIFY(qAbs(line.y2() - polar.y2()) < epsilon);
432 }
433 
434 void tst_QLine::testAngle3()
435 {
436  for (int i = -720; i <= 720; ++i) {
437  QLineF line(0, 0, 100, 0);
438  line.setAngle(i);
439  const int expected = (i + 720) % 360;
440 
441  QVERIFY2(qAbs(line.angle() - qreal(expected)) < epsilon, qPrintable(QString::fromLatin1("value: %1").arg(i)));
442 
443  QCOMPARE(line.length(), qreal(100.0));
444 
445  QCOMPARE(QLineF::fromPolar(100.0, i), line);
446  }
447 }
448 
449 void tst_QLine::testAngleTo()
450 {
451  QFETCH(qreal, xa1);
452  QFETCH(qreal, ya1);
453  QFETCH(qreal, xa2);
454  QFETCH(qreal, ya2);
455  QFETCH(qreal, xb1);
456  QFETCH(qreal, yb1);
457  QFETCH(qreal, xb2);
458  QFETCH(qreal, yb2);
459  QFETCH(qreal, angle);
460 
461  QLineF a(xa1, ya1, xa2, ya2);
462  QLineF b(xb1, yb1, xb2, yb2);
463 
464  const qreal resultAngle = a.angleTo(b);
465  QVERIFY(qAbs(resultAngle - angle) < epsilon);
466 
467  a.translate(b.p1() - a.p1());
468  a.setAngle(a.angle() + resultAngle);
469  a.setLength(b.length());
470 
471  QCOMPARE(a, b);
472 }
473 
474 void tst_QLine::testAngleTo_data()
475 {
476  QTest::addColumn<qreal>("xa1");
477  QTest::addColumn<qreal>("ya1");
478  QTest::addColumn<qreal>("xa2");
479  QTest::addColumn<qreal>("ya2");
480  QTest::addColumn<qreal>("xb1");
481  QTest::addColumn<qreal>("yb1");
482  QTest::addColumn<qreal>("xb2");
483  QTest::addColumn<qreal>("yb2");
484  QTest::addColumn<qreal>("angle");
485 
486  QTest::newRow("parallel") << qreal(1.0) << qreal(1.0) << qreal(3.0) << qreal(4.0)
487  << qreal(5.0) << qreal(6.0) << qreal(7.0) << qreal(9.0)
488  << qreal(0.0);
489  QTest::newRow("[4,4]-[4,0]") << qreal(1.0) << qreal(1.0) << qreal(5.0) << qreal(5.0)
490  << qreal(0.0) << qreal(4.0) << qreal(3.0) << qreal(4.0)
491  << qreal(45.0);
492  QTest::newRow("[4,4]-[-4,0]") << qreal(1.0) << qreal(1.0) << qreal(5.0) << qreal(5.0)
493  << qreal(3.0) << qreal(4.0) << qreal(0.0) << qreal(4.0)
494  << qreal(225.0);
495 
496  for (int i = 0; i < 360; ++i) {
497  const QLineF l = QLineF::fromPolar(1, i);
498  QTest::newRow(("angle:" + QByteArray::number(i)).constData())
499  << qreal(0.0) << qreal(0.0) << qreal(1.0) << qreal(0.0)
500  << qreal(0.0) << qreal(0.0) << l.p2().x() << l.p2().y()
501  << qreal(i);
502  }
503 }
504 
506 #include "tst_qline.moc"
small capitals from c petite p scientific i
[1]
Definition: afcover.h:80
static QByteArray number(int, int base=10)
The QLineF class provides a two-dimensional vector using floating point precision.
Definition: qline.h:215
constexpr qreal x1() const
Definition: qline.h:297
constexpr qreal y2() const
Definition: qline.h:312
IntersectionType
Definition: qline.h:218
@ NoIntersection
Definition: qline.h:218
@ BoundedIntersection
Definition: qline.h:218
@ UnboundedIntersection
Definition: qline.h:218
constexpr QPointF center() const
Definition: qline.h:368
constexpr qreal x2() const
Definition: qline.h:307
static QLineF fromPolar(qreal length, qreal angle)
Definition: qline.cpp:634
constexpr qreal y1() const
Definition: qline.h:302
The QLine class provides a two-dimensional vector using integer precision.
Definition: qline.h:53
constexpr QPoint center() const
Definition: qline.h:170
The QObject class is the base class of all Qt objects.
Definition: qobject.h:125
The QPointF class defines a point in the plane using floating point precision.
Definition: qpoint.h:242
constexpr qreal x() const noexcept
Definition: qpoint.h:361
constexpr qreal y() const noexcept
Definition: qpoint.h:366
The QPoint class defines a point in the plane using integer precision.
Definition: qpoint.h:52
static QString fromLatin1(QByteArrayView ba)
Definition: qstring.cpp:5488
qsizetype length() const
Definition: qstring.h:415
double e
QCOMPARE(spy.count(), 1)
Q_TESTLIB_EXPORT QTestData & newRow(const char *dataTag)
Definition: qtestcase.cpp:2658
Q_TESTLIB_EXPORT const char * currentDataTag()
Definition: qtestcase.cpp:2758
Q_CORE_EXPORT int qstrcmp(const char *str1, const char *str2)
bool qFuzzyIsNull(qfloat16 f) noexcept
Definition: qfloat16.h:249
QT_END_INCLUDE_NAMESPACE typedef double qreal
Definition: qglobal.h:341
#define M_SQRT2
Definition: qmath.h:269
auto qSqrt(T v)
Definition: qmath.h:132
#define M_SQRT1_2
Definition: qmath.h:273
GLenum GLuint GLenum GLsizei length
Definition: qopengl.h:270
GLenum type
Definition: qopengl.h:270
GLboolean GLboolean GLboolean b
GLboolean GLboolean GLboolean GLboolean a
[7]
GLuint GLfloat GLfloat GLfloat GLfloat y1
GLuint GLfloat GLfloat GLfloat x1
GLfloat angle
GLfloat n
const GLubyte * c
Definition: qopenglext.h:12701
GLfixed GLfixed GLfixed y2
Definition: qopenglext.h:5231
GLfixed GLfixed x2
Definition: qopenglext.h:5231
QPointF qAbs(const QPointF &p)
Definition: qscroller.cpp:119
SSL_CTX int(*) void arg)
#define QTEST_MAIN(TestObject)
Definition: qtest.h:664
#define QSKIP(statement,...)
Definition: qtestcase.h:222
#define QFETCH(Type, name)
Definition: qtestcase.h:230
#define QVERIFY(statement)
Definition: qtestcase.h:64
#define QVERIFY2(statement, description)
Definition: qtestcase.h:76
#define Q_OBJECT
Definition: qtmetamacros.h:158
#define slots
Definition: qtmetamacros.h:76
const qreal epsilon
Definition: tst_qline.cpp:63