#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