diff options
Diffstat (limited to 'point3d.h')
-rw-r--r-- | point3d.h | 12 |
1 files changed, 12 insertions, 0 deletions
@@ -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) |