/**
The following code is in partial response to exercise 1 from PPP14:
1. Define two classes Smiley and Frowny, which are both derived from class Circle and have
two eyes and a mouth. Next, derive classes from Smiley and Frowny which add an
appropriate hat to each.

Note that Happy inherits from Shape, so that's not quite right.  Can you fix this?
*/

//------------------------------------------------------------------------------
/// Put this part in Graph.h
struct Happy : Shape {
    Happy(Point xy, int r);  //Cstr prototype

    void outline() const;  // just for numbers
    void draw_lines() const;

    //int height() const { return h; }
    //int width () const { return w; }

private:
    Point ctr; //center
    int r; // radius
    //int w; // width
};


///-------------------------------------------------------------------------------
/// Put this part in Graph.cpp

//---------------------------------------------------------------------------------

Happy::Happy(Point p, int rr) : ctr(p), r(rr) { //}: Circle(p,rr)  {   // number of sides, center and distance from center

};


//------------------------------------------------------------------------------
void Happy::outline() const {
    cout << "\nctr = (" << ctr.x << ", " << ctr.y << "), r = " << r;
}


//------------------------------------------------------------------------------

void Happy::draw_lines() const {
    fl_arc(ctr.x-r, ctr.y-r, 2*r, 2*r, 0, 360);
    //outline();
    //bottome smile
    double smile_radius = sqrt3*r/2;
    fl_arc(ctr.x-smile_radius,ctr.y-smile_radius, 2*int(smile_radius), 2*int(smile_radius), 210, 330);
    //top smile;
    double a = 3*sqrt(2)*smile_radius/4;
    double b = sqrt3*smile_radius/2;
    fl_arc(ctr.x-a, ctr.y-b, 2*int(a), 2*int(b), 210, 330);
    //left eye
    fl_arc(ctr.x-r/2,ctr.y-r/2,r/5,r/5,0,360);
    //right eye
    fl_arc(ctr.x+2*r/5,ctr.y-r/2,r/5,r/5,0,360);
    //nose
    fl_line(ctr.x,ctr.y-r/2,ctr.x+r/5,ctr.y+r/5);
    fl_line(ctr.x+r/5,ctr.y+r/5,ctr.x-r/5,ctr.y+r/6);
    //fl_point()
}