#include "Behaviors/StateMachine.h"

$nodeclass Lab5p2 : VisualRoutinesStateNode {
        $nodeclass FindShapes : MapBuilderNode : doStart {
                mapreq.addObjectColor(lineDataType, "red");
		mapreq.addObjectColor(ellipseDataType, "blue");
        }

        $nodeclass ReportResult : doStart {
		
		NEW_SHAPEVEC(line_shapes, LineData,select_type<LineData>(camShS));
		
                NEW_SKETCH(top_half_plane0, bool, visops::topHalfPlane(line_shapes[0]));
		NEW_SKETCH(top_half_plane1, bool, visops::topHalfPlane(line_shapes[1]));
		NEW_SKETCH(plane_intersection, bool, top_half_plane0&top_half_plane1);
		
		NEW_SKETCH(camFrame, uchar, sketchFromSeg());
		NEW_SKETCH(red_stuff, bool, visops::colormask(camFrame,"blue"));
		
		NEW_SKETCH(ellipse_in_wedge, bool, plane_intersection&red_stuff);

        }
        $setupmachine{
		FindShapes =C=> ReportResult
        }
}
REGISTER_BEHAVIOR(Lab5p2);

