TUIO C++ Developer API
TuioBlob.h
1 /*
2  TUIO C++ Library
3  Copyright (c) 2005-2017 Martin Kaltenbrunner <martin@tuio.org>
4 
5  This library is free software; you can redistribute it and/or
6  modify it under the terms of the GNU Lesser General Public
7  License as published by the Free Software Foundation; either
8  version 3.0 of the License, or (at your option) any later version.
9 
10  This library is distributed in the hope that it will be useful,
11  but WITHOUT ANY WARRANTY; without even the implied warranty of
12  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13  Lesser General Public License for more details.
14 
15  You should have received a copy of the GNU Lesser General Public
16  License along with this library.
17 */
18 
19 #ifndef INCLUDED_TUIOBLOB_H
20 #define INCLUDED_TUIOBLOB_H
21 
22 #include "TuioContainer.h"
23 
24 namespace TUIO {
25 
32  class LIBDECL TuioBlob: public TuioContainer {
33 
34  protected:
38  int blob_id;
42  float angle;
46  float angle_sum;
50  float width;
54  float height;
58  float area;
67 
68  float angleThreshold;
69  OneEuroFilter *angleFilter;
70  float sizeThreshold;
71  OneEuroFilter *widthFilter;
72  OneEuroFilter *heightFilter;
73 
74  public:
76 
90  TuioBlob (TuioTime ttime, long si, int bi, float xp, float yp, float a, float w, float h, float f);
91 
104  TuioBlob (long si, int bi, float xp, float yp, float a, float w, float h, float f);
105 
112  TuioBlob (TuioBlob *tblb);
113 
117  virtual ~TuioBlob() {
118  if (widthFilter) delete widthFilter;
119  if (heightFilter) delete heightFilter;
120  if (angleFilter) delete angleFilter;
121  };
122 
127  int getBlobID() const;
128 
133  void setBlobID(int bi);
134 
153  void update (TuioTime ttime, float xp, float yp, float a, float w, float h, float f, float xs, float ys, float rs, float ma, float ra);
154 
172  void update (float xp, float yp, float a, float w, float h, float f, float xs, float ys, float rs, float ma, float ra);
173 
187  void update (TuioTime ttime, float xp, float yp, float a, float w, float h, float f);
188 
193  void stop (TuioTime ttime);
194 
202  void update (TuioBlob *tblb);
203 
208  float getWidth() const;
209 
214  float getHeight() const;
215 
220  int getScreenWidth(int w) const;
221 
226  int getScreenHeight(int h) const;
227 
232  float getArea() const;
233 
238  float getAngle() const;
239 
244  float getAngleSum() const;
245 
250  float getAngleDegrees() const;
251 
256  float getRotationSpeed() const;
257 
262  float getRotationAccel() const;
263 
268  bool isMoving() const;
269 
270  void addAngleThreshold(float thresh);
271 
272  void removeAngleThreshold();
273 
274  void addAngleFilter(float mcut, float beta);
275 
276  void removeAngleFilter();
277 
278  void addSizeThreshold(float thresh);
279 
280  void removeSizeThreshold();
281 
282  void addSizeFilter(float mcut, float beta);
283 
284  void removeSizeFilter();
285  };
286 }
287 #endif
Definition: OneEuroFilter.h:49
Definition: TuioContainer.h:44
float width
Definition: TuioBlob.h:50
float angle
Definition: TuioBlob.h:42
Definition: TuioTime.h:48
Definition: FlashSender.h:166
float height
Definition: TuioBlob.h:54
virtual void update(TuioTime ttime, float xp, float yp)
Definition: TuioContainer.cpp:95
int blob_id
Definition: TuioBlob.h:38
Definition: TuioBlob.h:32
float area
Definition: TuioBlob.h:58
float angle_sum
Definition: TuioBlob.h:46
virtual ~TuioBlob()
Definition: TuioBlob.h:117
float rotation_speed
Definition: TuioBlob.h:62
float rotation_accel
Definition: TuioBlob.h:66