資源簡介
C++ CImage類,用于處理BMP格式圖像。
代碼片段和文件信息
//?Image.cpp:?implementation?of?the?CImage?class.
//
//////////////////////////////////////////////////////////////////////
#include?“stdafx.h“
#include?“Image.h“
#include?“math.h“
#include?
using?namespace?std;
#define?PI?3.1415926535897932384626433832795
#ifdef?_DEBUG
#undef?THIS_FILE
static?char?THIS_FILE[]=__FILE__;
#define?new?DEBUG_NEW
#endif
/*功能:判斷點是否在多邊形內
?*方法:求解通過該點的水平線與多邊形各邊的交點
?*結論:單邊交點為奇數,在多邊形內
?*point?指定的點
?*Polygon多邊形各頂點坐標
?*nCount多邊形頂點個數
?*/
BOOL?PointInPolygon(CPoint?pointvectorPolygonint?nCount)
{
int?nCross=0;
for(int?i=0;i {
CPoint?p1=Polygon[i];
CPoint?p2=Polygon[(i+1)%nCount];
//求解y=p.y與p1p2的交點
if?(p1.y==p2.y)//p1p2?與y=p.y平行
continue;
if(point.y con
?屬性????????????大小?????日期????時間???名稱
-----------?---------??----------?-----??----
?????目錄???????????0??2014-05-09?20:19??CImage\
?????文件???????36672??2013-07-11?22:45??CImage\Image.cpp
?????文件????????3322??2013-07-11?22:44??CImage\Image.h
- 上一篇:RTP協議C++實現代碼
- 下一篇:灰度圖像和二維數組相互轉換操作
評論
共有 條評論