]> rtime.felk.cvut.cz Git - eurobot/public.git/commitdiff
shapedet: Better API
authorMichal Sojka <sojkam1@fel.cvut.cz>
Wed, 9 Mar 2011 13:40:25 +0000 (14:40 +0100)
committerMichal Sojka <sojkam1@fel.cvut.cz>
Wed, 9 Mar 2011 13:40:25 +0000 (14:40 +0100)
This needs to be implemented later.

src/hokuyo/shape-detect/shape_detect.cc
src/hokuyo/shape-detect/shape_detect.h

index ca16e4682845651b4490ce92e67430e5805bd3ab..24cb025f7da1d37c648550730654c59639acd43e 100644 (file)
@@ -378,18 +378,21 @@ void Shape_detect::polar_to_cartes(const unsigned short laser_scan[], std::vecto
        }
 }
 
-void Shape_detect::shape_detect(const unsigned short laser_scan[], std::vector<Shape_detect::Line> &lines)
+void Shape_detect::prepare(const unsigned short laser_scan[])
 {
 #ifdef GNUPLOT
        gnuplot_init();
 #endif
        // polar coordinates to cartesian coordinates  
-       std::vector<Shape_detect::Point> cartes;
+       std::vector<Shape_detect::Point> cartes(HOKUYO_ARRAY_SIZE);
 
        polar_to_cartes(laser_scan, cartes);
 
        int cartes_size = cartes.size();
+}
 
+       void Shape_detect::line_detect(const unsigned short laser_scan[], std::vector<Shape_detect::Line> &lines)
+{
        std::vector<Shape_detect::Point> arcs;
 
        std::cout << "cartes: " << cartes_size << std::endl;
index 9b8f3ae29cac2def9bdcfb80c9408327138b935f..475a32eaf60ca5e05309702467a7c91d3c963c92 100644 (file)
@@ -220,6 +220,13 @@ class Shape_detect
                        Point a; /**< start point from a line. */
                        Point b; /**< end point from a line. */
                } Line;
+
+               typedef struct {
+                       Point center;
+               } Arc;
+
+               void prepare(const unsigned short laser_scan[]);
+               
                
                /**
                 * There are detected line segments in input array of measured
@@ -228,7 +235,8 @@ class Shape_detect
                 * @param [out] &lines vector which contains detected lines.
                 * @ingroup shapedet
                 */
-               void shape_detect(const unsigned short laser_scan[], std::vector<Line> &lines);
+               void line_detect(std::vector<Line> &lines);
+               void arc_detect(std::vector<Arc> &lines);
 
        private:
                /**