Navigation
API > API/Runtime > API/Runtime/Core > API/Runtime/Core/Math
References
| Module | Core |
| Header | /Engine/Source/Runtime/Core/Public/Math/TransformCalculus2D.h |
| Include | #include "Math/TransformCalculus2D.h" |
Syntax
template<typename T>
class TMatrix2x2
Remarks
Transform calculus for 2D types. UE4 already has a 2D Vector class that we will adapt to be interpreted as a translate transform. The rest we create new classes for.
The following types are supported
- float/double -> represents a uniform scale.
- FScale2D -> represents a 2D non-uniform scale.
- FVector2D -> represents a 2D translation.
- FShear2D -> represents a "2D shear", interpreted as a shear parallel to the X axis followed by a shear parallel to the Y axis.
- FQuat2D -> represents a pure 2D rotation.
- FMatrix2x2 -> represents a general 2D transform.
2x2 generalized matrix. As FMatrix, we assume row vectors, row major storage: [X Y] * [m00 m01] [m10 m11]
Constructors
| Type | Name | Description | |
|---|---|---|---|
TMatrix2x2 () |
Ctor. initialize to an identity. | ||
TMatrix2x2
(
T UniformScale |
Ctor. initialize from a scale. | ||
TMatrix2x2
(
const TScale2< T >& Scale |
Ctor. initialize from a scale. | ||
TMatrix2x2
(
const TShear2< T >& Shear |
Factory function. initialize from a 2D shear. | ||
TMatrix2x2
(
const FQuat2D& Rotation |
Ctor. initialize from a rotation. | ||
TMatrix2x2
(
T m00, |
Functions
| Type | Name | Description | |
|---|---|---|---|
| TMatrix2x2 | Concatenate
(
const TMatrix2x2& RHS |
Concatenate 2 matrices: [A B] * [E F] == [AE+BG AF+BH] [C D] [G H] [CE+DG CF+DH] | |
| T | Determinant () |
||
| void | GetMatrix
(
double& A, |
||
| void | GetMatrix
(
float& A, |
||
| T | Gets the rotation angle of the matrix. | ||
| TScale2< T > | GetScale () |
Gets the scale from the matrix. | |
| TScale2< T > | Extracts the squared scale from the matrix (avoids sqrt). | ||
| TMatrix2x2 | Inverse () |
Invert the transform. | |
| T | |||
| bool | IsIdentity () |
Determines if the matrix is identity or not. | |
| bool | IsNearlyIdentity
(
T ErrorTolerance |
||
| UE::Math::TVector2< ArgType > | TransformPoint
(
const UE::Math::TVector2< ArgType >& Point |
Transform a 2D point [X Y] * [m00 m01] [m10 m11] | |
| UE::Math::TVector2< ArgType > | TransformVector
(
const UE::Math::TVector2< ArgType >& Vector |
Vector transformation is equivalent to point transformation as our matrix is not homogeneous. |
Operators
| Type | Name | Description | |
|---|---|---|---|
| bool | operator!=
(
const TMatrix2x2& Other |
Inequality. | |
| bool | operator==
(
const TMatrix2x2& RHS |
Equality. |
Typedefs
| Name | Description |
|---|---|
| FReal | |
| Vector2Type |