HyperspaceExplorer 0.7.1
ViewpointList.h
00001 /*
00002     Hyperspace Explorer - vizualizing higher-dimensional geometry
00003     Copyright (C) 2010  Lene Preuss <lene.preuss@gmail.com>
00004 
00005     This program is free software; you can redistribute it and/or modify
00006     it under the terms of the GNU General Public License as published by
00007     the Free Software Foundation; either version 2 of the License, or
00008     (at your option) any later version.
00009 
00010     This program is distributed in the hope that it will be useful,
00011     but WITHOUT ANY WARRANTY; without even the implied warranty of
00012     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00013     GNU General Public License for more details.
00014 
00015     You should have received a copy of the GNU General Public License along
00016     with this program; if not, write to the Free Software Foundation, Inc.,
00017     51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
00018 
00019 */
00020 
00021 #ifndef VIEWPOINTLIST_H
00022 #define VIEWPOINTLIST_H
00023 
00024 #include "Vector.h"
00025 
00027 
00036 template <unsigned N, unsigned Nnew, typename NUM = double> class ViewpointList {
00037 
00038   public:
00039 
00041     ViewpointList();
00042 
00044     ViewpointList(NUM camW);
00045 
00047     ViewpointList(const VecMath::Vector<N, NUM> &single_element);
00049     ViewpointList(const VecMath::Vector<N, NUM> &head, const ViewpointList<N-1, Nnew, NUM> &tail);
00050 
00052     const VecMath::Vector<N, NUM> &head() const { return _elements.first; }
00054     VecMath::Vector<N, NUM> &head() { return _elements.first; }
00056     const ViewpointList<N-1, Nnew, NUM> &tail() const { return _elements.second; }
00058     ViewpointList<N-1, Nnew, NUM> &tail() { return _elements.second; }
00059 
00061 
00063     template <unsigned i> VecMath::Vector<N-i, NUM> get() {
00064       if (i == 0) return head();
00065       return tail().get<i-1>();
00066     }
00067 //    template <> VecMath::Vector<N> get<0>() { return head(); }
00068 
00070     std::string toString() const { return _elements.first.toString()+", "+_elements.second.toString(); }
00071 
00073     static ViewpointList make(const VecMath::Vector<N, NUM>   &x0);
00075     static ViewpointList make(const VecMath::Vector<N, NUM>   &x0, const VecMath::Vector<N-1, NUM> &x1);
00077     static ViewpointList make(const VecMath::Vector<N, NUM>   &x0, const VecMath::Vector<N-1, NUM> &x1,
00078                               const VecMath::Vector<N-2, NUM> &x2);
00080     static ViewpointList make(const VecMath::Vector<N, NUM>   &x0, const VecMath::Vector<N-1, NUM> &x1,
00081                               const VecMath::Vector<N-2, NUM> &x2, const VecMath::Vector<N-3, NUM> &x3);
00083     static ViewpointList make(const VecMath::Vector<N, NUM>   &x0, const VecMath::Vector<N-1, NUM> &x1,
00084                               const VecMath::Vector<N-2, NUM> &x2, const VecMath::Vector<N-3, NUM> &x3,
00085                               const VecMath::Vector<N-4, NUM> &x4);
00087     static ViewpointList make(const VecMath::Vector<N, NUM>   &x0, const VecMath::Vector<N-1, NUM> &x1,
00088                               const VecMath::Vector<N-2, NUM> &x2, const VecMath::Vector<N-3, NUM> &x3,
00089                               const VecMath::Vector<N-4, NUM> &x4, const VecMath::Vector<N-5, NUM> &x5);
00091     static ViewpointList make(const VecMath::Vector<N, NUM>   &x0, const VecMath::Vector<N-1, NUM> &x1,
00092                               const VecMath::Vector<N-2, NUM> &x2, const VecMath::Vector<N-3, NUM> &x3,
00093                               const VecMath::Vector<N-4, NUM> &x4, const VecMath::Vector<N-5, NUM> &x5,
00094                               const VecMath::Vector<N-6, NUM> &x6);
00096     static ViewpointList make(const VecMath::Vector<N, NUM>   &x0, const VecMath::Vector<N-1, NUM> &x1,
00097                               const VecMath::Vector<N-2, NUM> &x2, const VecMath::Vector<N-3, NUM> &x3,
00098                               const VecMath::Vector<N-4, NUM> &x4, const VecMath::Vector<N-5, NUM> &x5,
00099                               const VecMath::Vector<N-6, NUM> &x6, const VecMath::Vector<N-7, NUM> &x7);
00100 
00101   private:
00102 
00104     std::pair< VecMath::Vector<N, NUM>, ViewpointList<N-1, Nnew, NUM> > _elements;
00105 };
00106 
00108 
00112 template <unsigned N, typename NUM> class ViewpointList<N, N, NUM> {
00113   public:
00115     ViewpointList() { }
00117     ViewpointList(NUM) { }
00119     std::string toString() const { return ""; }
00120 };
00121 
00122 #endif
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Friends

Generated on Mon Apr 9 2012 20:25:16 for HyperspaceExplorer 0.7.1 by doxygen 1.7.4  -  Hosted bySourceForge.net Logo