summaryrefslogtreecommitdiffstats
path: root/point3d.h
diff options
context:
space:
mode:
Diffstat (limited to 'point3d.h')
-rw-r--r--point3d.h12
1 files changed, 12 insertions, 0 deletions
diff --git a/point3d.h b/point3d.h
index 2e37e42..5bf4212 100644
--- a/point3d.h
+++ b/point3d.h
@@ -3,6 +3,8 @@
#include "math.h"
+#include <qglobal.h>
+
struct Point3d
{
float x, y, z;
@@ -41,6 +43,16 @@ struct Point3d
{
return Point3d(x * f, y * f, z * f);
}
+
+ float &operator[](unsigned int index) {
+ Q_ASSERT(index < 3);
+ return (&x)[index];
+ }
+
+ const float &operator[](unsigned int index) const {
+ Q_ASSERT(index < 3);
+ return (&x)[index];
+ }
};
inline float dot(const Point3d &a, const Point3d &b)