www.pudn.com > final_6.rar > Base.h


// Base.h 
#ifndef _BASE_H_ 
#define _BASE_H_ 
 
#ifndef LIMIT_ZERO  
#define LIMIT_ZERO 0.0001 
#endif 
 
#define PI acos(-1) 
#define TOP 0 
#define LEFT 1 
#define FRONT 2 
#define PER 3 
 
#define LATHEX 100 
#define LATHEY 101 
#define LATHEZ 102 
 
#define LATI 9 
#define LONG 16 
 
typedef double vector[4]; 
typedef double matrix[4][4]; 
typedef struct color { 
	int r; 
	int g; 
	int b; 
} Color; 
 
struct SPoint 
{ 
	double x; 
	double y; 
}; 
 
class CGPoint { 
public: 
	double x; 
	double y; 
	double z; 
	double m; 
	BOOL visual; 
public: 
	CGPoint(); 
	CGPoint(double ox,double oy,double oz); 
	CGPoint(const CGPoint& CGPointSrc); 
	~CGPoint(); 
	void Init(); 
	const CGPoint& operator=(const CGPoint&CGPointSrc); 
	void Set(double ox,double oy,double oz); 
	friend CGPoint operator+(const CGPoint& CGPoint1,const CGPoint& CGPoint2); 
    friend CGPoint operator-(const CGPoint& CGPoint1,const CGPoint& CGPoint2); 
    friend CGPoint operator*(const CGPoint& CGPointSrc,const double&scale); 
	friend CGPoint operator*(const double&scale,const CGPoint& CGPointSrc); 
	double Distance(CGPoint* pnt); 
//	BOOL IsSame(const CGPoint& pointSrc); 
//	BOOL IsInBox 
	void Serialize(CArchive &ar); 
}; 
 
class CGPlane { 
public : 
	double a; 
	double b; 
	double c; 
	double d; 
public: 
	void Serialize(CArchive &ar); 
}; 
 
class CGLight: public CObject{ 
    DECLARE_SERIAL(CGLight) 
public:	 
	color lc;  //光源颜色 
	color gamma_lc; //光源gamma校正后颜色 
	CGPoint position; //光源位置 
	int k; //光源类型 k=1点光源  k=2平行光源 
public: 
	void GammaCorrect(double gammaR,double gammaG,double gammaB); 
	void DrawPer(CDC *pDC); 
	void DrawFront(CDC *pDC); 
	void DrawLeft(CDC *pDC); 
	void DrawTop(CDC *pDC); 
    CGLight(); 
    CGLight(double x,double y,double z); 
	virtual void Serialize(CArchive &ar); 
}; 
 
 
 
 
 
 
 
 
#endif