src/basics.h

changeset 1313
4baed9f54de3
parent 1311
8d22e1dd272d
child 1314
d94cf95608ac
--- a/src/basics.h	Fri Mar 23 19:30:53 2018 +0200
+++ b/src/basics.h	Fri Mar 23 21:30:24 2018 +0200
@@ -95,32 +95,33 @@
 Winding operator^(Winding one, Winding other);
 Winding& operator^=(Winding& one, Winding other);
 
-//
-// Derivative of QVector3D: this class is used for the vertices.
-//
-class Vertex : public QVector3D
+struct Vertex
 {
-public:
+	qreal x, y, z;
+
 	using ApplyFunction = std::function<void (Axis, double&)>;
 	using ApplyConstFunction = std::function<void (Axis, double)>;
 
-	Vertex();
-	Vertex (const QVector3D& a);
-	Vertex (qreal xpos, qreal ypos, qreal zpos);
-
 	void	apply (ApplyFunction func);
 	void	apply (ApplyConstFunction func) const;
 	QString	toString (bool mangled = false) const;
+	QVector3D toVector() const;
 	void	transform (const Matrix& matr, const Vertex& pos);
 	Vertex	transformed(const GLRotationMatrix& matrix) const;
 	void	setCoordinate (Axis ax, qreal value);
 
-	Vertex&	operator+= (const Vertex& other);
-	Vertex	operator+ (const Vertex& other) const;
+	Vertex&	operator+= (const QVector3D& other);
+	Vertex	operator+ (const QVector3D& other) const;
+	QVector3D operator- (const Vertex& other) const;
+	Vertex operator- (const QVector3D& vector) const;
+	Vertex& operator-= (const QVector3D& vector);
 	Vertex&	operator*= (qreal scalar);
 	Vertex	operator* (qreal scalar) const;
 	bool	operator< (const Vertex& other) const;
+	double&	operator[] (Axis ax);
 	double	operator[] (Axis ax) const;
+	bool operator==(const Vertex& other) const;
+	bool operator!=(const Vertex& other) const;
 };
 
 inline Vertex operator* (qreal scalar, const Vertex& vertex)

mercurial