Line | Source Code | Coverage |
---|
1 | | - |
2 | | - |
3 | QVector4D::QVector4D(const QVector2D& vector) | - |
4 | { | - |
5 | xp = vector.xp; | - |
6 | yp = vector.yp; | - |
7 | zp = 0.0f; | - |
8 | wp = 0.0f; | - |
9 | } executed: } Execution Count:1 | 1 |
10 | | - |
11 | | - |
12 | | - |
13 | | - |
14 | | - |
15 | | - |
16 | | - |
17 | QVector4D::QVector4D(const QVector2D& vector, float zpos, float wpos) | - |
18 | { | - |
19 | xp = vector.xp; | - |
20 | yp = vector.yp; | - |
21 | zp = zpos; | - |
22 | wp = wpos; | - |
23 | } executed: } Execution Count:1 | 1 |
24 | QVector4D::QVector4D(const QVector3D& vector) | - |
25 | { | - |
26 | xp = vector.xp; | - |
27 | yp = vector.yp; | - |
28 | zp = vector.zp; | - |
29 | wp = 0.0f; | - |
30 | } executed: } Execution Count:1 | 1 |
31 | | - |
32 | | - |
33 | | - |
34 | | - |
35 | | - |
36 | | - |
37 | | - |
38 | QVector4D::QVector4D(const QVector3D& vector, float wpos) | - |
39 | { | - |
40 | xp = vector.xp; | - |
41 | yp = vector.yp; | - |
42 | zp = vector.zp; | - |
43 | wp = wpos; | - |
44 | } executed: } Execution Count:1 | 1 |
45 | float QVector4D::length() const | - |
46 | { | - |
47 | | - |
48 | double len = double(xp) * double(xp) + | - |
49 | double(yp) * double(yp) + | - |
50 | double(zp) * double(zp) + | - |
51 | double(wp) * double(wp); | - |
52 | return float(sqrt(len)); executed: return float(sqrt(len)); Execution Count:28 | 28 |
53 | } | - |
54 | | - |
55 | | - |
56 | | - |
57 | | - |
58 | | - |
59 | | - |
60 | | - |
61 | float QVector4D::lengthSquared() const | - |
62 | { | - |
63 | return xp * xp + yp * yp + zp * zp + wp * wp; executed: return xp * xp + yp * yp + zp * zp + wp * wp; Execution Count:10 | 10 |
64 | } | - |
65 | QVector4D QVector4D::normalized() const | - |
66 | { | - |
67 | | - |
68 | double len = double(xp) * double(xp) + | - |
69 | double(yp) * double(yp) + | - |
70 | double(zp) * double(zp) + | - |
71 | double(wp) * double(wp); | - |
72 | if (qFuzzyIsNull(len - 1.0f)) { evaluated: qFuzzyIsNull(len - 1.0f) yes Evaluation Count:8 | yes Evaluation Count:2 |
| 2-8 |
73 | return *this; executed: return *this; Execution Count:8 | 8 |
74 | } else if (!qFuzzyIsNull(len)) { evaluated: !qFuzzyIsNull(len) yes Evaluation Count:1 | yes Evaluation Count:1 |
| 1 |
75 | double sqrtLen = sqrt(len); | - |
76 | return QVector4D(float(double(xp) / sqrtLen), | 1 |
77 | float(double(yp) / sqrtLen), | 1 |
78 | float(double(zp) / sqrtLen), | 1 |
79 | float(double(wp) / sqrtLen)); executed: return QVector4D(float(double(xp) / sqrtLen), float(double(yp) / sqrtLen), float(double(zp) / sqrtLen), float(double(wp) / sqrtLen)); Execution Count:1 | 1 |
80 | } else { | - |
81 | return QVector4D(); executed: return QVector4D(); Execution Count:1 | 1 |
82 | } | - |
83 | } | - |
84 | | - |
85 | | - |
86 | | - |
87 | | - |
88 | | - |
89 | | - |
90 | | - |
91 | void QVector4D::normalize() | - |
92 | { | - |
93 | | - |
94 | double len = double(xp) * double(xp) + | - |
95 | double(yp) * double(yp) + | - |
96 | double(zp) * double(zp) + | - |
97 | double(wp) * double(wp); | - |
98 | if (qFuzzyIsNull(len - 1.0f) || qFuzzyIsNull(len)) evaluated: qFuzzyIsNull(len - 1.0f) yes Evaluation Count:8 | yes Evaluation Count:2 |
evaluated: qFuzzyIsNull(len) yes Evaluation Count:1 | yes Evaluation Count:1 |
| 1-8 |
99 | return; executed: return; Execution Count:9 | 9 |
100 | | - |
101 | len = sqrt(len); | - |
102 | | - |
103 | xp = float(double(xp) / len); | - |
104 | yp = float(double(yp) / len); | - |
105 | zp = float(double(zp) / len); | - |
106 | wp = float(double(wp) / len); | - |
107 | } executed: } Execution Count:1 | 1 |
108 | float QVector4D::dotProduct(const QVector4D& v1, const QVector4D& v2) | - |
109 | { | - |
110 | return v1.xp * v2.xp + v1.yp * v2.yp + v1.zp * v2.zp + v1.wp * v2.wp; executed: return v1.xp * v2.xp + v1.yp * v2.yp + v1.zp * v2.zp + v1.wp * v2.wp; Execution Count:6 | 6 |
111 | } | - |
112 | QVector2D QVector4D::toVector2D() const | - |
113 | { | - |
114 | return QVector2D(xp, yp); executed: return QVector2D(xp, yp); Execution Count:1 | 1 |
115 | } | - |
116 | QVector2D QVector4D::toVector2DAffine() const | - |
117 | { | - |
118 | if (qIsNull(wp)) evaluated: qIsNull(wp) yes Evaluation Count:1 | yes Evaluation Count:1 |
| 1 |
119 | return QVector2D(); executed: return QVector2D(); Execution Count:1 | 1 |
120 | return QVector2D(xp / wp, yp / wp); executed: return QVector2D(xp / wp, yp / wp); Execution Count:1 | 1 |
121 | } | - |
122 | QVector3D QVector4D::toVector3D() const | - |
123 | { | - |
124 | return QVector3D(xp, yp, zp); executed: return QVector3D(xp, yp, zp); Execution Count:1 | 1 |
125 | } | - |
126 | | - |
127 | | - |
128 | | - |
129 | | - |
130 | | - |
131 | | - |
132 | | - |
133 | QVector3D QVector4D::toVector3DAffine() const | - |
134 | { | - |
135 | if (qIsNull(wp)) evaluated: qIsNull(wp) yes Evaluation Count:1 | yes Evaluation Count:1 |
| 1 |
136 | return QVector3D(); executed: return QVector3D(); Execution Count:1 | 1 |
137 | return QVector3D(xp / wp, yp / wp, zp / wp); executed: return QVector3D(xp / wp, yp / wp, zp / wp); Execution Count:1 | 1 |
138 | } | - |
139 | QVector4D::operator QVariant() const | - |
140 | { | - |
141 | return QVariant(QVariant::Vector4D, this); executed: return QVariant(QVariant::Vector4D, this); Execution Count:1 | 1 |
142 | } | - |
143 | | - |
144 | | - |
145 | | - |
146 | QDebug operator<<(QDebug dbg, const QVector4D &vector) | - |
147 | { | - |
148 | dbg.nospace() << "QVector4D(" | - |
149 | << vector.x() << ", " << vector.y() << ", " | - |
150 | << vector.z() << ", " << vector.w() << ')'; | - |
151 | return dbg.space(); executed: return dbg.space(); Execution Count:1 | 1 |
152 | } | - |
153 | QDataStream &operator<<(QDataStream &stream, const QVector4D &vector) | - |
154 | { | - |
155 | stream << vector.x() << vector.y() | - |
156 | << vector.z() << vector.w(); | - |
157 | return stream; never executed: return stream; | 0 |
158 | } | - |
159 | QDataStream &operator>>(QDataStream &stream, QVector4D &vector) | - |
160 | { | - |
161 | float x, y, z, w; | - |
162 | stream >> x; | - |
163 | stream >> y; | - |
164 | stream >> z; | - |
165 | stream >> w; | - |
166 | vector.setX(x); | - |
167 | vector.setY(y); | - |
168 | vector.setZ(z); | - |
169 | vector.setW(w); | - |
170 | return stream; never executed: return stream; | 0 |
171 | } | - |
172 | | - |
173 | | - |
174 | | - |
175 | | - |
176 | | - |
177 | | - |
178 | | - |
| | |