class
#include <include/spice/transform.hpp>
transform_2d Contents
Represents a 2D transformation matrix.
auto tx = transform_2d().translate(2, 5).rotate(42).scale(2, 1);
Base classes
-
template<typename T>class matrix
Constructors, destructors, conversion operators
- transform_2d()
- transform_2d(float translate_x, float translate_y, float angle, float scale_x, float scale_y)
Public functions
-
auto translate(float x,
float y) -> transform_
2d& - auto translate() -> std::pair<float, float>
- Get the currently set translation.
-
auto rotate(float angle,
bool radians = false) -> transform_
2d& - auto rotate() -> float
- Get the currently set rotation.
-
auto scale(float x,
float y) -> transform_
2d& - auto scale() -> std::pair<float, float>
- Get the currently set scale.
Function documentation
spice:: transform_2d:: transform_2d()
Creates a neutral 2d_transform
.
spice:: transform_2d:: transform_2d(float translate_x,
float translate_y,
float angle,
float scale_x,
float scale_y)
Creates a 2d_transform
describing the indicated transformation. The order of operations is the same as the order of parameters.
transform_ 2d& spice:: transform_2d:: translate(float x,
float y)
Adds a translation by the given vector to the transform_
.
std::pair<float, float> spice:: transform_2d:: translate()
Get the currently set translation.
Returns | x and y components of translation vector |
---|
transform_ 2d& spice:: transform_2d:: rotate(float angle,
bool radians = false)
Adds a clockwise rotation by the given angle to the transform_
.
transform_ 2d& spice:: transform_2d:: scale(float x,
float y)
Adds a scale by the given factors to the transform_
.
std::pair<float, float> spice:: transform_2d:: scale()
Get the currently set scale.
Returns | x and y scale factors |
---|