1 // This may look like C code, but it's really -*- C++ -*- 2 /* 3 * Copyright (C) 2014 Emweb bv, Herent, Belgium. 4 * 5 * See the LICENSE file for terms of use. 6 */ 7 #ifndef WVECTOR3_H_ 8 #define WVECTOR3_H_ 9 10 #include "Wt/WGenericMatrix.h" 11 #include "Wt/WVector4.h" 12 13 namespace Wt { 14 class WT_API WVector3: public WGenericMatrix<double, 3, 1> 15 { 16 public: 17 WVector3(); 18 WVector3(const WVector3 &other); 19 WVector3(const WVector4 &other); WVector3(const WGenericMatrix<double,3,1>::MatrixType & m)20 WVector3(const WGenericMatrix<double, 3, 1>::MatrixType &m) { 21 impl() = m; 22 } 23 WVector3(const WGenericMatrix<double, 3, 1> &other); 24 explicit WVector3(double *d); 25 WVector3(double x, double y, double z); 26 27 const double &x() const; 28 const double &y() const; 29 const double &z() const; 30 double &x(); 31 double &y(); 32 double &z(); 33 34 WVector3 normalize() const; 35 double length() const; 36 WVector3 cross(const WVector3 &other) const; 37 double dot(const WVector3 &other) const; 38 39 #ifdef WT_TARGET_JAVA 40 void setElement(int i, double v); 41 #endif 42 }; 43 } 44 45 #endif // WVECTOR3_H_ 46