summaryrefslogtreecommitdiff
path: root/2003/i/buzz/src/vision/thresholds.h
diff options
context:
space:
mode:
authorschodet2003-05-01 17:10:58 +0000
committerschodet2003-05-01 17:10:58 +0000
commit30ea7faee31ad69f3f0886dae8bb58e1fe31a74f (patch)
treeec61cfbc35f9a603f8ffd9e6c3ddb72b72a570e7 /2003/i/buzz/src/vision/thresholds.h
parentc306e33f3005ddb5a19c9aa590ef19560471137b (diff)
Ajout du module vision.
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