?? vector.h
字號:
//========================================================
/**
* @file Vector.h
*
* 項(xiàng)目描述: 3DS文件載入
* 文件描述: 向量類
* 適用平臺: Windows98/2000/NT/XP
*
* 作者: WWBOSS
* 電子郵件: wwboss123@gmail.com
* 創(chuàng)建日期: 2006-12-06
* 修改日期: 2006-12-10
*
*/
//========================================================
#ifndef __VECTOR_H__
#define __VECTOR_H__
#include "stdafx.h"
/** 向量類 */
class Vector3
{
public:
/** 構(gòu)造函數(shù) */
Vector3() { x = 0.0; y = 0.0; z = 0.0; }
Vector3( float xx, float yy, float zz)
{
x = xx;
y = yy;
z = zz;
}
Vector3(const Vector3& vec)
{
x = vec.x;
y = vec.y;
z = vec.z;
}
/** 成員函數(shù) */
inline float length(); /**< 計算向量長度 */
Vector3 normalize(); /**< 單位化向量 */
float dotProduct(const Vector3& v); /**< 計算點(diǎn)積 */
Vector3 crossProduct(const Vector3& v); /**< 計算叉積 */
/** 重載操作符 */
Vector3 operator + (const Vector3& v);
Vector3 operator - (const Vector3& v);
Vector3 operator * (float scale);
Vector3 operator / (float scale);
Vector3 operator - ();
public:
float x,y,z;
};
/** 二維向量類 */
class Vector2
{
public:
/** 構(gòu)造函數(shù) */
Vector2(float xx = 0.0,float yy = 0.0) { x = xx; y = yy; }
Vector2(const Vector2& v)
{
x = v.x;
y = v.y;
}
public:
float x,y;
};
#endif //__VECTOR_H__
?? 快捷鍵說明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -