00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
#ifndef OPENCAL_PHASESPACE_H
00012
#define OPENCAL_PHASESPACE_H
00013
00014
00015
#include <OpenCAL/global.h>
00016
00017
#include <vector>
00018
using std::vector;
00019
00020
namespace OpenCAL
00021 {
00022
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
00036 vector<float> m_values;
00037
unsigned int m_position;
00038
00039
public:
00040
00041 PhaseSpace(
unsigned int reserve = 0);
00042 PhaseSpace(
const float *values,
unsigned int size);
00043
00044
virtual ~PhaseSpace();
00045
00046
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
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
00060
void setValue(
unsigned int i,
float value) { m_values[i] = value; }
00061
void setValues(
const float *values,
unsigned int size);
00062
00063
00064
bool isEmpty()
const {
return m_values.empty(); }
00065
00066
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
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
00083
00084
00085
00086
00088
00089
00090
void add(
const PhaseSpace &p,
float scale = 1.0f);
00091
00092
00093
friend PhaseSpace operator*(
float value,
const PhaseSpace &p);
00094 };
00095 }
00096
00097
#endif // OPENCAL_PHASESPACE_H