1. 程式人生 > >計算幾何基礎

計算幾何基礎

1.1數學基礎知識

1.點和向量的定義

 /*二維點定義*/
 struct point{
    double x;
    double y;
 };
 
 /*二維向量定義*/
 struct Vector{
    point s;  //向量的起點
    point t;  //向量的終點
 };

2.多邊形的定義

/*多邊形定義*/
 struct Polygon{
    int n;  //多邊形的頂點數目
    point P[N];  //多邊形頂點的集合,按照逆時針或順時針排列,N
 };

3.圓的定義

/*圓的定義*/
 struct circle{
    double r;  //半徑
    point o;   //圓心
 };

——摘自ACM/ICPC演算法基礎訓練教程