50 float a = 1.0f,
b = 0.0f;
51 float c = 0.0f,
d = 1.0f;
52 float e = 0.0f,
f = 0.0f;
56 float d_,
float e_,
float f_)
57 :
a(a_),
b(b_),
c(c_),
d(d_),
e(e_),
f(f_) {}
63 return {1.0f, 0.0f, 0.0f, 1.0f, tx, ty};
67 return {sx, 0.0f, 0.0f, sy, 0.0f, 0.0f};
73 return {sx, 0.0f, 0.0f, sy, px - px * sx, py - py * sy};
77 const float s = std::sin(radians);
78 const float co = std::cos(radians);
79 return {co, s, -s, co, 0.0f, 0.0f};
84 const float s = std::sin(radians);
85 const float co = std::cos(radians);
86 return {co, s, -s, co,
87 px - px * co + py * s,
88 py - px * s - py * co};
93 return {1.0f, shy, shx, 1.0f, 0.0f, 0.0f};
102 next.
a *
a + next.
c *
b,
103 next.
b *
a + next.
d *
b,
104 next.
a *
c + next.
c *
d,
105 next.
b *
c + next.
d *
d,
106 next.
a *
e + next.
c *
f + next.
e,
107 next.
b *
e + next.
d *
f + next.
f,
140 return !std::isfinite(det) || std::abs(det) < 1e-12f;
149 const float inv = 1.0f / det;
155 (
c *
f -
d *
e) * inv,
156 (
b *
e -
a *
f) * inv,
162 return {
a * p.x +
c * p.y +
e,
b * p.x +
d * p.y +
f};
166 const float nx =
a * x +
c * y +
e;
167 const float ny =
b * x +
d * y +
f;
181 const float minx = std::min(std::min(p0.
x, p1.x), std::min(p2.x, p3.x));
182 const float maxx = std::max(std::max(p0.
x, p1.x), std::max(p2.x, p3.x));
183 const float miny = std::min(std::min(p0.
y, p1.y), std::min(p2.y, p3.y));
184 const float maxy = std::max(std::max(p0.
y, p1.y), std::max(p2.y, p3.y));
185 return {minx, miny, maxx - minx, maxy - miny};
190 return a == 1.0f &&
b == 0.0f &&
c == 0.0f &&
191 d == 1.0f &&
e == 0.0f &&
f == 0.0f;
195 return a == o.a &&
b == o.b &&
c == o.c &&
196 d == o.d &&
e == o.e &&
f == o.f;
199 return !(*
this == o);
Definition affine_transform.hpp:24
A 2D point.
Definition affine_transform.hpp:37
float x
Definition affine_transform.hpp:38
constexpr bool operator!=(const Point2D &p) const
Definition affine_transform.hpp:45
constexpr Point2D operator+(const Point2D &p) const
Definition affine_transform.hpp:41
constexpr Point2D operator-(const Point2D &p) const
Definition affine_transform.hpp:42
float y
Definition affine_transform.hpp:39
constexpr Point2D operator*(float s) const
Definition affine_transform.hpp:43
constexpr bool operator==(const Point2D &p) const
Definition affine_transform.hpp:44
Axis-aligned rectangle in canvas coordinates.
Definition rectangle_list.hpp:28