Vector3.h
资源名称:虚拟地形建模.rar [点击查看]
上传用户:dfjhuyju
上传日期:2013-03-13
资源大小:11035k
文件大小:1k
源码类别:
OpenGL
开发平台:
Visual C++
- // Vector3.h: interface for the CVector3 class.
- //
- //////////////////////////////////////////////////////////////////////
- #if !defined(AFX_VECTOR3_H__86CEA3B2_E253_49A8_AC57_A7F485DB0640__INCLUDED_)
- #define AFX_VECTOR3_H__86CEA3B2_E253_49A8_AC57_A7F485DB0640__INCLUDED_
- #if _MSC_VER > 1000
- #pragma once
- #endif // _MSC_VER > 1000
- class CVector3
- {
- public:
- CVector3();
- virtual ~CVector3();
- CVector3(float X, float Y, float Z)
- {
- x = X; y = Y; z = Z;
- }
- CVector3 operator+(CVector3 vVector)
- {
- return CVector3(vVector.x + x, vVector.y + y, vVector.z + z);
- }
- CVector3 operator-(CVector3 vVector)
- {
- return CVector3(x - vVector.x, y - vVector.y, z - vVector.z);
- }
- CVector3 operator*(float num)
- {
- return CVector3(x * num, y * num, z * num);
- }
- CVector3 operator/(float num)
- {
- return CVector3(x / num, y / num, z / num);
- }
- float x, y, z;
- };
- CVector3 Cross(CVector3 vVector1, CVector3 vVector2);
- float Magnitude(CVector3 vNormal);
- CVector3 Normalize(CVector3 vVector);
- #endif // !defined(AFX_VECTOR3_H__86CEA3B2_E253_49A8_AC57_A7F485DB0640__INCLUDED_)