GestureRecognitionToolkit  Version: 0.2.0
The Gesture Recognition Toolkit (GRT) is a cross-platform, open-source, c++ machine learning library for real-time gesture recognition.
Particle.h
1 /*
2  GRT MIT License
3  Copyright (c) <2012> <Nicholas Gillian, Media Lab, MIT>
4 
5  Permission is hereby granted, free of charge, to any person obtaining a copy of this software
6  and associated documentation files (the "Software"), to deal in the Software without restriction,
7  including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense,
8  and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so,
9  subject to the following conditions:
10 
11  The above copyright notice and this permission notice shall be included in all copies or substantial
12  portions of the Software.
13 
14  THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT
15  LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
16  IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
17  WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
18  SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
19  */
20 
21 #ifndef GRT_PARTICLE_HEADER
22 #define GRT_PARTICLE_HEADER
23 
24 #include "../../Util/GRTTypedefs.h"
25 
26 GRT_BEGIN_NAMESPACE
27 
28 class Particle{
29 public:
30  Particle(unsigned int numDimensions=0){
31  w = 0;
32  if( numDimensions > 0 ){
33  x.resize(numDimensions,0);
34  }
35  }
36 
37  Particle(const Particle &rhs){
38  this->w = rhs.w;
39  this->x = rhs.x;
40  }
41 
42  virtual ~Particle(){
43 
44  }
45 
46  Particle& operator=(const Particle &rhs){
47  if( this != &rhs ){
48  this->w = rhs.w;
49  this->x = rhs.x;
50  }
51  return *this;
52  }
53 
54  Float& operator[](const unsigned int &i){
55  return x[i];
56  }
57 
58  const Float& operator[](const unsigned int &i) const {
59  return x[i];
60  }
61 
62  Float w;
63  VectorFloat x;
64 };
65 
66 GRT_END_NAMESPACE
67 
68 #endif //GRT_PARTICLE_HEADER
virtual bool resize(const unsigned int size)
Definition: Vector.h:133