www.pudn.com > zfxcengine-0.1.0.zip > ceVec2f.cpp


#include "Math/ceMath.h" 
 
namespace ZFXCE { 
	void ceVec2f::Set(const FLOAT X, const FLOAT Y) 
	{ 
		x = X; 
		y = Y; 
	} 
	FLOAT ceVec2f::GetLength() 
	{ 
		return sqrt(x * x + y * y); 
	} 
	void ceVec2f::Normalize() 
	{ 
		FLOAT l = 1 / GetLength(); 
		x = x * l; 
		y = y * l; 
	} 
	void ceVec2f::Add(const FLOAT X, const FLOAT Y)  
	{ 
		x += X; 
		y += Y; 
	} 
	void ceVec2f::Add(const ceVec2f& v)  
	{ 
		x += v.x; 
		y += v.y;	 
	} 
	ceVec2f& ceVec2f::operator =(const ceVec2f& v) 
	{ 
		x = v.x; 
		y = v.y; 
		 
		return *this; 
	} 
 
} // Namespace ZFXCE