POJ 1265 Pick定理

來源:互聯網
上載者:User
Pick 定理,1899年
設 Γ 為平面上以格子點為頂點之單純多邊形,則其面積為 


其中 b 為邊界上的格子點數,i 為內部的格子點數。(8)式叫做 Pick 公式。

/* *POJ 1265 *fuqiang *幾何,Pick定理 *2013/8/7*/#include <iostream>#include <cstdio>#include <cstdlib>#include <cstring>#include <algorithm>#include <queue>using namespace std;#define INF 0x3f3f3f3fconst int maxn = 100+3;int Abs(int n){    return n>0?n:-n;}struct Point{    int x;    int y;}p[maxn];int gcd(int x, int y){    return y==0?x:gcd(y,x%y);}int grid_onedge(int n)  //線上上的格點{    int ret = 0;    for(int i = 0; i < n; i++)    {        ret += gcd(Abs(p[i].x-p[(i+1)%n].x), Abs(p[i].y-p[(i+1)%n].y));    }    return ret;}int grid_inside(int n)  {    int ret = 0;    for(int i = 0; i < n; i++)    {        ret += p[(i+1)%n].y * (p[i].x - p[(i+2)%n].x);    }    return Abs(ret);}int main(){#ifndef ONLINE_JUDGE    freopen("in","r",stdin);#endif    int T,Case = 1;    int n,a,b;    cin>>T;    while(T--)    {        cin>>n;        p[0].x = 0;        p[0].y = 0;        for(int i = 1; i <= n; i++)        {            cin>>a>>b;            p[i%n].x = p[i-1].x + a;            p[i%n].y = p[i-1].y + b;        }        int E = grid_onedge(n);        int I = (grid_inside(n)-E)/2+1;  //內部格點數        double A = E/2.0 + I -1;        printf("Scenario #%d:\n%d %d %.1f\n\n",Case++,I,E,A);    }    return 0;}

談求面積的 Pick 公式 (第
6 頁)

  1
其他的求面積公式

平面上的多邊形,有各式各樣的面積公式,端視所給的數據而定。除了本文所介紹的 Pick 公式之外,還有 Heron 公式與測量師公式,構成三足鼎立的求面積三個重要公式。

   
  2
Heron 公式及其推廣

對於三角形的情形,如果已知三邊的長為 a,b,c,令 ,則其面積為 


推廣到四邊形,有兩種情形(詳見參考資料11.蔡聰明,〈四邊形的面積〉,《數學傳播》第十七卷第三期 民國八十二年)

(i)當四邊形的邊長為  a, b, c, d 且內接於一圓時,令 ,則其面積為 


這叫做Brahmagupta公式。

(ii)對於任意四邊形,其面積為 


其中 B 與 D 為四邊形一對的對角。這叫做 Bretschneider 公式。值得注意的是,要再推廣到五邊形以上,就行不通了。

   
  3
測量師公式 (A Surveyor's Formula)

一個  n 邊形  A1,  A2,…, A n,其頂點按逆時針方向來配置並且坐標為  A k=( x k, y k), k=1,2,…, n,則面積為 


其中規定 xn+1=x1,且 yn+1=y1。

在上述三類公式中,要以測量師公式最具推廣潛力,因為它可以「連續化」。例如:

平面上逆時針方向的封閉曲線 x=x(t), y=y(t), ,所圍成領域的面積為: 


若再推廣,就得到著名的 Green 定理,而溶匯入微積分的數學主流。這好像是一條大河,一路上匯集各支流,最後終於流入大海 。

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.