
计算圆与圆的交点,需要用到余弦定理
步骤如下:
- 求出两个圆的圆心距d
- 求出向量c2.c-c1.c与c1.c到某交点的向量夹角a
- 求出向量c2.c-c1.c与x轴的夹角t
- 那么,两个交点就分别是以c1.c为起点,大小为c1.r,角度为t+a、t-a的两个向量
题目:CGL_7_E
AC代码:
#include <iostream>
#include <cstdio>
#include <math.h>
using namespace std;
#define COUNTER_CLOCKWISE -1 //逆时针
#define CLOCKWISE 1 //顺时针
#define ONLINE_BACK -2 //p2 p0 p1依次排列在一条直线上
#define ONLINE_FRONT 2 //p0 p1 p2依次排列在一条直线上
#define ON_SEGMENT 0 //p2在线段p0p1上
#define EPS 1E-8
class Point
{
public:
double x, y;
Point()
{
}
Point(double x, double y)
{
(*this).x = x;
(*this).y = y;
}
double operator^(const Point &p) const //叉乘
{
return x * p.y -

最低0.47元/天 解锁文章
1203

被折叠的 条评论
为什么被折叠?



