u02/util: Simplify conditions
parent
7e8dbfabea
commit
25e159d96b
|
@ -3,18 +3,18 @@
|
||||||
#include <cmath>
|
#include <cmath>
|
||||||
|
|
||||||
void transform_mut(Transformation transformation, int &x, int &y) {
|
void transform_mut(Transformation transformation, int &x, int &y) {
|
||||||
if ((transformation & TRANSFORM_ROTATE_CW) != 0) {
|
if (transformation & TRANSFORM_ROTATE_CW) {
|
||||||
std::swap(x, y);
|
std::swap(x, y);
|
||||||
x = -x;
|
x = -x;
|
||||||
}
|
}
|
||||||
if ((transformation & TRANSFORM_ROTATE_CCW) != 0) {
|
if (transformation & TRANSFORM_ROTATE_CCW) {
|
||||||
std::swap(x, y);
|
std::swap(x, y);
|
||||||
y = -y;
|
y = -y;
|
||||||
}
|
}
|
||||||
if ((transformation & TRANSFORM_MIRROR_X) != 0) {
|
if (transformation & TRANSFORM_MIRROR_X) {
|
||||||
y = -y;
|
y = -y;
|
||||||
}
|
}
|
||||||
if ((transformation & TRANSFORM_MIRROR_Y) != 0) {
|
if (transformation & TRANSFORM_MIRROR_Y) {
|
||||||
x = -x;
|
x = -x;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -25,10 +25,10 @@ std::pair<int, int> transform(Transformation transformation, int x, int y) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void transform_inv_mut(Transformation transformation, int &x, int &y) {
|
void transform_inv_mut(Transformation transformation, int &x, int &y) {
|
||||||
if ((transformation & TRANSFORM_MIRROR_Y) != 0) {
|
if (transformation & TRANSFORM_MIRROR_Y) {
|
||||||
x = -x;
|
x = -x;
|
||||||
}
|
}
|
||||||
if ((transformation & TRANSFORM_MIRROR_X) != 0) {
|
if (transformation & TRANSFORM_MIRROR_X) {
|
||||||
y = -y;
|
y = -y;
|
||||||
}
|
}
|
||||||
if (transformation & TRANSFORM_ROTATE_CCW) {
|
if (transformation & TRANSFORM_ROTATE_CCW) {
|
||||||
|
|
Reference in New Issue