⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 polygon.h

📁 多机器人合作中的动态角色分配仿真算法是多机器人合作领域的一个比较著名的仿真软件
💻 H
字号:
//////////////////////////////////////////////////////////////////////
// MuRoS - Multi Robot Simulator
//
// Luiz Chaimowicz
// GRASP Lab. University of Pennsylvania
// VERLab - DCC - UFMG - Brasil
//
// Polygon.h: interface for the CPolygon class.
//
//////////////////////////////////////////////////////////////////////

#if !defined(POLYGON_H)
#define POLYGON_H

#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000

#include "Afxtempl.h"


class CPolygon : public CObject  
{
public:
    DECLARE_SERIAL(CPolygon)

	CPolygon();
	CPolygon(CArray<CPoint, CPoint> *points);
	CPolygon(CPolygon *polygon);
	CPolygon(CRect rect);
	virtual ~CPolygon();
	
	void Serialize(CArchive& ar);
	void Draw(CDC* pDC);

	void Redraw(CPoint p, CClientDC *dc);
	void Recompute(double x, double y, double theta);
	
	void SetPointsCenterFrame();
	short IntersectCircle(CPoint robot, double radius, CPoint &intersect1, CPoint &intersect2);
	void ShortDistance(double x, double y, double &minDist, double &minAngle);
	BOOL FinishPointInsertion();

	void AddPoint(CPoint p);
	CPoint GetPoint(int i);
	void RemoveAllPoints();
	void ComputeCenter();

	CPoint m_intersect1;	// intersections between the polygon and a circle (computed by IntersectCircle)
	CPoint m_intersect2;
	CPoint m_center;		// polygon center
	CRect m_rect;			// polygon outside rectangle

private:
	CArray<CPoint, CPoint> m_points;			// vertices of the polygon in the global reference frame
	CArray<CPoint, CPoint> m_pointsCenterFrame; // vertices of the polygon in the polygon center frame

	BOOL IsSimple(BOOL lastSegment = FALSE);
	double Area();
};

#endif 

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -