7template <
typename TransformationType>
8Box TransformExtents(
const TransformationType& transformation, Box extents) {
10 transformation.apply({(float)extents.xMin(), (float)extents.yMin()});
12 transformation.apply({(float)extents.xMax(), (float)extents.yMin()});
14 transformation.apply({(float)extents.xMin(), (float)extents.yMax()});
16 transformation.apply({(float)extents.xMax(), (float)extents.yMax()});
17 float xMin = std::min(std::min(tl.x, tr.x), std::min(bl.x, br.x));
18 float yMin = std::min(std::min(tl.y, tr.y), std::min(bl.y, br.y));
19 float xMax = std::max(std::max(tl.x, tr.x), std::max(bl.x, br.x));
20 float yMax = std::max(std::max(tl.y, tr.y), std::max(bl.y, br.y));
21 return Box((int16_t)floorf(xMin), (int16_t)floorf(yMin), (int16_t)ceilf(xMax),
22 (int16_t)ceilf(yMax));
134 t.cos_theta() * dx_ -
t.sin_theta() * dy_,
135 t.sin_theta() * dx_ +
t.cos_theta() * dy_);
140 t.a11() * dx_ +
t.a12() * dy_ +
t.tx(),
141 t.a21() * dx_ +
t.a22() * dy_ +
t.ty());
153 return Scaling(sx_ *
t.sx(), sy_ *
t.sy());
158 sx_ *
t.sin_theta(), sy_ *
t.cos_theta(), 0, 0);
163 sy_ *
t.a22(),
t.tx(),
t.ty());
181 t.sy() * sin_theta_,
t.sy() * cos_theta_, 0, 0);
190 -
t.a11() * sin_theta_ +
t.a12() * cos_theta_,
191 t.a21() * cos_theta_ +
t.a22() * sin_theta_,
192 -
t.a21() * sin_theta_ +
t.a22() * cos_theta_,
211 t.sy() * a22_,
t.sx() * tx_,
t.sy() * ty_);
216 t.cos_theta() * a12_ -
t.sin_theta() * a22_,
217 t.sin_theta() * a11_ +
t.cos_theta() * a21_,
218 t.sin_theta() * a12_ +
t.cos_theta() * a22_,
219 t.cos_theta() * tx_ -
t.sin_theta() * ty_,
220 t.sin_theta() * tx_ +
t.cos_theta() * ty_);
225 t.a11() * a11_ +
t.a12() * a21_,
t.a11() * a12_ +
t.a12() * a22_,
226 t.a21() * a11_ +
t.a22() * a21_,
t.a21() * a12_ +
t.a22() * a22_,
227 t.a11() * tx_ +
t.a12() * ty_ +
t.tx(),
228 t.a21() * tx_ +
t.a22() * ty_ +
t.ty());
256 t.m11() * m11_ +
t.m12() * m21_ +
t.m13() * m31_,
257 t.m11() * m12_ +
t.m12() * m22_ +
t.m13() * m32_,
258 t.m11() * m13_ +
t.m12() * m23_ +
t.m13() * m33_,
259 t.m21() * m11_ +
t.m22() * m21_ +
t.m23() * m31_,
260 t.m21() * m12_ +
t.m22() * m22_ +
t.m23() * m32_,
261 t.m21() * m13_ +
t.m22() * m23_ +
t.m23() * m33_,
262 t.m31() * m11_ +
t.m32() * m21_ +
t.m33() * m31_,
263 t.m31() * m12_ +
t.m32() * m22_ +
t.m33() * m32_,
264 t.m31() * m13_ +
t.m32() * m23_ +
t.m33() * m33_);
268 float c11 = m22_ * m33_ - m23_ * m32_;
269 float c12 = -(m21_ * m33_ - m23_ * m31_);
270 float c13 = m21_ * m32_ - m22_ * m31_;
271 float c21 = -(m12_ * m33_ - m13_ * m32_);
272 float c22 = m11_ * m33_ - m13_ * m31_;
273 float c23 = -(m11_ * m32_ - m12_ * m31_);
274 float c31 = m12_ * m23_ - m13_ * m22_;
275 float c32 = -(m11_ * m23_ - m13_ * m21_);
276 float c33 = m11_ * m22_ - m12_ * m21_;
Axis-aligned integer rectangle.
Rotation by angle in radians (clockwise).
Rotation then(IdentityTransformation t) const
Box transformExtents(Box extents) const
Scaling then(IdentityTransformation t) const
Translation then(IdentityTransformation t) const
Defines 140 opaque HTML named colors.
AffineTransformation RotateRightAbout(float angle, const FpPoint ¢er)
Return a clockwise rotation about a point.
AffineTransformation RotateLeftAbout(float angle, const FpPoint ¢er)
Return a 90-degree counter-clockwise rotation about a point.
AffineTransformation ShearVertically(float sy)
Return a vertical shear rooted at the origin.
Scaling Scale(float sx, float sy)
Return a scaling about the origin.
AffineTransformation ShearHorizontallyAbout(float sx, float base_y)
Return a horizontal shear rooted at base_y.
Rotation RotateRight()
Return a 90-degree clockwise rotation about the origin.
AffineTransformation ShearVerticallyAbout(float sy, float base_x)
Return a vertical shear rooted at base_x.
ProjectiveTransformation PerspectiveAbout(float px, float py, const FpPoint &base)
Return a perspective transformation rooted at base.
AffineTransformation ShearHorizontally(float sx)
Return a horizontal shear rooted at the origin.
Translation Translate(float dx, float dy)
Return a translation by the specified vector.
AffineTransformation ScaleAbout(float sx, float sy, const FpPoint ¢er)
Return a scaling about a given center.
AffineTransformation Shear(float sx, float sy)
Return a shear rooted at the origin.
ProjectiveTransformation Perspective(float px, float py)
Return a perspective transformation rooted at the origin.
Rotation RotateLeft()
Return a 90-degree counter-clockwise rotation about the origin.