summaryrefslogtreecommitdiff
path: root/2003/i/buzz/src/vision/thresholds.h
diff options
context:
space:
mode:
Diffstat (limited to '2003/i/buzz/src/vision/thresholds.h')
-rw-r--r--2003/i/buzz/src/vision/thresholds.h42
1 files changed, 42 insertions, 0 deletions
diff --git a/2003/i/buzz/src/vision/thresholds.h b/2003/i/buzz/src/vision/thresholds.h
new file mode 100644
index 0000000..b11c387
--- /dev/null
+++ b/2003/i/buzz/src/vision/thresholds.h
@@ -0,0 +1,42 @@
+#ifndef thresholds_h
+#define thresholds_h
+// thresholds.h - Chargement de seuils.
+// buzz - Programme du robot Efrei Robotique I1-I2 2003
+// Copyright (C) 2003 Nicolas Schodet
+
+struct Threshold
+{
+ Threshold *next;
+ unsigned char ym, yM, um, uM, vm, vM;
+ unsigned char zone;
+};
+
+class Thresholds
+{
+ Threshold *m_thresholds;
+ public:
+ Thresholds (const char *filename);
+ ~Thresholds (void);
+ // Trouve la zone qui correspond aux composantes.
+ unsigned char findZone (unsigned char y, unsigned char u, unsigned char
+ v);
+};
+
+// Trouve la zone qui correspond aux composantes.
+inline unsigned char
+Thresholds::findZone (unsigned char y, unsigned char u, unsigned char v)
+{
+ Threshold *t;
+ for (t = m_thresholds; t; t = t->next)
+ {
+ if (y >= t->ym && y <= t->yM
+ && u >= t->um && u <= t->uM
+ && v >= t->vm && v <= t->vM)
+ {
+ return t->zone;
+ }
+ }
+ return 0;
+}
+
+#endif // thresholds_h