Advertisement
DrMikeMorgan

Lecture 14 - circle.h

Mar 15th, 2013
213
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.27 KB | None | 0 0
  1. #ifndef CIRCLE_H_INCLUDED
  2. #define CIRCLE_H_INCLUDED
  3.  
  4. #include "../Headers/Lib110ct.h"
  5.  
  6. class Circle
  7. {
  8. protected:
  9.     double mx, my, mdx, mdy, mradius;
  10. public:
  11.     Circle(){}
  12.     Circle(double x,double y,double dx,double dy,double rad):mx(x),my(y),mdx(dx),mdy(dy),mradius(rad){}
  13.     void setPos(double x, double y){mx=x;my=y;}
  14.     void setDir(double dx, double dy){mdx=dx; mdy=dy;}
  15.     void setRadius(double rad){mradius=rad;}
  16.     double getX(){return mx;}
  17.     double getY(){return my;}
  18.  
  19.     void draw(Turtle * t);
  20.     void clear(Win110ct& win);
  21.     void move();
  22.     bool collides(Circle & c);
  23. };
  24.  
  25.  
  26. //    derived          base
  27. class Orbiter : public Circle
  28. {
  29.     Circle * orbits;
  30.     double mangle, angVel, distance;
  31. public:
  32.     Orbiter():orbits(0),mangle(0),angVel(0),distance(0),Circle(){}
  33.     void setVelocity(double ang){angVel = ang;}
  34.     void setOrbits(Circle * c){orbits = c;}
  35.     void setDistance(double dist){distance = dist;}
  36.     void move();
  37. };
  38.  
  39.  
  40.  
  41. class Chaser : public Circle
  42. {
  43.     Circle * target;
  44.     double mvelocity;
  45. public:
  46.     Chaser():target(0),mvelocity(0),Circle(){}
  47.     void setVelocity(double velocity){mvelocity=velocity;}
  48.     void setTarget(Circle * tgt){target = tgt;}
  49.     void move();
  50. };
  51.  
  52.  
  53.  
  54. #endif // CIRCLE_H_INCLUDED
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement