UVa11178

例题,入门题,没有算法

注意Rotate()函数,表示向量A旋转rad弧度,

其中第二个参数为正时,代表逆时针旋转的角;为负时,代表顺时针旋转的角

Vector Rotate(const Vector& A, double rad) {
  return Vector(A.x*cos(rad)-A.y*sin(rad), A.x*sin(rad)+A.y*cos(rad));
}

关键代码:

Point solve ( Point A, Point B, Point C ) {
    Vector v1 = C-B;
    double a1 = Angle(A-B, v1);
    v1 = Rotate(v1, a1/3);
    Vector v2 = B-C;
    double a2 = Angle(A-C, v2);
    v2 = Rotate(v2, -a2/3);
    return GetLineIntersection(B, v1, C, v2);
}

 

posted on 2013-06-15 18:57  Ac_coral  阅读(141)  评论(1编辑  收藏  举报

导航