java如何作心脏线图

来源:百度知道 编辑:UC知道 时间:2024/05/23 01:11:30

VC里部分代码(全部的太多了,看不明白就算了):
#include <math.h>

#define MY_FLOAT double
//pi*2
#define M_PI_M2 (MY_FLOAT)6.28318530717958647692

void LAtoXY(MY_FLOAT &fx,MY_FLOAT &fy,MY_FLOAT flength,MY_FLOAT fangle)
{
fx = flength * sin( fangle );
fy = flength * cos( fangle );
}
MY_FLOAT Calculate( MY_FLOAT angle )
{
return 100*(1+sin(angle));
}

// CCardioidView 绘图
void CCardioidView::OnDraw(CDC* pDC)
{
CRect trect;
GetClientRect( &trect );
int ty = trect.bottom-trect.top;
ty /= 2;
int tx = trect.right-trect.left;
tx /= 2;
pDC->MoveTo( 0 , ty );
pDC->LineTo( trect.right , ty );
pDC->MoveTo( tx , 0 );
pDC->LineTo( tx , trect.bottom );

CPen tpen( 0 , 2 , RGB(0xff,0x0,0) );
CPen *tppen = pDC->SelectObject( &tpen );

MY_FLOAT tangle,tlength;
MY_FLOAT tfx,tfy;

tangle = 0;