1
0
Fork 0
mirror of https://github.com/juce-framework/JUCE.git synced 2026-01-25 02:04:23 +00:00

AffineTransform: Add isOnlyTranslationOrScale() helper

This commit is contained in:
reuk 2024-05-08 19:49:57 +01:00
parent 592df26ff0
commit bd2aea9676
No known key found for this signature in database
GPG key ID: FCB43929F012EE5C
2 changed files with 9 additions and 2 deletions

View file

@ -239,6 +239,11 @@ bool AffineTransform::isOnlyTranslation() const noexcept
&& exactlyEqual (mat11, 1.0f);
}
bool AffineTransform::isOnlyTranslationOrScale() const noexcept
{
return exactlyEqual (mat01, 0.0f) && exactlyEqual (mat10, 0.0f);
}
float AffineTransform::getDeterminant() const noexcept
{
return (mat00 * mat11) - (mat01 * mat10);

View file

@ -258,10 +258,12 @@ public:
/** Returns true if this transform maps to a singularity - i.e. if it has no inverse. */
bool isSingularity() const noexcept;
/** Returns true if the transform only translates, and doesn't scale or rotate the
points. */
/** Returns true if the transform only translates, and doesn't scale or rotate the points. */
bool isOnlyTranslation() const noexcept;
/** Returns true if the transform only translates and/or scales. */
bool isOnlyTranslationOrScale() const noexcept;
/** If this transform is only a translation, this returns the X offset.
@see isOnlyTranslation
*/