Skip to content

Commit 599d587

Browse files
committed
Ensure R6 compliance
Chapter 7. Linear Algebra
1 parent deda638 commit 599d587

File tree

2 files changed

+30
-36
lines changed

2 files changed

+30
-36
lines changed

N3888_RefImpl/src/xio2d_impl.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -267,13 +267,13 @@ namespace std::experimental::io2d {
267267
return x * other.x + y * other.y;
268268
}
269269

270-
inline float point_2d::angular_direction() const noexcept {
270+
/* inline float point_2d::angular_direction() const noexcept {
271271
auto v = atan2(y, x);
272272
if (v < 0.0F) {
273273
v += two_pi<float>;
274274
}
275275
return v;
276-
}
276+
}*/
277277

278278
inline constexpr point_2d point_2d::zero() noexcept {
279279
return { 0.0f, 0.0f };
@@ -384,10 +384,10 @@ namespace std::experimental::io2d {
384384
, m22(1.0f) {
385385
}
386386

387-
inline constexpr matrix_2d matrix_2d::init_translate(const point_2d& value) noexcept {
387+
inline constexpr matrix_2d matrix_2d::init_translate(point_2d value) noexcept {
388388
return{ 1.0F, 0.0F, 0.0F, 1.0F, value.x, value.y };
389389
}
390-
inline constexpr matrix_2d matrix_2d::init_scale(const point_2d& value) noexcept {
390+
inline constexpr matrix_2d matrix_2d::init_scale(point_2d value) noexcept {
391391
return{ value.x, 0.0F, 0.0F, value.y, 0.0F, 0.0F };
392392
}
393393
inline matrix_2d matrix_2d::init_rotate(float radians) noexcept {

N3888_RefImpl/src/xlinear_algebra.h

Lines changed: 26 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ namespace std::experimental::io2d {
1616
constexpr float dot(const point_2d& other) const noexcept;
1717
float magnitude() const noexcept;
1818
constexpr float magnitude_squared() const noexcept;
19-
float angular_direction() const noexcept;
19+
float angular_direction(const point_2d& to) const noexcept;
2020
point_2d to_unit() const noexcept;
2121
constexpr static point_2d zero() noexcept;
2222

@@ -28,18 +28,19 @@ namespace std::experimental::io2d {
2828
constexpr point_2d& operator/=(float rhs) noexcept;
2929
constexpr point_2d& operator/=(const point_2d& rhs) noexcept;
3030
};
31-
constexpr bool operator==(const point_2d& lhs, const point_2d& rhs)
32-
noexcept;
33-
constexpr bool operator!=(const point_2d& lhs, const point_2d& rhs)
34-
noexcept;
35-
constexpr point_2d operator+(const point_2d& lhs) noexcept;
36-
constexpr point_2d operator+(const point_2d& lhs, const point_2d& rhs)
37-
noexcept;
38-
constexpr point_2d operator-(const point_2d& lhs) noexcept;
39-
constexpr point_2d operator-(const point_2d& lhs, const point_2d& rhs)
40-
noexcept;
31+
32+
constexpr bool operator==(const point_2d& lhs, const point_2d& rhs) noexcept;
33+
constexpr bool operator!=(const point_2d& lhs, const point_2d& rhs) noexcept;
34+
constexpr point_2d operator+(const point_2d& val) noexcept;
35+
constexpr point_2d operator+(const point_2d& lhs, const point_2d& rhs) noexcept;
36+
constexpr point_2d operator-(const point_2d& val) noexcept;
37+
constexpr point_2d operator-(const point_2d& lhs, const point_2d& rhs) noexcept;
4138
constexpr point_2d operator*(const point_2d& lhs, float rhs) noexcept;
4239
constexpr point_2d operator*(float lhs, const point_2d& rhs) noexcept;
40+
constexpr point_2d operator*(const point_2d& lhs, const point_2d& rhs) noexcept;
41+
constexpr point_2d operator/(const point_2d& lhs, float rhs) noexcept;
42+
constexpr point_2d operator/(float lhs, const point_2d& rhs) noexcept;
43+
constexpr point_2d operator/(const point_2d& lhs, const point_2d& rhs) noexcept;
4344

4445
class matrix_2d {
4546
public:
@@ -57,13 +58,14 @@ namespace std::experimental::io2d {
5758
float m22;
5859

5960
// \ref{\iotwod.\matrixtwod.staticfactories}, static factory functions:
60-
constexpr static matrix_2d init_translate(const point_2d& value) noexcept;
61-
constexpr static matrix_2d init_scale(const point_2d& value) noexcept;
62-
static matrix_2d init_rotate(float radians) noexcept;
63-
static matrix_2d init_reflect(float radians) noexcept;
64-
constexpr static matrix_2d init_shear_x(float factor) noexcept;
65-
constexpr static matrix_2d init_shear_y(float factor) noexcept;
66-
61+
constexpr static matrix_2d init_translate(point_2d value) noexcept;
62+
constexpr static matrix_2d init_scale(point_2d value) noexcept;
63+
static matrix_2d init_rotate(float radians) noexcept;
64+
static matrix_2d init_rotate(float radians, point_2d origin) noexcept;
65+
static matrix_2d init_reflect(float radians) noexcept;
66+
constexpr static matrix_2d init_shear_x(float factor) noexcept;
67+
constexpr static matrix_2d init_shear_y(float factor) noexcept;
68+
6769
// \ref{\iotwod.\matrixtwod.modifiers}, modifiers:
6870
constexpr matrix_2d& translate(point_2d v) noexcept;
6971
constexpr matrix_2d& scale(point_2d v) noexcept;
@@ -85,20 +87,12 @@ namespace std::experimental::io2d {
8587
};
8688

8789
// \ref{\iotwod.\matrixtwod.ops}, matrix_2d non-member operators:
88-
constexpr matrix_2d operator*(const matrix_2d& lhs, const matrix_2d& rhs)
89-
noexcept;
90-
constexpr bool operator==(const matrix_2d& lhs, const matrix_2d& rhs)
91-
noexcept;
92-
constexpr bool operator!=(const matrix_2d& lhs, const matrix_2d& rhs)
93-
noexcept;
94-
constexpr point_2d operator*(point_2d v, const matrix_2d& m)
95-
noexcept;
96-
constexpr matrix_2d operator*(const matrix_2d& lhs, const matrix_2d& rhs)
97-
noexcept;
98-
constexpr bool operator==(const matrix_2d& lhs, const matrix_2d& rhs)
99-
noexcept;
100-
constexpr bool operator!=(const matrix_2d& lhs, const matrix_2d& rhs)
101-
noexcept;
90+
constexpr matrix_2d operator*(const matrix_2d& lhs, const matrix_2d& rhs) noexcept;
91+
constexpr bool operator==(const matrix_2d& lhs, const matrix_2d& rhs) noexcept;
92+
constexpr bool operator!=(const matrix_2d& lhs, const matrix_2d& rhs) noexcept;
93+
constexpr point_2d operator*(point_2d v, const matrix_2d& m) noexcept;
94+
95+
// constexpr matrix_2d operator*(const matrix_2d& lhs, const matrix_2d& rhs) noexcept;
10296

10397
}
10498
}

0 commit comments

Comments
 (0)