UVa10652 Board Wrapping

根据矩形的中心坐标与顺时针旋转角度,求出矩形四个点的坐标,加入点集中

对所得点集求凸包。

OA = OM + MA

MA可以根据Rotate()函数得到

部分代码:

      scanf ( "%lf%lf%lf%lf%lf", &x, &y, &w, &h, &j );
      Point M(x,y);
      double ang = -torad(j);
      p.push_back(M+Rotate(Vector(-w/2, -h/2), ang));
      p.push_back(M+Rotate(Vector( w/2, -h/2), ang));
      p.push_back(M+Rotate(Vector( w/2,  h/2), ang));
      p.push_back(M+Rotate(Vector(-w/2,  h/2), ang));
      area += w*h;

 

posted on 2013-06-28 13:36  Ac_coral  阅读(158)  评论(0编辑  收藏  举报

导航