So i have code to draw an Ellipse, but I need to modify it so i can rotate it about an angle (namely, 45 deg) but can't seem to figure it out. If you can show me how to do this, I would appreciate it.
Code:struct Ellipse : Shape { Ellipse(Point p, int w, int h) // center, min, and max distance from center : w(w), h(h) { add(Point(p.x-w,p.y-h)); } void draw_lines() const; Point center() const { return Point(point(0).x+w,point(0).y+h); } Point focus1() const { return Point(center().x+int(sqrt(double(w*w-h*h))),center().y); } Point focus2() const { return Point(center().x-int(sqrt(double(w*w-h*h))),center().y); } void set_major(int ww) { w=ww; } int major() const { return w; } void set_minor(int hh) { h=hh; } int minor() const { return h; } private: int w; int h; };




Reply With Quote