summaryrefslogtreecommitdiff
path: root/2003/i/buzz/src/vision/size_thresholds.h
blob: f30ac4dd87b78ec2700a650aeca3d961c54650b0 (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
#ifndef __size_thresholds_h__
#define __size_thresholds_h__
// size_thresholds.h - Chargement de seuils pour les tailles de palets.
// buzz - Programme du robot Efrei Robotique I1-I2 2003
// Copyright (C) 2003 Nicolas Schodet

struct SizeThreshold
{
    SizeThreshold *next;
    int wm, wM, hm, hM;
    int type;
};

class SizeThresholds
{
    SizeThreshold *m_thresholds;
  public:
    SizeThresholds (const char *filename);
    ~SizeThresholds (void);
    // Trouve le type qui correspond a la taille.
    int findType (int w, int h);
};

// Trouve la zone qui correspond aux composantes.
inline int
SizeThresholds::findType (int w, int h)
{
    SizeThreshold *t;
    for (t = m_thresholds; t; t = t->next)
      {
	if (w >= t->wm && w <= t->wM
	    && h >= t->hm && h <= t->hM)
	  {
	    return t->type;
	  }
      }
    return 0;
}

#endif // size_thresholds_h