Skip to content

Commit 17eb0cd

Browse files
committed
improved naming
1 parent 5202428 commit 17eb0cd

File tree

3 files changed

+115
-112
lines changed

3 files changed

+115
-112
lines changed

include/omath/vector2.hpp

Lines changed: 36 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -30,78 +30,78 @@ namespace omath
3030

3131
// Equality operators
3232
[[nodiscard]]
33-
constexpr bool operator==(const Vector2& src) const noexcept
33+
constexpr bool operator==(const Vector2& other) const noexcept
3434
{
35-
return x == src.x && y == src.y;
35+
return x == other.x && y == other.y;
3636
}
3737

3838
[[nodiscard]]
39-
constexpr bool operator!=(const Vector2& src) const noexcept
39+
constexpr bool operator!=(const Vector2& other) const noexcept
4040
{
41-
return !(*this == src);
41+
return !(*this == other);
4242
}
4343

4444
// Compound assignment operators
45-
constexpr Vector2& operator+=(const Vector2& v) noexcept
45+
constexpr Vector2& operator+=(const Vector2& other) noexcept
4646
{
47-
x += v.x;
48-
y += v.y;
47+
x += other.x;
48+
y += other.y;
4949

5050
return *this;
5151
}
5252

53-
constexpr Vector2& operator-=(const Vector2& v) noexcept
53+
constexpr Vector2& operator-=(const Vector2& other) noexcept
5454
{
55-
x -= v.x;
56-
y -= v.y;
55+
x -= other.x;
56+
y -= other.y;
5757

5858
return *this;
5959
}
6060

61-
constexpr Vector2& operator*=(const Vector2& v) noexcept
61+
constexpr Vector2& operator*=(const Vector2& other) noexcept
6262
{
63-
x *= v.x;
64-
y *= v.y;
63+
x *= other.x;
64+
y *= other.y;
6565

6666
return *this;
6767
}
6868

69-
constexpr Vector2& operator/=(const Vector2& v) noexcept
69+
constexpr Vector2& operator/=(const Vector2& other) noexcept
7070
{
71-
x /= v.x;
72-
y /= v.y;
71+
x /= other.x;
72+
y /= other.y;
7373

7474
return *this;
7575
}
7676

77-
constexpr Vector2& operator*=(const Type& fl) noexcept
77+
constexpr Vector2& operator*=(const Type& value) noexcept
7878
{
79-
x *= fl;
80-
y *= fl;
79+
x *= value;
80+
y *= value;
8181

8282
return *this;
8383
}
8484

85-
constexpr Vector2& operator/=(const Type& fl) noexcept
85+
constexpr Vector2& operator/=(const Type& value) noexcept
8686
{
87-
x /= fl;
88-
y /= fl;
87+
x /= value;
88+
y /= value;
8989

9090
return *this;
9191
}
9292

93-
constexpr Vector2& operator+=(const Type& fl) noexcept
93+
constexpr Vector2& operator+=(const Type& value) noexcept
9494
{
95-
x += fl;
96-
y += fl;
95+
x += value;
96+
y += value;
9797

9898
return *this;
9999
}
100100

101-
constexpr Vector2& operator-=(const Type& fl) noexcept
101+
constexpr Vector2& operator-=(const Type& value) noexcept
102102
{
103-
x -= fl;
104-
y -= fl;
103+
x -= value;
104+
y -= value;
105105

106106
return *this;
107107
}
@@ -164,24 +164,24 @@ namespace omath
164164
}
165165

166166
// Binary arithmetic operators
167-
[[nodiscard]] constexpr Vector2 operator+(const Vector2& v) const noexcept
167+
[[nodiscard]] constexpr Vector2 operator+(const Vector2& other) const noexcept
168168
{
169-
return {x + v.x, y + v.y};
169+
return {x + other.x, y + other.y};
170170
}
171171

172-
[[nodiscard]] constexpr Vector2 operator-(const Vector2& v) const noexcept
172+
[[nodiscard]] constexpr Vector2 operator-(const Vector2& other) const noexcept
173173
{
174-
return {x - v.x, y - v.y};
174+
return {x - other.x, y - other.y};
175175
}
176176

177-
[[nodiscard]] constexpr Vector2 operator*(const Type& fl) const noexcept
177+
[[nodiscard]] constexpr Vector2 operator*(const Type& value) const noexcept
178178
{
179-
return {x * fl, y * fl};
179+
return {x * value, y * value};
180180
}
181181

182-
[[nodiscard]] constexpr Vector2 operator/(const Type& fl) const noexcept
182+
[[nodiscard]] constexpr Vector2 operator/(const Type& value) const noexcept
183183
{
184-
return {x / fl, y / fl};
184+
return {x / value, y / value};
185185
}
186186

187187
// Sum of elements

include/omath/vector3.hpp

Lines changed: 44 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -29,76 +29,76 @@ namespace omath
2929
}
3030
constexpr Vector3() noexcept: Vector2<Type>() {};
3131

32-
[[nodiscard]] constexpr bool operator==(const Vector3& src) const noexcept
32+
[[nodiscard]] constexpr bool operator==(const Vector3& other) const noexcept
3333
{
34-
return Vector2<Type>::operator==(src) && (src.z == z);
34+
return Vector2<Type>::operator==(other) && (other.z == z);
3535
}
3636

37-
[[nodiscard]] constexpr bool operator!=(const Vector3& src) const noexcept
37+
[[nodiscard]] constexpr bool operator!=(const Vector3& other) const noexcept
3838
{
39-
return !(*this == src);
39+
return !(*this == other);
4040
}
4141

42-
constexpr Vector3& operator+=(const Vector3& v) noexcept
42+
constexpr Vector3& operator+=(const Vector3& other) noexcept
4343
{
44-
Vector2<Type>::operator+=(v);
45-
z += v.z;
44+
Vector2<Type>::operator+=(other);
45+
z += other.z;
4646

4747
return *this;
4848
}
4949

50-
constexpr Vector3& operator-=(const Vector3& v) noexcept
50+
constexpr Vector3& operator-=(const Vector3& other) noexcept
5151
{
52-
Vector2<Type>::operator-=(v);
53-
z -= v.z;
52+
Vector2<Type>::operator-=(other);
53+
z -= other.z;
5454

5555
return *this;
5656
}
5757

58-
constexpr Vector3& operator*=(const float fl) noexcept
58+
constexpr Vector3& operator*=(const Type& value) noexcept
5959
{
60-
Vector2<Type>::operator*=(fl);
61-
z *= fl;
60+
Vector2<Type>::operator*=(value);
61+
z *= value;
6262

6363
return *this;
6464
}
6565

66-
constexpr Vector3& operator*=(const Vector3& v) noexcept
66+
constexpr Vector3& operator*=(const Vector3& other) noexcept
6767
{
68-
Vector2<Type>::operator*=(v);
69-
z *= v.z;
68+
Vector2<Type>::operator*=(other);
69+
z *= other.z;
7070

7171
return *this;
7272
}
7373

74-
constexpr Vector3& operator/=(const Vector3& v) noexcept
74+
constexpr Vector3& operator/=(const Vector3& other) noexcept
7575
{
76-
Vector2<Type>::operator/=(v);
77-
z /= v.z;
76+
Vector2<Type>::operator/=(other);
77+
z /= other.z;
7878

7979
return *this;
8080
}
8181

82-
constexpr Vector3& operator+=(const float fl) noexcept
82+
constexpr Vector3& operator+=(const Type& value) noexcept
8383
{
84-
Vector2<Type>::operator+=(fl);
85-
z += fl;
84+
Vector2<Type>::operator+=(value);
85+
z += value;
8686

8787
return *this;
8888
}
8989

90-
constexpr Vector3& operator/=(const float fl) noexcept
90+
constexpr Vector3& operator/=(const Type& value) noexcept
9191
{
92-
Vector2<Type>::operator/=(fl);
93-
z /= fl;
92+
Vector2<Type>::operator/=(value);
93+
z /= value;
9494

9595
return *this;
9696
}
9797

98-
constexpr Vector3& operator-=(const float fl) noexcept
98+
constexpr Vector3& operator-=(const Type& value) noexcept
9999
{
100-
Vector2<Type>::operator-=(fl);
101-
z -= fl;
100+
Vector2<Type>::operator-=(value);
101+
z -= value;
102102

103103
return *this;
104104
}
@@ -175,40 +175,42 @@ namespace omath
175175
return {-this->x, -this->y, -z};
176176
}
177177

178-
[[nodiscard]] constexpr Vector3 operator+(const Vector3& v) const noexcept
178+
[[nodiscard]] constexpr Vector3 operator+(const Vector3& other) const noexcept
179179
{
180-
return {this->x + v.x, this->y + v.y, z + v.z};
180+
return {this->x + other.x, this->y + other.y, z + other.z};
181181
}
182182

183-
[[nodiscard]] constexpr Vector3 operator-(const Vector3& v) const noexcept
183+
[[nodiscard]] constexpr Vector3 operator-(const Vector3& other) const noexcept
184184
{
185-
return {this->x - v.x, this->y - v.y, z - v.z};
185+
return {this->x - other.x, this->y - other.y, z - other.z};
186186
}
187187

188-
[[nodiscard]] constexpr Vector3 operator*(const Type& fl) const noexcept
188+
[[nodiscard]] constexpr Vector3 operator*(const Type& value) const noexcept
189189
{
190-
return {this->x * fl, this->y * fl, z * fl};
190+
return {this->x * value, this->y * value, z * value};
191191
}
192192

193-
[[nodiscard]] constexpr Vector3 operator*(const Vector3& v) const noexcept
193+
[[nodiscard]] constexpr Vector3 operator*(const Vector3& other) const noexcept
194194
{
195-
return {this->x * v.x, this->y * v.y, z * v.z};
195+
return {this->x * other.x, this->y * other.y, z * other.z};
196196
}
197197

198-
[[nodiscard]] constexpr Vector3 operator/(const Type& fl) const noexcept
198+
[[nodiscard]] constexpr Vector3 operator/(const Type& value) const noexcept
199199
{
200-
return {this->x / fl, this->y / fl, z / fl};
200+
return {this->x / value, this->y / value, z / value};
201201
}
202202

203-
[[nodiscard]] constexpr Vector3 operator/(const Vector3& v) const noexcept
203+
[[nodiscard]] constexpr Vector3 operator/(const Vector3& other) const noexcept
204204
{
205-
return {this->x / v.x, this->y / v.y, z / v.z};
205+
return {this->x / other.x, this->y / other.y, z / other.z};
206206
}
207207

208-
[[nodiscard]] constexpr Vector3 cross(const Vector3& v) const noexcept
208+
[[nodiscard]] constexpr Vector3 cross(const Vector3& other) const noexcept
209209
{
210-
return {this->y * v.z - z * v.y, z * v.x - this->x * v.z, this->x * v.y - this->y * v.x};
210+
return {this->y * other.z - z * other.y, z * other.x - this->x * other.z,
211+
this->x * other.y - this->y * other.x};
211212
}
213+
212214
[[nodiscard]] constexpr Type sum() const noexcept
213215
{
214216
return sum_2d() + z;

0 commit comments

Comments
 (0)