Subversion Repository Public Repository

Divide-Framework

This repository has no backups
This repository's network speed is throttled to 100KB/sec

Diff Revisions 865 vs 867 for /trunk/Source Code/Core/Math/Headers/MathVectors.h

Diff revisions: vs.
  @@ -194,7 +194,7 @@
194 194 template<typename U>
195 195 bool operator!=(const vec2<U> &v) const { return !this->compare(v); }
196 196 template<typename U>
197 - bool operator==(const vec2<T> &v) const { return this->compare(v); }
197 + bool operator==(const vec2<U> &v) const { return this->compare(v); }
198 198
199 199 vec2 &operator=(T _f) noexcept {
200 200 this->set(_f);
  @@ -215,6 +215,52 @@
215 215 const vec2 operator+(const vec2 &v) const {
216 216 return vec2(this->x + v.x, this->y + v.y);
217 217 }
218 +
219 + const vec2 operator+(T _f) const {
220 + return vec2(this->x + _f, this->y + _f);
221 + }
222 +
223 + const vec2 operator-(T _f) const {
224 + return vec2(this->x - _f, this->y - _f);
225 + }
226 +
227 + template<typename U>
228 + vec2 &operator=(U _f) noexcept {
229 + this->set(_f);
230 + return (*this);
231 + }
232 +
233 + template<typename U>
234 + vec2 &operator=(const vec2<U>& other) noexcept {
235 + this->set(other);
236 + return (*this);
237 + }
238 +
239 + template<typename U>
240 + const vec2 operator*(U _f) const {
241 + return vec2(this->x * _f, this->y * _f);
242 + }
243 +
244 + template<typename U>
245 + const vec2 operator/(U _i) const {
246 + return vec2(this->x / _i, this->y / _i);
247 + }
248 +
249 + template<typename U>
250 + const vec2 operator+(const vec2<U> &v) const {
251 + return vec2(this->x + v.x, this->y + v.y);
252 + }
253 +
254 + template<typename U>
255 + const vec2 operator+(U _f) const {
256 + return vec2(this->x + _f, this->y + _f);
257 + }
258 +
259 + template<typename U>
260 + const vec2 operator-(U _f) const {
261 + return vec2(this->x - _f, this->y - _f);
262 + }
263 +
218 264 const vec2 operator-() const { return vec2(-this->x, -this->y); }
219 265 const vec2 operator-(const vec2 &v) const {
220 266 return vec2(this->x - v.x, this->y - v.y);
  @@ -462,7 +508,7 @@
462 508 template<typename U>
463 509 bool operator!=(const vec3<U> &v) const { return !this->compare(v); }
464 510 template<typename U>
465 - bool operator==(const vec3<T> &v) const { return this->compare(v); }
511 + bool operator==(const vec3<U> &v) const { return this->compare(v); }
466 512
467 513 vec3 &operator=(T _f) noexcept {
468 514 this->set(_f);
  @@ -485,6 +531,46 @@
485 531 const vec3 operator+(const vec3 &v) const {
486 532 return vec3(this->x + v.x, this->y + v.y, this->z + v.z);
487 533 }
534 + const vec3 operator-(T _f) const {
535 + return vec3(this->x - _f, this->y - _f, this->z - _f);
536 + }
537 +
538 + template <typename U>
539 + vec3 &operator=(U _f) noexcept {
540 + this->set(_f);
541 + return (*this);
542 + }
543 +
544 + template <typename U>
545 + vec3 &operator=(const vec3<U>& other) noexcept {
546 + this->set(other);
547 + return (*this);
548 + }
549 +
550 + template <typename U>
551 + const vec3 operator*(U _f) const {
552 + return vec3(this->x * _f, this->y * _f, this->z * _f);
553 + }
554 +
555 + template <typename U>
556 + const vec3 operator/(U _f) const {
557 + if (IS_ZERO(_f)) {
558 + return *this;
559 + }
560 +
561 + return (*this) * (1.0f / _f);
562 + }
563 +
564 + template <typename U>
565 + const vec3 operator+(const vec3<U> &v) const {
566 + return vec3(this->x + v.x, this->y + v.y, this->z + v.z);
567 + }
568 +
569 + template <typename U>
570 + const vec3 operator-(U _f) const {
571 + return vec3(this->x - _f, this->y - _f, this->z - _f);
572 + }
573 +
488 574 const vec3 operator-() const { return vec3(-this->x, -this->y, -this->z); }
489 575 const vec3 operator-(const vec3 &v) const {
490 576 return vec3(this->x - v.x, this->y - v.y, this->z - v.z);
  @@ -791,9 +877,10 @@
791 877 template<typename U>
792 878 bool operator!=(const vec4<U> &v) const { return !this->compare(v); }
793 879 template<typename U>
794 - bool operator==(const vec4<T> &v) const { return this->compare(v); }
880 + bool operator==(const vec4<U> &v) const { return this->compare(v); }
795 881
796 882 vec4 &operator=(T _f) noexcept { this->set(_f); return *this; }
883 +
797 884 vec4 &operator=(const vec4& other) noexcept { this->set(other); return *this; }
798 885
799 886 const vec4 operator-(T _f) const {
  @@ -819,6 +906,40 @@
819 906 static_cast<T>(this->w * (1.0f / _f)));
820 907 }
821 908
909 +
910 + template<typename U>
911 + vec4 &operator=(U _f) noexcept { this->set(_f); return *this; }
912 +
913 + template<typename U>
914 + vec4 &operator=(const vec4& other) noexcept { this->set(other); return *this; }
915 +
916 + template<typename U>
917 + const vec4 operator-(U _f) const {
918 + return vec4(this->x - _f, this->y - _f, this->z - _f, this->w - _f);
919 + }
920 +
921 + template<typename U>
922 + const vec4 operator+(U _f) const {
923 + return vec4(this->x + _f, this->y + _f, this->z + _f, this->w + _f);
924 + }
925 +
926 + template<typename U>
927 + const vec4 operator*(U _f) const {
928 + return vec4(this->x * _f, this->y * _f, this->z * _f, this->w * _f);
929 + }
930 +
931 + template<typename U>
932 + const vec4 operator/(U _f) const {
933 + if (IS_ZERO(_f)) {
934 + return *this;
935 + }
936 +
937 + return vec4(static_cast<T>(this->x * (1.0f / _f)),
938 + static_cast<T>(this->y * (1.0f / _f)),
939 + static_cast<T>(this->z * (1.0f / _f)),
940 + static_cast<T>(this->w * (1.0f / _f)));
941 + }
942 +
822 943 const vec4 operator-() const { return vec4(-x, -y, -z, -w); }
823 944
824 945 const vec4 operator+(const vec4 &v) const {