gsphysics.cpp
来自「网络泡泡被.net管理」· C++ 代码 · 共 198 行
CPP
198 行
// GsPhysics.cpp: implementation of the CGsPhysics class.
//
//////////////////////////////////////////////////////////////////////
#include "stdafx.h"
#include "..\INCLUDE\GsPhysics.h"
/*
// ---------------------------------------------------------------
// inline SVector members
// ---------------------------------------------------------------
inline SVector::SVector()// : x( 0 ), y( 0 )
{
x = 0;
y = 0;
z = 0;
}
inline SVector::SVector( float new_x, float new_y, float new_z )
{
x = new_x;
y = new_y;
z = new_z;
}
inline SVector::SVector( SVector const & other )
{
x = other.x;
y = other.y;
z = other.z;
}
inline SVector & SVector::operator+=( SVector const & right )
{
x += right.x;
y += right.y;
z += right.z;
return *this;
}
inline SVector & SVector::operator-=( SVector const & right )
{
x -= right.x;
y -= right.y;
z -= right.z;
return *this;
}
inline SVector & SVector::operator*=( float right )
{
return *this;
}
inline SVector & SVector::operator/=( float right )
{
return *this;
}
inline SVector & SVector::operator%=( float right )
{
return *this;
}
inline SVector & SVector::operator<<=( int right )
{
return *this;
}
inline SVector & SVector::operator>>=( int right )
{
return *this;
}
// ---------------------------------------------------------------
// inline SVector free functions
// ---------------------------------------------------------------
inline bool operator==( SVector const & left, SVector const & right )
{
return left.x == right.x && left.y == right.y && left.z == right.z;
}
inline bool operator!=( SVector const & left, SVector const & right )
{
return !( left == right );
}
inline SVector operator-( SVector const & pofloat )
{
return SVector( -pofloat.x, -pofloat.y, -pofloat.z );
}
inline SVector operator+( SVector const & left, SVector const & right )
{
SVector result( left );
result += right;
return result;
}
inline SVector operator-( SVector const & left, SVector const & right )
{
SVector result( left );
result -= right;
return result;
}
inline SVector operator*( SVector const & left, float right )
{
SVector result( left );
result *= right;
return result;
}
inline SVector operator*( float left, SVector const & right )
{
return right * left;
}
inline SVector operator/( SVector const & left, float right )
{
SVector result( left );
result /= right;
return result;
}
inline SVector operator%( SVector const & left, float right )
{
SVector result( left );
result %= right;
return result;
}
inline SVector operator<<( SVector const & left, int right )
{
SVector result( left );
result <<= right;
return result;
}
inline SVector operator>>( SVector const & left, int right )
{
SVector result( left );
result >>= right;
return result;
}
/////.......
inline double distance( SVector const & pofloat )
{
return sqrt( pofloat.x * pofloat.x + pofloat.y * pofloat.y );
}
inline double angle( SVector const & pofloat )
{
double result = atan2( pofloat.y, pofloat.x );
if ( result < 0.0 )
result += const_2_PI;
return result;
}
inline std::streambuf & operator<<( std::streambuf & stream, SVector const & pofloat )
{
put< float >( stream, pofloat.x );
put< float >( stream, pofloat.y );
put< float >( stream, pofloat.z );
return stream;
}
inline std::streambuf & operator>>( std::streambuf & stream, SVector & pofloat )
{
SVector result;
result.x = get< float >( stream );
result.y = get< float >( stream );
result.z = get< float >( stream );
pofloat = result;
return stream;
}
*/
//////////////////////////////////////////////////////////////////////
// Construction/Destruction
//////////////////////////////////////////////////////////////////////
CGsPhysics::CGsPhysics()
{
}
CGsPhysics::~CGsPhysics()
{
}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?