Welcome, Guest! Sign Up RSS

Clever Space

Friday, 11.22.2024
Main » 2014 » July » 20

复数类:cpx

FFT主过程:FFT_main

一个范例:FFT_sample

 

Views: 292 | Added by: dhy0077 | Date: 07.20.2014

double PI=3.1415926535898;
double dis(const Point &a,const Point &b)
{
    return sqrt((a.x-b.x)*(a.x-b.x)+(a.y-b.y)*(a.y-b.y)); 

Point circumcenter(const Point &a,const Point &b,const Point &c)
{ //返回三角形的外心 
    Point ret; 
    double a1=b.x-a.x,b1=b.y-a.y,c1=(a1*a1+b1*b1)/2;
    double a2=c.x-a.x,b2=c.y-a.y,c2=(a2*a2+b2*b2)/2;
    double d=a1*b2-a2*b1;
    ret.x=a.x+(c1*b2-c2*b1)/d;
    ret.y=a.y+(a1*c2-a2*c1)/d;
    return ret; 

void min_cover_circle(Point *p,int n,Point &c,double &r){ //c为圆心,r为半径 
    random_shuffle(p,p+n); // 
    c=p[0]; r=0;
    for(int i=1;i<n;i++)
    {
        if(dis(p[i],c)>r+eps)  //第一个点
      & ... Read more »

Views: 534 | Added by: dhy0077 | Date: 07.20.2014