From 93f0de521a0e2abb9c35dfb06bd3d306c548bf1b Mon Sep 17 00:00:00 2001 From: madmaxoft Date: Fri, 7 Mar 2014 21:43:15 +0100 Subject: Added Vector3i::Move(). --- src/Vector3i.h | 47 +++++++++++++++++++++++++++++++++++------------ 1 file changed, 35 insertions(+), 12 deletions(-) (limited to 'src/Vector3i.h') diff --git a/src/Vector3i.h b/src/Vector3i.h index 7d726a7b3..39e138683 100644 --- a/src/Vector3i.h +++ b/src/Vector3i.h @@ -1,22 +1,45 @@ + +// Vector3i.h + +// Declares the Vector3i class representing an int-based 3D vector + + + + + #pragma once -#include + + + +// fwd: class Vector3d; -class Vector3i // tolua_export -{ // tolua_export -public: // tolua_export - Vector3i( const Vector3d & v ); // tolua_export - Vector3i() : x(0), y(0), z(0) {} // tolua_export - Vector3i(int a_x, int a_y, int a_z) : x(a_x), y(a_y), z(a_z) {} // tolua_export - inline void Set(int a_x, int a_y, int a_z) { x = a_x, y = a_y, z = a_z; } // tolua_export - inline float Length() const { return sqrtf( (float)( x * x + y * y + z * z) ); } // tolua_export - inline int SqrLength() const { return x * x + y * y + z * z; } // tolua_export - inline bool Equals( const Vector3i & v ) const { return (x == v.x && y == v.y && z == v.z ); } // tolua_export - inline bool Equals( const Vector3i * v ) const { return (x == v->x && y == v->y && z == v->z ); } // tolua_export + + +// tolua_begin +class Vector3i +{ +public: + /** Creates an int vector based on the floor()-ed coords of a double vector. */ + Vector3i(const Vector3d & v); + + Vector3i(void); + Vector3i(int a_x, int a_y, int a_z); + + inline void Set(int a_x, int a_y, int a_z) { x = a_x, y = a_y, z = a_z; } + inline float Length() const { return sqrtf( (float)( x * x + y * y + z * z) ); } + inline int SqrLength() const { return x * x + y * y + z * z; } + + inline bool Equals( const Vector3i & v ) const { return (x == v.x && y == v.y && z == v.z ); } + inline bool Equals( const Vector3i * v ) const { return (x == v->x && y == v->y && z == v->z ); } + + void Move(int a_MoveX, int a_MoveY, int a_MoveZ); + + // tolua_end void operator += ( const Vector3i& a_V ) { x += a_V.x; y += a_V.y; z += a_V.z; } void operator += ( Vector3i* a_V ) { x += a_V->x; y += a_V->y; z += a_V->z; } -- cgit v1.2.3 From b4bf13aa4f004a7819e262679a295d8ca886557b Mon Sep 17 00:00:00 2001 From: andrew Date: Tue, 11 Mar 2014 16:01:17 +0200 Subject: Unified Vector classes --- src/Vector3i.h | 68 ---------------------------------------------------------- 1 file changed, 68 deletions(-) delete mode 100644 src/Vector3i.h (limited to 'src/Vector3i.h') diff --git a/src/Vector3i.h b/src/Vector3i.h deleted file mode 100644 index 39e138683..000000000 --- a/src/Vector3i.h +++ /dev/null @@ -1,68 +0,0 @@ - -// Vector3i.h - -// Declares the Vector3i class representing an int-based 3D vector - - - - - -#pragma once - - - - - -// fwd: -class Vector3d; - - - - - -// tolua_begin -class Vector3i -{ -public: - /** Creates an int vector based on the floor()-ed coords of a double vector. */ - Vector3i(const Vector3d & v); - - Vector3i(void); - Vector3i(int a_x, int a_y, int a_z); - - inline void Set(int a_x, int a_y, int a_z) { x = a_x, y = a_y, z = a_z; } - inline float Length() const { return sqrtf( (float)( x * x + y * y + z * z) ); } - inline int SqrLength() const { return x * x + y * y + z * z; } - - inline bool Equals( const Vector3i & v ) const { return (x == v.x && y == v.y && z == v.z ); } - inline bool Equals( const Vector3i * v ) const { return (x == v->x && y == v->y && z == v->z ); } - - void Move(int a_MoveX, int a_MoveY, int a_MoveZ); - - // tolua_end - - void operator += ( const Vector3i& a_V ) { x += a_V.x; y += a_V.y; z += a_V.z; } - void operator += ( Vector3i* a_V ) { x += a_V->x; y += a_V->y; z += a_V->z; } - void operator -= ( const Vector3i& a_V ) { x -= a_V.x; y -= a_V.y; z -= a_V.z; } - void operator -= ( Vector3i* a_V ) { x -= a_V->x; y -= a_V->y; z -= a_V->z; } - void operator *= ( int a_f ) { x *= a_f; y *= a_f; z *= a_f; } - - friend Vector3i operator + ( const Vector3i& v1, const Vector3i& v2 ) { return Vector3i( v1.x + v2.x, v1.y + v2.y, v1.z + v2.z ); } - friend Vector3i operator + ( const Vector3i& v1, Vector3i* v2 ) { return Vector3i( v1.x + v2->x, v1.y + v2->y, v1.z + v2->z ); } - friend Vector3i operator - ( const Vector3i& v1, const Vector3i& v2 ) { return Vector3i( v1.x - v2.x, v1.y - v2.y, v1.z - v2.z ); } - friend Vector3i operator - ( const Vector3i& v1, Vector3i* v2 ) { return Vector3i( v1.x - v2->x, v1.y - v2->y, v1.z - v2->z ); } - friend Vector3i operator - ( const Vector3i* v1, Vector3i& v2 ) { return Vector3i( v1->x - v2.x, v1->y - v2.y, v1->z - v2.z ); } - friend Vector3i operator * ( const Vector3i& v, const int f ) { return Vector3i( v.x * f, v.y * f, v.z * f ); } - friend Vector3i operator * ( const Vector3i& v1, const Vector3i& v2 ) { return Vector3i( v1.x * v2.x, v1.y * v2.y, v1.z * v2.z ); } - friend Vector3i operator * ( const int f, const Vector3i& v ) { return Vector3i( v.x * f, v.y * f, v.z * f ); } - friend bool operator < ( const Vector3i& v1, const Vector3i& v2 ) { return (v1.x cVector3iList; -typedef std::vector cVector3iArray; - - - - -- cgit v1.2.3