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

📄 weightedring.h

📁 2002年
💻 H
字号:
#ifndef __WEIGHTEDRING_H__
#define __WEIGHTEDRING_H__

#ifndef NULL
#define NULL 0
#endif 

const int Max_Sectors= 50;

struct SectorDelimiter{
public:
	SectorDelimiter(){
		reset();
	}
	void reset(){
		next = NULL;
	}
	inline void init(float agl, float w, SectorDelimiter* pnext){
		angle = agl; weight = w; next = pnext;
	}
	inline float nextangle(){
		return next==NULL ? 180.0f : next->angle;
	}
	inline float spanangle(){
		return nextangle()-angle;
	}

	float angle;
	float weight;
	SectorDelimiter* next;
};

class WeightedRing{
private:
	SectorDelimiter storage[Max_Sectors];
	int curunits;
	SectorDelimiter* headunit;
	SectorDelimiter* tailunit;

	inline SectorDelimiter* CreateSector();
	inline void Insertfollow(SectorDelimiter* &unit,float agl, float w);
	void Insertunit(float sangle, float eangle, float weight);
public:
	WeightedRing(){
		Reset();
	}
	void Reset();
	void Insert(float angle, float spanangle, float weight);
	void InsertSection(float s_angle, float e_angle, float weight);

	virtual float Getscale(float s_angle, float e_angle);
	float GetTotalWeight();

	SectorDelimiter* GetHead(){return headunit;}
	SectorDelimiter* Findunit(float angle);
};

#endif //__WEIGHTEDRING_H__



















































































⌨️ 快捷键说明

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