SimplexCenter.h

Go to the documentation of this file.
00001 /* Copyright Benoit Hudson 2008 */
00002 #ifndef SimplexCenter_HEADER
00003 #define SimplexCenter_HEADER
00004 
00005 #ifdef HAVE_CONFIG_H
00006  #include <config.h>
00007 #endif
00008 
00009 #include <geometry/Circles.h>
00010 
00011 template <class Simplex, unsigned ambient, unsigned topological>
00012 struct SimplexCenter
00013 #ifdef HAVE_LAPACK
00014 {
00015   typename Geometry::CenterRadius<ambient> operator() (const Simplex& s) const {
00016     // this is excrutiatingly slow
00017     boost::array<Point, topological + 1> points;
00018     for(unsigned i = 0; i <= topological; i++) {
00019       points[i] = simplex[i]->toPoint();
00020     }
00021     return Geometry::circumcenter<ambient, topological>(points);
00022   }
00023 }
00024 #endif
00025 ;
00026 
00027 template <class Simplex, unsigned ambient>
00028 struct SimplexCenter<Simplex, ambient, 1>
00029 {
00030   typename Geometry::CenterRadius<ambient> operator() (const Simplex& s) const {
00031     return Geometry::circumcenter_segment<ambient>(s[0]->toPoint(),
00032         s[1]->toPoint());
00033   }
00034 };
00035 
00036 template <class Simplex, unsigned ambient>
00037 struct SimplexCenter<Simplex, ambient, 2>
00038 {
00039   typename Geometry::CenterRadius<ambient> operator() (const Simplex& s) const {
00040     return Geometry::circumcenter_triangle<ambient>(s[0]->toPoint(),
00041         s[1]->toPoint(), s[2]->toPoint());
00042   }
00043 };
00044 
00045 template <class Simplex, unsigned ambient>
00046 struct SimplexCenter<Simplex, ambient, 3>
00047 {
00048   typename Geometry::CenterRadius<ambient> operator() (const Simplex& s) const {
00049     return Geometry::circumcenter_tetrahedron<ambient>(s[0]->toPoint(),
00050         s[1]->toPoint(), s[2]->toPoint(), s[3]->toPoint());
00051   }
00052 };
00053 
00054 #endif

Generated on Thu Mar 27 19:04:12 2008 by  doxygen 1.4.6