#include <Ellipse.h>
Definition at line 13 of file Ellipse.h.
◆ Ellipse() [1/2]
◆ Ellipse() [2/2]
| Ellipse::Ellipse |
( |
const QPointF & | p1, |
|
|
const QPointF & | p2, |
|
|
const QPointF & | p3 ) |
◆ ~Ellipse()
◆ boundingRect()
| QRectF Ellipse::boundingRect |
( |
| ) |
const |
Definition at line 62 of file Ellipse.cc.
63{
65 const QPointF pts[4] = {
70 };
71 QRectF ret;
72 for (int i = 0; i < 4; ++i) {
73 ret = ret.united(QRectF(pts[i], QSizeF(0.0001, 0.0001)));
74 }
75 return ret;
76}
QPointF rotate90(const QPointF &p)
References a, b, p1, p2, and rotate90().
◆ changeMajor()
| bool Ellipse::changeMajor |
( |
| ) |
|
|
private |
Definition at line 87 of file Ellipse.cc.
88{
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122 const qreal
129 x1sqr = x1 * x1,
130 x2sqr = x2 * x2,
131 y1sqr = y1 * y1,
132 y2sqr = y2 * y2,
133 factor = 1.0 / (x1sqr + y1sqr + x2sqr + y2sqr - 2.0 * y1 * y2 - 2.0 * x1 * x2),
134 m11 = (x2*x2p - x1*x2p + (x1-x2)*x1p) * factor,
135 m12 = -(x2p*y2 - x1p*y2 + (x1p-x2p)*y1) * factor,
136 dx = (x1*(-x2*x2p) + y1*(-x2p*y2 - x1p*y2) + x2p*y1sqr + x1sqr*x2p + x1p*(y2sqr + x2sqr - x1*x2)) * factor,
137 dy = (x1*(x2p*y2) + y1*(-x2*x2p + x2*x1p) - x1*x1p*y2) * factor;
138
139 matrix = QTransform(m11, m12, -m12, m11, dx, dy);
141
143}
qreal length(const QPointF &vec)
References a, changeMinor(), inverse, length(), matrix, p1, and p2.
◆ changeMinor()
| bool Ellipse::changeMinor |
( |
| ) |
|
|
private |
Definition at line 145 of file Ellipse.cc.
146{
148
149
150
151
152
153
154 const qreal
156 xsqr =
p.x() *
p.x(),
157 ysqr =
p.y() *
p.y(),
158 divisor = (1.0 - xsqr / asqr);
159 if (divisor <= 0) {
160
162 return false;
163 }
164 b = sqrt(ysqr / divisor);
165 return true;
166}
References a, b, matrix, p, and p3.
◆ getInverse()
| const QTransform & Ellipse::getInverse |
( |
| ) |
const |
|
inline |
◆ getTransform()
| const QTransform & Ellipse::getTransform |
( |
| ) |
const |
|
inline |
◆ major1()
| const QPointF & Ellipse::major1 |
( |
| ) |
const |
|
inline |
◆ major2()
| const QPointF & Ellipse::major2 |
( |
| ) |
const |
|
inline |
◆ point()
| const QPointF & Ellipse::point |
( |
| ) |
const |
|
inline |
◆ project()
| QPointF Ellipse::project |
( |
const QPointF & | pt | ) |
const |
Definition at line 39 of file Ellipse.cc.
40{
41 if (
a <= 0 ||
b <= 0)
return pt;
43
44
45
46
47
48
49
50 const qreal divisor = sqrt(
a *
a *
p.y() *
p.y() +
b *
b *
p.x() *
p.x());
51 if (divisor <= 0)
return inverse.map(QPointF(
a, 0));
52 const qreal ab =
a *
b, factor = 1.0 / divisor;
53 QPointF ep(ab *
p.x() * factor, ab *
p.y() * factor);
55
56}
References a, b, inverse, matrix, and p.
◆ semiMajor()
| qreal Ellipse::semiMajor |
( |
| ) |
const |
|
inline |
◆ semiMinor()
| qreal Ellipse::semiMinor |
( |
| ) |
const |
|
inline |
◆ set()
| bool Ellipse::set |
( |
const QPointF & | m1, |
|
|
const QPointF & | m2, |
|
|
const QPointF & | p ) |
Definition at line 23 of file Ellipse.cc.
24{
25 bool changedMajor = m1 !=
p1 || m2 !=
p2,
26 changedMinor = !changedMajor &&
p !=
p3;
30 if (changedMajor) {
32 } else if (changedMinor) {
34 } else {
35 return a > 0 &&
b > 0;
36 }
37}
References a, b, changeMajor(), changeMinor(), p, p1, p2, and p3.
◆ setMajor1()
| bool Ellipse::setMajor1 |
( |
const QPointF & | p | ) |
|
◆ setMajor2()
| bool Ellipse::setMajor2 |
( |
const QPointF & | p | ) |
|
◆ setPoint()
| bool Ellipse::setPoint |
( |
const QPointF & | p | ) |
|
◆ inverse
| QTransform Ellipse::inverse |
|
private |
◆ matrix
| QTransform Ellipse::matrix |
|
private |
◆ p1
◆ p2
◆ p3
The documentation for this class was generated from the following files: