Rectangle.cpp 443 B

12345678910111213141516171819202122
  1. #include "Rectangle.h"
  2. #include <iostream>
  3. Rectangle::Rectangle(struct Point f, struct Point s, struct Point t, struct Point fo)
  4. {
  5. init(f.x, f.y, s.x, s.y, t.x, t.y, fo.x, fo.y);
  6. }
  7. double Rectangle::calc_area()
  8. {
  9. return l2(x1, y1, x2, y2) * l2(x3, y3, x4, y4);
  10. }
  11. double Rectangle::calc_perimiter()
  12. {
  13. return l2(x1, y1, x2, y2) * 2 + l2(x3, y3, x4, y4) * 2;
  14. }
  15. void Rectangle::name()
  16. {
  17. std::cout << "Rectangle" << std::endl;
  18. }