1
0
mirror of https://github.com/VCMP-SqMod/SqMod.git synced 2025-01-19 03:57:14 +01:00
SqMod/source/Base/Quaternion.hpp

349 lines
11 KiB
C++
Raw Normal View History

2015-09-30 03:56:11 +03:00
#ifndef _BASE_QUATERNION_HPP_
#define _BASE_QUATERNION_HPP_
// ------------------------------------------------------------------------------------------------
#include "Config.hpp"
// ------------------------------------------------------------------------------------------------
namespace SqMod {
/* ------------------------------------------------------------------------------------------------
* ...
*/
struct Quaternion
{
/* --------------------------------------------------------------------------------------------
* ...
*/
2015-09-30 03:56:11 +03:00
typedef SQFloat Value;
/* --------------------------------------------------------------------------------------------
* ...
*/
2015-09-30 03:56:11 +03:00
static const Quaternion NIL;
static const Quaternion MIN;
static const Quaternion MAX;
/* --------------------------------------------------------------------------------------------
* ...
*/
2015-09-30 03:56:11 +03:00
static SQChar Delim;
/* --------------------------------------------------------------------------------------------
* ...
*/
2015-09-30 03:56:11 +03:00
Value x, y, z, w;
/* --------------------------------------------------------------------------------------------
* ...
*/
Quaternion();
/* --------------------------------------------------------------------------------------------
* ...
*/
Quaternion(Value s);
/* --------------------------------------------------------------------------------------------
* ...
*/
Quaternion(Value xv, Value yv, Value zv);
/* --------------------------------------------------------------------------------------------
* ...
*/
Quaternion(Value xv, Value yv, Value zv, Value wv);
/* --------------------------------------------------------------------------------------------
* ...
*/
Quaternion(const Vector3 & v);
/* --------------------------------------------------------------------------------------------
* ...
*/
Quaternion(const Vector4 & v);
/* --------------------------------------------------------------------------------------------
* ...
*/
Quaternion(const SQChar * values, SQChar delim);
/* --------------------------------------------------------------------------------------------
* ...
*/
Quaternion(const Quaternion & q);
/* --------------------------------------------------------------------------------------------
* ...
*/
Quaternion(Quaternion && q);
/* --------------------------------------------------------------------------------------------
* ...
*/
2015-09-30 03:56:11 +03:00
~Quaternion();
/* --------------------------------------------------------------------------------------------
* ...
*/
Quaternion & operator = (const Quaternion & q);
/* --------------------------------------------------------------------------------------------
* ...
*/
Quaternion & operator = (Quaternion && q);
/* --------------------------------------------------------------------------------------------
* ...
*/
Quaternion & operator = (Value s);
/* --------------------------------------------------------------------------------------------
* ...
*/
Quaternion & operator = (const Vector3 & q);
/* --------------------------------------------------------------------------------------------
* ...
*/
Quaternion & operator = (const Vector4 & q);
/* --------------------------------------------------------------------------------------------
* ...
*/
Quaternion & operator += (const Quaternion & q);
/* --------------------------------------------------------------------------------------------
* ...
*/
Quaternion & operator -= (const Quaternion & q);
/* --------------------------------------------------------------------------------------------
* ...
*/
Quaternion & operator *= (const Quaternion & q);
/* --------------------------------------------------------------------------------------------
* ...
*/
Quaternion & operator /= (const Quaternion & q);
/* --------------------------------------------------------------------------------------------
* ...
*/
Quaternion & operator %= (const Quaternion & q);
/* --------------------------------------------------------------------------------------------
* ...
*/
Quaternion & operator += (Value s);
/* --------------------------------------------------------------------------------------------
* ...
*/
Quaternion & operator -= (Value s);
/* --------------------------------------------------------------------------------------------
* ...
*/
Quaternion & operator *= (Value s);
/* --------------------------------------------------------------------------------------------
* ...
*/
Quaternion & operator /= (Value s);
/* --------------------------------------------------------------------------------------------
* ...
*/
Quaternion & operator %= (Value s);
/* --------------------------------------------------------------------------------------------
* ...
*/
Quaternion & operator ++ ();
/* --------------------------------------------------------------------------------------------
* ...
*/
Quaternion & operator -- ();
/* --------------------------------------------------------------------------------------------
* ...
*/
Quaternion operator ++ (int);
/* --------------------------------------------------------------------------------------------
* ...
*/
Quaternion operator -- (int);
/* --------------------------------------------------------------------------------------------
* ...
*/
Quaternion operator + (const Quaternion & q) const;
/* --------------------------------------------------------------------------------------------
* ...
*/
Quaternion operator - (const Quaternion & q) const;
/* --------------------------------------------------------------------------------------------
* ...
*/
Quaternion operator * (const Quaternion & q) const;
/* --------------------------------------------------------------------------------------------
* ...
*/
Quaternion operator / (const Quaternion & q) const;
/* --------------------------------------------------------------------------------------------
* ...
*/
Quaternion operator % (const Quaternion & q) const;
/* --------------------------------------------------------------------------------------------
* ...
*/
Quaternion operator + (Value s) const;
/* --------------------------------------------------------------------------------------------
* ...
*/
Quaternion operator - (Value s) const;
/* --------------------------------------------------------------------------------------------
* ...
*/
Quaternion operator * (Value s) const;
/* --------------------------------------------------------------------------------------------
* ...
*/
Quaternion operator / (Value s) const;
/* --------------------------------------------------------------------------------------------
* ...
*/
Quaternion operator % (Value s) const;
/* --------------------------------------------------------------------------------------------
* ...
*/
Quaternion operator + () const;
/* --------------------------------------------------------------------------------------------
* ...
*/
Quaternion operator - () const;
/* --------------------------------------------------------------------------------------------
* ...
*/
bool operator == (const Quaternion & q) const;
/* --------------------------------------------------------------------------------------------
* ...
*/
bool operator != (const Quaternion & q) const;
/* --------------------------------------------------------------------------------------------
* ...
*/
bool operator < (const Quaternion & q) const;
/* --------------------------------------------------------------------------------------------
* ...
*/
bool operator > (const Quaternion & q) const;
/* --------------------------------------------------------------------------------------------
* ...
*/
bool operator <= (const Quaternion & q) const;
/* --------------------------------------------------------------------------------------------
* ...
*/
bool operator >= (const Quaternion & q) const;
/* --------------------------------------------------------------------------------------------
* ...
*/
SQInteger Cmp(const Quaternion & q) const;
/* --------------------------------------------------------------------------------------------
* ...
*/
const SQChar * ToString() const;
/* --------------------------------------------------------------------------------------------
* ...
*/
void Set(Value ns);
/* --------------------------------------------------------------------------------------------
* ...
*/
void Set(Value nx, Value ny, Value nz);
/* --------------------------------------------------------------------------------------------
* ...
*/
void Set(Value nx, Value ny, Value nz, Value nw);
/* --------------------------------------------------------------------------------------------
* ...
*/
void Set(const Quaternion & q);
/* --------------------------------------------------------------------------------------------
* ...
*/
void Set(const Vector3 & v);
/* --------------------------------------------------------------------------------------------
* ...
*/
void Set(const Vector4 & v);
/* --------------------------------------------------------------------------------------------
* ...
*/
void Set(const SQChar * values, SQChar delim);
/* --------------------------------------------------------------------------------------------
* ...
*/
void Generate();
/* --------------------------------------------------------------------------------------------
* ...
*/
void Generate(Value min, Value max);
/* --------------------------------------------------------------------------------------------
* ...
*/
void Generate(Value xmin, Value xmax, Value ymin, Value ymax, Value zmin, Value zmax, Value wmin, Value wmax);
/* --------------------------------------------------------------------------------------------
* ...
*/
void Clear()
{
x = 0.0, y = 0.0, z = 0.0, w = 0.0;
}
/* --------------------------------------------------------------------------------------------
* ...
*/
Quaternion Abs() const;
2015-09-30 03:56:11 +03:00
};
} // Namespace:: SqMod
#endif // _BASE_QUATERNION_HPP_