summaryrefslogtreecommitdiffhomepage
path: root/SixenseSDK/include/sixense_utils/derivatives.hpp
blob: cd3c31f1c31160f552b87e89bc2ec67752140623 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
/*
 *
 * SIXENSE CONFIDENTIAL
 *
 * Copyright (C) 2011 Sixense Entertainment Inc.
 * All Rights Reserved
 *
 */

#ifndef SIXENSE_UTILS_DERIVATIVES_HPP
#define SIXENSE_UTILS_DERIVATIVES_HPP

#pragma warning(push)
#pragma warning( disable:4251 )

#include "sixense.h"
#include "sixense_math.hpp"

#include <deque>

#include "sixense_utils/export.hpp"
#include "sixense_utils/interfaces.hpp"

namespace sixenseUtils {

	class SIXENSE_UTILS_EXPORT Derivatives : public IDerivatives {

	public:
		Derivatives( sixenseMath::Vector3 offset_vec = sixenseMath::Vector3() );

		void update( sixenseControllerData *cd );

		sixenseMath::Vector3 getPosition();
		sixenseMath::Vector3 getVelocity();
		sixenseMath::Vector3 getAcceleration();

		sixenseMath::Vector3 getRSquared();

		void setOffset( sixenseMath::Vector3 offset );
		sixenseMath::Vector3 getOffset();

	protected:
		std::deque<unsigned char> _last_n_sequence;

		std::deque<float> _last_n_times;

		std::deque<sixenseMath::Vector3> _last_n_pos;

		sixenseMath::Vector3 _pos;
		sixenseMath::Vector3 _vel;
		sixenseMath::Vector3 _accel;

		sixenseMath::Vector3 _r_squared;

		sixenseMath::Vector3 _offset_vec;

	};

}

#pragma warning(pop)

#endif