Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class Vector3
- {
- public:
- float x;
- float padding_0;
- float y;
- float padding_1;
- float z;
- float padding_2;
- Vector3()
- {
- }
- Vector3(float x, float y, float z)
- {
- Vector3::x = x;
- Vector3::y = y;
- Vector3::z = z;
- }
- Vector3 operator+(const Vector3& v)
- {
- Vector3 vec;
- vec.x = this->x + v.x;
- vec.y = this->y + v.y;
- vec.z = this->z + v.z;
- return vec;
- }
- Vector3 operator+(const float& v)
- {
- Vector3 vec;
- vec.x = this->x + v;
- vec.y = this->y + v;
- vec.z = this->z + v;
- return vec;
- }
- Vector3& operator+=(const float v)
- {
- this->x += v;
- this->y += v;
- this->z += v;
- return *this;
- }
- Vector3 operator+=(const Vector3& v)
- {
- this->x += v.x;
- this->y += v.y;
- this->z += v.z;
- return *this;
- }
- Vector3 operator-(const Vector3& v)
- {
- Vector3 vec;
- vec.x = this->x - v.x;
- vec.y = this->y - v.y;
- vec.z = this->z - v.z;
- return vec;
- }
- Vector3 operator-(const float& v)
- {
- Vector3 vec;
- vec.x = this->x - v;
- vec.y = this->y - v;
- vec.z = this->z - v;
- return vec;
- }
- Vector3& operator-=(const float v)
- {
- this->x -= v;
- this->y -= v;
- this->z -= v;
- return *this;
- }
- Vector3 operator-=(const Vector3& v)
- {
- this->x -= v.x;
- this->y -= v.y;
- this->z -= v.z;
- return *this;
- }
- Vector3 operator*(const Vector3& v)
- {
- Vector3 vec;
- vec.x = this->x * v.x;
- vec.y = this->y * v.y;
- vec.z = this->z * v.z;
- return vec;
- }
- Vector3 operator*(const float& v)
- {
- Vector3 vec;
- vec.x = this->x * v;
- vec.y = this->y * v;
- vec.z = this->z * v;
- return vec;
- }
- Vector3& operator*=(const float v)
- {
- this->x *= v;
- this->y *= v;
- this->z *= v;
- return *this;
- }
- Vector3 operator*=(const Vector3& v)
- {
- this->x *= v.x;
- this->y *= v.y;
- this->z *= v.z;
- return *this;
- }
- Vector3 operator/(const Vector3& v)
- {
- Vector3 vec;
- vec.x = this->x / v.x;
- vec.y = this->y / v.y;
- vec.z = this->z / v.z;
- return vec;
- }
- Vector3 operator/(const float& v)
- {
- Vector3 vec;
- vec.x = this->x / v;
- vec.y = this->y / v;
- vec.z = this->z / v;
- return vec;
- }
- Vector3& operator/=(const float v)
- {
- this->x /= v;
- this->y /= v;
- this->z /= v;
- return *this;
- }
- Vector3 operator/=(const Vector3& v)
- {
- this->x /= v.x;
- this->y /= v.y;
- this->z /= v.z;
- return *this;
- }
- int size(const Vector3& v)
- {
- double x = (double)v.x;
- double y = (double)v.y;
- double z = (double)v.z;
- return (int)sqrt(x*x + y*y + z*z);
- }
- };
- class CVector3
- {
- public:
- float x, y, z;
- CVector3()
- {
- }
- CVector3(float x, float y, float z)
- {
- CVector3::x = x;
- CVector3::y = y;
- CVector3::z = z;
- }
- explicit operator Vector3() const
- {
- return Vector3(this->x, this->y, this->z);
- }
- };
Advertisement
Add Comment
Please, Sign In to add comment