?? mappoint.cpp
字號(hào):
#include "stdafx.h"
#include "global.h"
#include "MapPoint.h"
IMPLEMENT_DYNAMIC(CMapPoint,CObject)
CMapPoint::CMapPoint()
{
m_bStatus = 0;
m_uiIndex = 0;
m_dbX = 0.0;
m_dbY = 0.0;
}
CMapPoint::CMapPoint(CMapPoint& pt)
{
m_bStatus = pt.m_bStatus;
m_uiIndex = pt.m_uiIndex;
m_dbX = pt.m_dbX;
m_dbY = pt.m_dbY ;
}
CMapPoint::~CMapPoint()
{
}
/*****************************************************************************
描述: 兩點(diǎn)距離
參數(shù): 點(diǎn)對(duì)象
返回值 距離
******************************************************************************/
double CMapPoint::Distance(CMapPoint& pt )
{
}
bool CMapPoint::IsEqual(CMapPoint& pt )
{
if ( fabs(m_dbX-pt.GetX()) < EP && fabs(m_dbY-pt.GetY()) < EP )
return TRUE;
else
return FALSE;
}
/*****************************************************************************
描述: 判斷指定點(diǎn)是否在線段上
參數(shù): p1 --- 線段起點(diǎn) p2 --- 線段終點(diǎn)
返回值 在線段上 返回TRUE 否則返回FALSE
******************************************************************************/
bool CMapPoint::IsPointInLine(CMapPoint& p1 , CMapPoint& p2 )
{
double dblMulti;
// 判斷點(diǎn)是否在外接矩形范圍內(nèi)
if ( m_dbX < min(p1.GetX() ,p2.GetX()) || m_dbX > max(p1.GetX() ,p2.GetX())
|| m_dbY < min(p1.GetY() ,p2.GetY()) || m_dbY > max(p1.GetY() ,p2.GetY()))
return FALSE;
//計(jì)算叉積
dblMulti = (double)((m_dbX -p1.GetX())*(p2.GetY() -p1.GetY())-(p2.GetX()-p1.GetX())*(m_dbY -p1.GetY()));
if ( dblMulti == 0 )
return TRUE;
else
return FALSE;
}
?? 快捷鍵說(shuō)明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號(hào)
Ctrl + =
減小字號(hào)
Ctrl + -