bn::affine_mat_attributes class

Contains the attributes which define an affine transformation matrix.

Constructors, destructors, conversion operators

affine_mat_attributes() defaulted constexpr
Identity constructor.
affine_mat_attributes(fixed rotation_angle, fixed horizontal_scale, fixed vertical_scale, bool horizontal_flip, bool vertical_flip) constexpr
Constructor.
affine_mat_attributes(fixed rotation_angle, fixed horizontal_scale, fixed vertical_scale, fixed horizontal_shear, fixed vertical_shear, bool horizontal_flip, bool vertical_flip) constexpr
Constructor.

Public functions

auto rotation_angle() const -> fixed constexpr
Returns the rotation angle in degrees.
void set_rotation_angle(fixed rotation_angle) constexpr
Sets the rotation angle in degrees.
void set_rotation_angle_safe(fixed rotation_angle) constexpr
Sets the rotation angle in degrees.
auto horizontal_scale() const -> fixed constexpr
Returns the horizontal scale.
void set_horizontal_scale(fixed horizontal_scale) constexpr
Sets the horizontal scale.
auto vertical_scale() const -> fixed constexpr
Returns the vertical scale.
void set_vertical_scale(fixed vertical_scale) constexpr
Sets the vertical scale.
void set_scale(fixed scale) constexpr
Sets the scale.
void set_scale(fixed horizontal_scale, fixed vertical_scale) constexpr
Sets the scale.
auto horizontal_shear() const -> fixed constexpr
Returns the horizontal shear.
void set_horizontal_shear(fixed horizontal_shear) constexpr
Sets the horizontal shear.
auto vertical_shear() const -> fixed constexpr
Returns the vertical shear.
void set_vertical_shear(fixed vertical_shear) constexpr
Sets the vertical shear.
void set_shear(fixed shear) constexpr
Sets the shear.
void set_shear(fixed horizontal_shear, fixed vertical_shear) constexpr
Sets the shear.
auto horizontal_flip() const -> bool constexpr
Indicates if this matrix is flipped in the horizontal axis or not.
void set_horizontal_flip(bool horizontal_flip) constexpr
Sets if this matrix is flipped in the horizontal axis or not.
auto vertical_flip() const -> bool constexpr
Indicates if this matrix is flipped in the vertical axis or not.
void set_vertical_flip(bool vertical_flip) constexpr
Sets if this matrix is flipped in the vertical axis or not.
auto identity() const -> bool constexpr
Indicates if this matrix is equal to the identity matrix or not.
auto flipped_identity() const -> bool constexpr
Indicates if this matrix is equal to the identity matrix or not, ignoring flip attributes.
auto pa_register_value() const -> int constexpr
Returns the value to commit to the first GBA register of an affine transformation matrix with these attributes.
auto pb_register_value() const -> int constexpr
Returns the value to commit to the second GBA register of an affine transformation matrix with these attributes.
auto pc_register_value() const -> int constexpr
Returns the value to commit to the third GBA register of an affine transformation matrix with these attributes.
auto pd_register_value() const -> int constexpr
Returns the value to commit to the fourth GBA register of an affine transformation matrix with these attributes.
void unsafe_set_register_values(int pa, int pb, int pc, int pd) constexpr
UNSAFE: sets the values to commit to the GBA registers of an affine transformation matrix bypassing the rest of the parameters.

Friends

auto operator==(const affine_mat_attributes& a, const affine_mat_attributes& b) -> bool constexpr
Equal operator.

Function documentation

bn::affine_mat_attributes::affine_mat_attributes(fixed rotation_angle, fixed horizontal_scale, fixed vertical_scale, bool horizontal_flip, bool vertical_flip) constexpr

Constructor.

Parameters
rotation_angle Rotation angle in degrees, in the range [0..360].
horizontal_scale Horizontal scale.
vertical_scale Vertical scale.
horizontal_flip Indicates if this matrix is flipped in the horizontal axis or not.
vertical_flip Indicates if this matrix is flipped in the vertical axis or not.

bn::affine_mat_attributes::affine_mat_attributes(fixed rotation_angle, fixed horizontal_scale, fixed vertical_scale, fixed horizontal_shear, fixed vertical_shear, bool horizontal_flip, bool vertical_flip) constexpr

Constructor.

Parameters
rotation_angle Rotation angle in degrees, in the range [0..360].
horizontal_scale Horizontal scale.
vertical_scale Vertical scale.
horizontal_shear Horizontal shear.
vertical_shear Vertical shear.
horizontal_flip Indicates if this matrix is flipped in the horizontal axis or not.
vertical_flip Indicates if this matrix is flipped in the vertical axis or not.

void bn::affine_mat_attributes::set_rotation_angle(fixed rotation_angle) constexpr

Sets the rotation angle in degrees.

Parameters
rotation_angle Rotation angle in degrees, in the range [0..360].

void bn::affine_mat_attributes::set_rotation_angle_safe(fixed rotation_angle) constexpr

Sets the rotation angle in degrees.

Parameters
rotation_angle Rotation angle in degrees, in any range.

void bn::affine_mat_attributes::set_scale(fixed horizontal_scale, fixed vertical_scale) constexpr

Sets the scale.

Parameters
horizontal_scale Horizontal scale.
vertical_scale Vertical scale.

void bn::affine_mat_attributes::set_shear(fixed horizontal_shear, fixed vertical_shear) constexpr

Sets the shear.

Parameters
horizontal_shear Horizontal shear.
vertical_shear Vertical shear.

void bn::affine_mat_attributes::unsafe_set_register_values(int pa, int pb, int pc, int pd) constexpr

UNSAFE: sets the values to commit to the GBA registers of an affine transformation matrix bypassing the rest of the parameters.

The rest of the parameters are not updated, so the affine transformation matrix ends in an inconsistent state.

bool operator==(const affine_mat_attributes& a, const affine_mat_attributes& b) constexpr

Equal operator.

Parameters
a First affine_mat_attributes to compare.
b Second affine_mat_attributes to compare.
Returns true if the first affine_mat_attributes is equal to the second one, otherwise false.