![]() |
#2
game882011-05-13 11:55
|
void ObsAvoid::DrawObs( )
{
if ( m_pDC != NULL )
{
CPen redPen(PS_SOLID, 1, RGB(115,30+50,50) ), *pOldPen;
pOldPen = m_pDC->SelectObject( &redPen );
int i=0;
for(i=0; i<360; i++)
{
m_pDC->MoveTo(m_x,m_y);
int x2 = m_x + (int)( m_obsData[i] * cos( i/180.0*PI +m_theata-pi/2 ) );
int y2 = m_y + (int)( m_obsData[i] * sin( i/180.0*PI +m_theata-pi/2 ) );
m_pDC->LineTo( x2, y2 );
}
m_pDC->SelectObject( pOldPen );
}
}
void ObsAvoid::SetpDC(CDC *dc,int mod, int x, int y, double theata )
{
m_pDC = dc;
m_mod = mod;
m_x = x;
m_y = y;
m_theata = theata;
}
这里的(X2,Y2)其实就是扫描的结果,对吧,我就想这样,如果要把这个测距线因障碍物而缩短时的那些端点储存成点并且显示出来,这个程序该如何编写?我是真的对C++一点基础都没有,老师那也总是……唉~,只能求助大家了~
只有本站会员才能查看附件,请 登录