| 49 | 
  | 
    class Vector3 : public Vector<Real, 3>{ | 
| 50 | 
  | 
        public: | 
| 51 | 
  | 
 | 
| 52 | 
< | 
            Vector3() : Vector<Real, 3>(){} | 
| 52 | 
> | 
        Vector3() : Vector<Real, 3>(){} | 
| 53 | 
  | 
 | 
| 54 | 
  | 
            /** Constructs and initializes a Vector3 from x, y, z coordinates */             | 
| 55 | 
  | 
            inline Vector3( double x, double y, double z) { | 
| 70 | 
  | 
             * Retunrs reference of the first element of Vector3. | 
| 71 | 
  | 
             * @return reference of the first element of Vector3 | 
| 72 | 
  | 
             */ | 
| 73 | 
< | 
            inline double& x() {  return data_[0];} | 
| 73 | 
> | 
            inline Real& x() {  return data_[0];} | 
| 74 | 
  | 
 | 
| 75 | 
  | 
            /** | 
| 76 | 
  | 
             * Retunrs the first element of Vector3. | 
| 77 | 
  | 
             * @return  the first element of Vector3 | 
| 78 | 
  | 
             */ | 
| 79 | 
< | 
            inline double x() const {  return data_[0];} | 
| 79 | 
> | 
            inline Real x() const {  return data_[0];} | 
| 80 | 
  | 
 | 
| 81 | 
  | 
            /** | 
| 82 | 
  | 
             * Retunrs reference of the second element of Vector3. | 
| 83 | 
  | 
             * @return reference of the second element of Vector3 | 
| 84 | 
  | 
             */ | 
| 85 | 
< | 
            inline double& y() {  return data_[1];} | 
| 85 | 
> | 
            inline Real& y() {  return data_[1];} | 
| 86 | 
  | 
 | 
| 87 | 
  | 
            /** | 
| 88 | 
  | 
             * Retunrs  the second element of Vector3. | 
| 89 | 
  | 
             * @return c the second element of Vector3 | 
| 90 | 
  | 
             */ | 
| 91 | 
< | 
            inline double y() const {  return data_[1];} | 
| 91 | 
> | 
            inline Real y() const {  return data_[1];} | 
| 92 | 
  | 
 | 
| 93 | 
  | 
            /** | 
| 94 | 
  | 
             * Retunrs reference of the third element of Vector3. | 
| 95 | 
  | 
             * @return reference of the third element of Vector3 | 
| 96 | 
  | 
             */ | 
| 97 | 
< | 
            inline double& z() {  return data_[2];} | 
| 97 | 
> | 
            inline Real& z() {  return data_[2];} | 
| 98 | 
  | 
 | 
| 99 | 
  | 
            /** | 
| 100 | 
  | 
             * Retunrs  the third element of Vector3. | 
| 101 | 
  | 
             * @return f the third element of Vector3 | 
| 102 | 
  | 
             */ | 
| 103 | 
< | 
            inline double z() const {  return data_[2];} | 
| 103 | 
> | 
            inline Real z() const {  return data_[2];} | 
| 104 | 
  | 
 | 
| 105 | 
  | 
    }; | 
| 106 | 
  | 
 | 
| 114 | 
  | 
    template<typename Real> | 
| 115 | 
  | 
    Vector3<Real> cross( const Vector3<Real>& v1, const Vector3<Real>& v2 ) { | 
| 116 | 
  | 
        Vector3<Real> result; | 
| 117 | 
– | 
                 | 
| 118 | 
– | 
                result.x() = v1.y() * v2.z() - v1.z() * v2.y(); | 
| 119 | 
– | 
                result.y() = v1.z() * v2.x() - v1.x() * v2.z(); | 
| 120 | 
– | 
                result.z() = v1.x() * v2.y() - v1.y() * v2.x(); | 
| 117 | 
  | 
 | 
| 118 | 
< | 
                return result; | 
| 118 | 
> | 
        result.x() = v1.y() * v2.z() - v1.z() * v2.y(); | 
| 119 | 
> | 
        result.y() = v1.z() * v2.x() - v1.x() * v2.z(); | 
| 120 | 
> | 
        result.z() = v1.x() * v2.y() - v1.y() * v2.x(); | 
| 121 | 
> | 
 | 
| 122 | 
> | 
        return result; | 
| 123 | 
  | 
    } | 
| 124 | 
+ | 
 | 
| 125 | 
+ | 
 | 
| 126 | 
+ | 
    template Vector3<double> Vector3d;     | 
| 127 | 
  | 
         | 
| 128 | 
  | 
} | 
| 129 | 
  | 
 |