Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class StateVector {
- protected:
- float* _v;
- public:
- StateVector():_v(new float[size()]) {}
- virtual ~StateVector() { delete [] _v; }
- virtual size_t size() = 0;
- // ...
- };
- class PositionState : public StateVector {
- public:
- size_t size() { return 3; }
- float* x() { return _v; }
- };
- class MovingState : public PositionState {
- public:
- size_t size() { return PositionState::size() + 3; }
- float* v() { return _v + PositionState::size(); }
- };
- template <typename State>
- class StateTransition {
- Matrix<float> _m;
- // constructor for Matrix takes #rows, #cols
- StateTransition():_m(State().size(), State().size()) {}
- // ...
- };
- class StateVector {
- float* _v;
- StateVector:_v(new float[size()]) {}
- virtual static size_t size() = 0;
- };
- class PositionState {
- static size_t size() { return 3; }
- // ...
- };
- // etc.
- template <typename State>
- class StateTransition {
- Matrix<float> _m;
- StateTransition():_m(State::size(), State::size()) {}
- };
Add Comment
Please, Sign In to add comment