Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | File List | Class Members | Related Pages

PhaseSpace.h

00001 /*************************************************************************** 00002 * This file is part of OpenCAL: Open Computer Animation Library * 00003 * I created OpenCAL as my master's thesis Computer Science (multimedia) * 00004 * at the tUL university in Diepenbeek, Belgium * 00005 * * 00006 * Copyright (C) 2003-2004 by Jeroen Dierckx * 00007 * jeroen.dierckx@student.luc.ac.be * 00008 * * 00009 ***************************************************************************/ 00010 00011 #ifndef OPENCAL_PHASESPACE_H 00012 #define OPENCAL_PHASESPACE_H 00013 00014 // Includes 00015 #include <OpenCAL/global.h> 00016 00017 #include <vector> 00018 using std::vector; 00019 00020 namespace OpenCAL 00021 { 00022 // Forward declarations 00023 namespace Utils { class Vector3; class Quaternion; } 00024 using Utils::Vector3; 00025 using Utils::Quaternion; 00026 00027 00032 class OPENCAL_API PhaseSpace 00033 { 00034 protected: 00035 // Member variables 00036 vector<float> m_values; 00037 unsigned int m_position; 00038 00039 public: 00040 // Constructors and destructor 00041 PhaseSpace(unsigned int reserve = 0); 00042 PhaseSpace(const float *values, unsigned int size); 00043 //PhaseSpace(const PhaseSpace &source); 00044 virtual ~PhaseSpace(); 00045 00046 // Essential functions 00047 void clear(unsigned int reserve = 0) { m_values.clear(); m_values.reserve(reserve); m_position = 0; } 00048 void reset() { m_position = 0; } 00049 void skip(unsigned int positions) { m_position += positions; } 00050 float getNext() { return m_values[m_position++]; } 00051 00052 00053 // Get functions 00054 float getValue(unsigned int i) const { return m_values[i]; } 00056 vector<float> &getVector() { return m_values; } 00057 unsigned int getSize() const { return m_values.size(); } 00058 00059 // Set functions 00060 void setValue(unsigned int i, float value) { m_values[i] = value; } 00061 void setValues(const float *values, unsigned int size); 00062 00063 // Information functions 00064 bool isEmpty() const { return m_values.empty(); } 00065 00066 // Concatenation functions 00067 void concat(const PhaseSpace &p); 00068 void concatZeros(unsigned int positions) { for(unsigned int i = 0; i < positions; ++i) m_values.push_back(0); } 00069 void concat(float value) { m_values.push_back(value); } 00070 void concat(const Vector3 &v); 00071 void concat(const Quaternion &q); 00072 00073 // Operator functions 00074 float operator[](unsigned int i) const { return m_values[i]; } 00075 float &operator[](unsigned int i) { return m_values[i]; } 00076 00077 void operator+=(const PhaseSpace &p); 00078 PhaseSpace operator+(const PhaseSpace &p); 00079 PhaseSpace operator*(float value); 00080 00081 /* 00082 void operator +=(const PhaseSpace &p); 00083 PhaseSpace operator*(float value); 00084 */ 00085 00086 // Cast operators 00088 00089 // Other functions 00090 void add(const PhaseSpace &p, float scale = 1.0f); 00091 00092 // Friend functions 00093 friend PhaseSpace operator*(float value, const PhaseSpace &p); 00094 }; 00095 } 00096 00097 #endif // OPENCAL_PHASESPACE_H

Generated on Sun Aug 15 19:19:22 2004 for OpenCAL: Open Computer Animation Library by doxygen 1.3.8