www.pudn.com > QQandSample.rar > DrawClass.cpp
// DrawClass.cpp: implementation of the CDrawClass class.
//
//////////////////////////////////////////////////////////////////////
#include "stdafx.h"
#include "Rotation.h"
#include "DrawClass.h"
#include "RotationDoc.h"
#ifdef _DEBUG
#undef THIS_FILE
static char THIS_FILE[]=__FILE__;
#define new DEBUG_NEW
#endif
#include "math.h"
//////////////////////////////////////////////////////////////////////
// Construction/Destruction
//////////////////////////////////////////////////////////////////////
CDrawClass::CDrawClass()
{
}
CDrawClass::~CDrawClass()
{
}
void CDrawClass::DrawWave(CDC *pDC,SignalType *pSignal)
{
double temp,temp1;
int n=pSignal->n;
temp1=pSignal->data[0];
for(int k=1;kdata[k])
{
temp1=pSignal->data[k];
}
}
temp=100/temp1;
long ny=250;
long tt=0;
tt=long (ny-pSignal->data[0]*temp);
pDC->MoveTo(0,tt);
for(int m=1;mdata[m]*temp);
pDC->LineTo(m*700/n,tt);
}
}
void CDrawClass::DrawFFT(CDC *pDC,SignalType *pSignal,BOOL flag)
{
double *Ix,*Iy,*fx,*Px;
int n=pSignal->n;
//FFT变换虚部数组
Ix= new double [n];
Iy= new double [n];
fx= new double [n/2];
Px= new double [n/2];
//将虚部数组赋零
for(int i=0;idata[i];
Iy[i]=0;
}
double temp1=0,temp;
long ny,tt;
int k,m;
temp1=Ix[0];
for( k=1;kMoveTo(0,tt);
for( m=1;mLineTo(m*700/n,tt);
}
m_caculate.FFT(Ix,Iy,n,0);
//计算幅值谱,相位谱
for(int j=0;jMoveTo(0,tt);
for( m=1;mLineTo(m*2*700/n,tt);
}
}
else
{
temp1=Px[0];
for( k=1;kMoveTo(0,tt);
for( m=1;mLineTo(m*2*700/n,tt);
}
}
delete [] Ix;
delete [] fx;
delete [] Iy;
delete [] Px;
}
void CDrawClass::DrawHoloSpectrum(CDC *pDC)
{
}