⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 gisvector.h

📁 该程序用来完成蜗杆齿面的计算
💻 H
字号:
// GISVector.h: interface for the CVector class.
//
//////////////////////////////////////////////////////////////////////

#if !defined(AFX_VECTOR_H__BBF6D21A_C556_4577_B8D3_4EA03CA188AD__INCLUDED_)
#define AFX_VECTOR_H__BBF6D21A_C556_4577_B8D3_4EA03CA188AD__INCLUDED_

#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000

class CVector  
{
public:
	void SetZero(void);
	CVector& RotateCoordSysAboutXbyAng(double angle);
	CVector& RotateCoordSysAboutYbyAng(double angle);
	CVector& RotateCoordSysAboutZbyAng(double angle);
	CVector& RotateAboutYbyAng(double angle);
	CVector& RotateAboutZbyAng(double angle);
	CVector& RotateAboutXbyAng(double angle);
	CVector& Normalization(const double tolerance);
	BOOL IsPerpendicularTo(const CVector& vec, const double tolerance) const;
	BOOL IsEqualTo(const CVector& vec, const double tolerance) const;
	BOOL IsParallelTo(const CVector& vec, const double tolerance) const;
	//CVector& TransformBy(const CMatrix& mat);
	CVector& RotateAboutVectorbyAng(CVector& vec, double angle);
	double Length() const;
	BOOL IsZeroLength(const double tolerance) const;
	BOOL IsUnitLength(const double tolerance) const;
	CVector& SetToSum(const double a, const CVector& vec);
	CVector& operator -= (const CVector& vec);
	CVector& operator += (const CVector& vec);
	CVector operator - (const CVector& vec) const;
	CVector operator + (const CVector& vec) const;
	CVector& operator *= (double scale);
	CVector& operator /= (double scale);
	CVector operator * (double scale) const;
	CVector operator / (double scale) const;
	CVector& CrossProduct(const CVector& vec);
	double DotProduct(const CVector& vec) const;
	double AngleTo(const CVector& vec) const;
	CVector(const CVector& vec);
	CVector& Negate();
	CVector(double x, double y, double z);
    CVector& Set(double x, double y, double z);
	CVector(void);
	double z;
	double y;
	double x;
	virtual ~CVector();
};

// Creates the identity vector.
//
inline
CVector::CVector() : x(0.0), y(0.0), z(0.0)
{
}

inline
CVector::CVector(const CVector& vec) : x(vec.x),y(vec.y),z(vec.z)
{
}

// Creates a vector intialized to ( xx, yy, zz ).
//
inline
CVector::CVector(double xx, double yy, double zz) : x(xx),y(yy),z(zz)
{
}

// This is equivalent to the statement `thisVec = thisVec + vec;'
//
inline CVector&
CVector::operator += (const CVector& vec)
{
    x += vec.x;
    y += vec.y;
    z += vec.z;
    return *this;
}

// This is equivalent to the statement `thisVec = thisVec - vec;'
//
inline CVector&
CVector::operator -= (const CVector& vec)
{
    x -= vec.x;
    y -= vec.y;
    z -= vec.z;
    return *this;
}

// This is equivalent to the statement `thisVec = thisVec * scale;'
//
inline CVector&
CVector::operator *= (double scale)
{
    x *= scale;
    y *= scale;
    z *= scale;
    return *this;
}

// This is equivalent to the statement `thisVec = thisVec / scale;'
//
inline CVector&
CVector::operator /= (double scale)
{
    x /= scale;
    y /= scale;
    z /= scale;
    return *this;
}

// Returns a vector such that each of the coordinates of this vector
// have been divided by scale.
//
inline CVector
CVector::operator / (double scale) const
{
    return CVector (x/scale, y/scale, z/scale);
}

// This operator returns a vector that is the scalar product of
// `scale' and this vector.
//
inline CVector
CVector::operator * (double scale) const
{
    return CVector (x * scale, y * scale, z * scale);
}

// Returns a vector that is formed from adding the components of
// this vector with `vec'.
//
inline CVector
CVector::operator + (const CVector& vec) const
{
    return CVector (x + vec.x, y + vec.y, z + vec.z);
}

// Using this operator is equivalent to using `thisVec + (-vec);'
//
inline CVector
CVector::operator - (const CVector& vec) const
{
    return CVector (x - vec.x, y - vec.y, z - vec.z);
}

// `vec.negate()' is equivalent to the statement `vec = -vec;'
//
inline CVector&
CVector::Negate()
{
    x = -x;
    y = -y;
    z = -z;
    return *this;
}

// Sets the vector to ( xx, yy, zz ).
//
inline CVector&
CVector::Set(double xx, double yy, double zz)
{
    x = xx;
    y = yy;
    z = zz;
    return *this;
}

#endif // !defined(AFX_VECTOR_H__BBF6D21A_C556_4577_B8D3_4EA03CA188AD__INCLUDED_)

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -