//C++ header - Open Scene Graph - Copyright (C) 1998-2001 Robert Osfield //Distributed under the terms of the GNU Library General Public License (LGPL) //as published by the Free Software Foundation. #ifndef OSG_VEC3 #define OSG_VEC3 1 #include #ifdef OSG_USE_IO_DOT_H #include #else #include using namespace std; #endif namespace osg { /** General purpose float triple for use as vertices, vectors and normals. Provides general maths operations from addition through to cross products. No support yet added for float * Vec3 - is it necessary? Need to define a non-member non-friend operator* etc. Vec3 * float is okay */ class Vec3 { public: Vec3() {} // no operations done to maintain speed Vec3(float x,float y,float z) { _v[0]=x; _v[1]=y; _v[2]=z; } float _v[3]; inline const bool operator == (const Vec3& v) const { return _v[0]==v._v[0] && _v[1]==v._v[1] && _v[2]==v._v[2]; } inline const bool operator != (const Vec3& v) const { return _v[0]!=v._v[0] || _v[1]!=v._v[1] || _v[2]!=v._v[2]; } inline const bool operator < (const Vec3& v) const { if (_v[0]v._v[0]) return false; else if (_v[1]v._v[1]) return false; else return (_v[2]