189 + matrix(2, 1) * this->y |
189 + matrix(2, 1) * this->y |
190 + matrix(2, 2) * this->z, |
190 + matrix(2, 2) * this->z, |
191 }; |
191 }; |
192 } |
192 } |
193 |
193 |
|
194 /* |
|
195 * Returns the distance from one vertex to another. |
|
196 */ |
|
197 qreal distance(const Vertex& one, const Vertex& other) |
|
198 { |
|
199 return (one - other).length(); |
|
200 } |
|
201 |
|
202 /* |
|
203 * Inserts this vertex into a data stream. This is needed for vertices to be |
|
204 * stored in QSettings. |
|
205 */ |
194 QDataStream& operator<<(QDataStream& out, const Vertex& vertex) |
206 QDataStream& operator<<(QDataStream& out, const Vertex& vertex) |
195 { |
207 { |
196 return out << vertex.x << vertex.y << vertex.z; |
208 return out << vertex.x << vertex.y << vertex.z; |
197 } |
209 } |
198 |
210 |
|
211 /* |
|
212 * Takes a vertex from a data stream. |
|
213 */ |
199 QDataStream& operator>>(QDataStream& in, Vertex& vertex) |
214 QDataStream& operator>>(QDataStream& in, Vertex& vertex) |
200 { |
215 { |
201 return in >> vertex.x >> vertex.y >> vertex.z; |
216 return in >> vertex.x >> vertex.y >> vertex.z; |
202 } |
217 } |
203 |
218 |