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 COMPOSITE_H 00022 #define COMPOSITE_H 00023 #include "Displayable.h" 00024 00025 #include <memory> 00026 00027 struct CompositeComponent { 00028 CompositeComponent( 00029 std::shared_ptr< Displayable > component, 00030 const VecMath::Vector< 4 > &translation = VecMath::makeVector(0., 0., 0., 0.), 00031 const VecMath::Rotation< 4 > &rotation = VecMath::makeRotation(0., 0., 0., 0., 0., 0.), 00032 const VecMath::Vector< 4 > &scale = 1. 00033 ): 00034 component_(component), translation_(translation), rotation_(rotation), scale_(scale) { } 00035 00036 std::shared_ptr< Displayable > component_; 00037 VecMath::Vector< 4 > translation_; 00038 VecMath::Rotation< 4 > rotation_; 00039 VecMath::Vector< 4 > scale_; 00040 }; 00041 00042 class Composite: public Displayable { 00043 00044 public: 00045 00046 Composite(); 00047 Composite(ParameterMap parameters); 00048 virtual ~Composite(); 00049 00050 void addComponent(std::shared_ptr<Displayable> component, 00051 const VecMath::Vector<4> &translation, 00052 const VecMath::Rotation<4> &rotation, 00053 const VecMath::Vector<4> &scale = 1.); 00054 const CompositeComponent &getComponent(unsigned i) const; 00055 unsigned getNumComponents(); 00056 00057 virtual void Transform( 00058 const VecMath::Rotation< 4 >& R, 00059 const VecMath::Vector< 4 >& T, 00060 const VecMath::Vector< 4 >& scale = 1.); 00061 virtual void Project(double ScrW, double CamW, bool DepthCue4D); 00062 virtual void Draw(UI::View *); 00063 00064 virtual void for_each_vertex(Displayable::function_on_fourspace_vertex apply); 00065 virtual void for_each_vertex_transformed(function_on_fourspace_and_transformed_vertex apply); 00066 virtual void for_each_projected(Displayable::function_on_projected_vertex apply); 00067 virtual void for_each_vertex_transformed_projected(function_on_fourspace_transformed_and_projected_vertex apply); 00068 00069 virtual unsigned int getDefinitionSpaceDimensions(); 00070 virtual void calibrateColors(); 00071 virtual void ReInit(double _tmin, double _tmax, double _dt, 00072 double _umin, double _umax, double _du, 00073 double _vmin, double _vmax, double _dv); 00074 00075 00076 protected: 00077 00078 // virtual void Initialize(void ); 00079 virtual VecMath::Vector< 4, double >& operator()(double , double , double ); 00080 void clear(); 00081 00082 private: 00083 00084 class Impl; 00085 Impl *pImpl_; 00086 00087 }; 00088 00089 #endif // COMPOSITE_H