Skip to content
Snippets Groups Projects
FRCircle.h 767 B
Newer Older
  • Learn to ignore specific revisions
  • Whitney Armstrong's avatar
    Whitney Armstrong committed
    #ifndef FR_CIRCLE_H
    #define FR_CIRCLE_H
    
    #include "FRVector2.h"
    #include "FRArray.h"
    
    #define NDIV_DEFAULT	8
    
    class FRCircleTable {
    
    	friend class FRSegmentTable;
    public:
    	FRCircleTable(unsigned div_ = NDIV_DEFAULT) { setDiv(div_); }
    
    	void setDiv(unsigned);
    	unsigned getDiv()	 const { return div; }
    
    	const FRVector2* getTable() const { return table; }
    private:
    	FRArray<FRVector2> table;
    	unsigned div;
    };
    
    #undef NDIV_DEFAULT
    
    class FRSegmentTable	/* bug : start = sweep = 0 -> core dump!! */
    {
    public:
    	FRSegmentTable(
    		const FRCircleTable&,
    		double = 0,
    		double = M_PI * 2);
    
    	const FRVector2* getTable() const { return table; }
    	unsigned getSize() const { return num; }
    protected:
    	FRArray<FRVector2> buf;
    	const FRVector2 *table;
    	unsigned num;
    };
    
    #endif