summaryrefslogtreecommitdiff
path: root/2003/i/buzz/src/vision/size_thresholds.h
diff options
context:
space:
mode:
Diffstat (limited to '2003/i/buzz/src/vision/size_thresholds.h')
-rw-r--r--2003/i/buzz/src/vision/size_thresholds.h40
1 files changed, 40 insertions, 0 deletions
diff --git a/2003/i/buzz/src/vision/size_thresholds.h b/2003/i/buzz/src/vision/size_thresholds.h
new file mode 100644
index 0000000..f30ac4d
--- /dev/null
+++ b/2003/i/buzz/src/vision/size_thresholds.h
@@ -0,0 +1,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