30 float m10,
float m11,
float m12)
noexcept
38 return mat00 == other.mat00
39 &&
mat01 == other.mat01
40 &&
mat02 == other.mat02
41 &&
mat10 == other.mat10
42 &&
mat11 == other.mat11
43 &&
mat12 == other.mat12;
48 return ! operator== (other);
67 return { other.mat00 *
mat00 + other.mat01 *
mat10,
69 other.mat00 *
mat02 + other.mat01 *
mat12 + other.mat02,
72 other.mat10 *
mat02 + other.mat11 *
mat12 + other.mat12 };
83 return { 1.0f, 0.0f, dx,
95 auto cosRad = std::cos (rad);
96 auto sinRad = std::sin (rad);
108 auto cosRad = std::cos (rad);
109 auto sinRad = std::sin (rad);
111 return { cosRad, -sinRad, 0,
117 auto cosRad = std::cos (rad);
118 auto sinRad = std::sin (rad);
120 return { cosRad, -sinRad, -cosRad * pivotX + sinRad * pivotY + pivotX,
121 sinRad, cosRad, -sinRad * pivotX + -cosRad * pivotY + pivotY };
143 return { factorX, 0, 0, 0, factorY, 0 };
148 return { factor, 0, 0, 0, factor, 0 };
152 float pivotX,
float pivotY)
const noexcept
154 return { factorX *
mat00, factorX *
mat01, factorX *
mat02 + pivotX * (1.0f - factorX),
155 factorY *
mat10, factorY *
mat11, factorY *
mat12 + pivotY * (1.0f - factorY) };
159 float pivotX,
float pivotY)
noexcept
161 return { factorX, 0, pivotX * (1.0f - factorX),
162 0, factorY, pivotY * (1.0f - factorY) };
167 return { 1.0f, shearX, 0,
183 return { 1.0f, 0.0f, 0.0f,
193 determinant = 1.0 / determinant;
195 auto dst00 = (float) (
mat11 * determinant);
196 auto dst10 = (float) (-
mat10 * determinant);
197 auto dst01 = (float) (-
mat01 * determinant);
198 auto dst11 = (float) (
mat00 * determinant);
200 return { dst00, dst01, -
mat02 * dst00 -
mat12 * dst01,
201 dst10, dst11, -
mat02 * dst10 -
mat12 * dst11 };
214 float x10,
float y10,
215 float x01,
float y01)
noexcept
217 return { x10 - x00, x01 - x00, x00,
218 y10 - y00, y01 - y00, y00 };
222 float sx2,
float sy2,
float tx2,
float ty2,
223 float sx3,
float sy3,
float tx3,
float ty3)
noexcept
245 return (std::abs (
mat00) + std::abs (
mat11)) / 2.0f;
253class AffineTransformTests :
public UnitTest
256 AffineTransformTests()
260 void runTest()
override
262 beginTest (
"Determinant");
264 constexpr float scale1 = 1.5f, scale2 = 1.3f;
266 auto transform = AffineTransform::scale (scale1)
267 .followedBy (AffineTransform::rotation (degreesToRadians (72.0f)))
268 .followedBy (AffineTransform::translation (100.0f, 20.0f))
269 .followedBy (AffineTransform::scale (scale2));
271 expect (approximatelyEqual (std::sqrt (std::abs (transform.getDeterminant())), scale1 * scale2));
276static AffineTransformTests timeTests;
#define noexcept
Definition DistrhoDefines.h:72
Definition juce_UnitTest.h:70
static int int height
Definition pugl.h:1594
Definition juce_UnitTestCategories.h:27
Definition carla_juce.cpp:31
bool approximatelyEqual(Type a, Type b) noexcept
Definition juce_MathsFunctions.h:324
dy
Definition zipinfo.c:2288
#define const
Definition zconf.h:137