HyperspaceExplorer 0.7.1
|
00001 /* 00002 Hyperspace Explorer - visualizing 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 SURFACEIMPLEMENTATIONS_H 00022 #define SURFACEIMPLEMENTATIONS_H 00023 00024 #include "Surface.h" 00025 00027 00034 class Surface1: public Surface { 00035 public: 00036 Surface1(): Surface() { 00037 _function = std::shared_ptr< ParametricFunction<4, 2> >(new DefiningFunction(this)); 00038 } 00039 Surface1 (double _umin, double _umax, double _du, 00040 double _vmin, double _vmax, double _dv); 00041 virtual ~Surface1() { } 00042 00043 virtual std::string getFunctionName() const { return "Surface1"; } 00044 00045 private: 00046 00048 class DefiningFunction: public ParametricFunction<4, 2> { 00049 public: 00050 DefiningFunction(Surface1 *parent): parent_(parent) { } 00051 virtual return_type f(const argument_type &x); 00052 private: 00054 Surface1 *parent_; 00055 }; 00056 00057 }; 00058 00059 namespace { 00060 Displayable *createSurface1() { return new Surface1(); } 00061 const bool registeredS1 = 00062 TheFunctionFactory::Instance().registerFunction(createSurface1, "Surface"); 00063 } 00064 00066 00076 class Horizon: public Surface { 00077 public: 00078 Horizon(): Surface() { 00079 _function = std::shared_ptr< ParametricFunction<4, 2> >(new DefiningFunction(this)); 00080 } 00081 Horizon (double _umin, double _umax, double _du, 00082 double _vmin, double _vmax, double _dv); 00083 virtual ~Horizon () { } 00084 00085 virtual std::string getFunctionName() const { return "Horizon"; } 00086 00087 private: 00088 00090 class DefiningFunction: public ParametricFunction<4, 2> { 00091 public: 00092 DefiningFunction(Horizon *parent): parent_(parent) { } 00093 virtual return_type f(const argument_type &x); 00094 private: 00096 Horizon *parent_; 00097 }; 00098 00099 }; 00100 00101 namespace { 00102 Displayable *createHorizon() { return new Horizon(); } 00103 const bool registeredS2 = 00104 TheFunctionFactory::Instance().registerFunction(createHorizon, "Surface"); 00105 } 00106 00108 00109 class Torus3: public Surface { 00110 public: 00111 Torus3(): Surface() { 00112 _function = std::shared_ptr< ParametricFunction<4, 2> >(new DefiningFunction(this)); 00113 } 00114 Torus3 (double _umin, double _umax, double _du, 00115 double _vmin, double _vmax, double _dv); 00116 virtual ~Torus3 () { } 00117 00118 virtual std::string getFunctionName() const { return "Torus3"; } 00119 00120 private: 00121 00123 class DefiningFunction: public ParametricFunction<4, 2> { 00124 public: 00125 DefiningFunction(Torus3 *parent): parent_(parent) { } 00126 virtual return_type f(const argument_type &x); 00127 private: 00129 Torus3 *parent_; 00130 }; 00131 00132 }; 00133 00134 namespace { 00135 Displayable *createTorus3() { return new Torus3(); } 00136 const bool registeredS3 = 00137 TheFunctionFactory::Instance().registerFunction(createTorus3, "Surface"); 00138 } 00139 00140 #endif // SURFACEIMPLEMENTATIONS_H