]> git.mxchange.org Git - simgear.git/blobdiff - simgear/math/SGTriangle.hxx
Initialize random number for the tests.
[simgear.git] / simgear / math / SGTriangle.hxx
index 888102cf5d8026bb86d2954af66eb13af0d727b5..bc395ab9cfdce4b41b0e6d4134ecf5789f505d70 100644 (file)
@@ -41,14 +41,8 @@ public:
     _d[1] = v[2] - v[0];
   }
 
-  SGVec3d getCenter() const
-  {
-    SGBoxd box;
-    box.expandBy(_v0);
-    box.expandBy(_v0 + _d[0]);
-    box.expandBy(_v0 + _d[1]);
-    return box.getCenter();
-  }
+  SGVec3<T> getCenter() const
+  { return _v0 + T(1)/T(3)*(_d[0] + _d[1]); }
 
   // note that the index is unchecked
   SGVec3<T> getVertex(unsigned i) const