X-Git-Url: http://git.localhorst.tv/?a=blobdiff_plain;f=src%2Fgraphics%2FVector.h;h=50ae8c8de067b184e7d49888c7c31c457fd724ef;hb=HEAD;hp=6259b97f0cb9a78fab1b389347113b28a94e9a33;hpb=7cf057b5b3a28c3896af27cb725fbf0b4f1459c2;p=orbi.git diff --git a/src/graphics/Vector.h b/src/graphics/Vector.h index 6259b97..50ae8c8 100644 --- a/src/graphics/Vector.h +++ b/src/graphics/Vector.h @@ -198,6 +198,15 @@ constexpr Vector Norm(Vector v) { return v / Length(v); } +template +constexpr Vector MirrorX(Vector v) { + return Vector(v.x, -v.y); +} +template +constexpr Vector MirrorY(Vector v) { + return Vector(-v.x, v.y); +} + template constexpr Vector Rotate90(Vector v) { return Vector(-v.y, v.x); @@ -210,6 +219,7 @@ template constexpr Vector Rotate270(Vector v) { return Vector(v.y, -v.x); } +// angle given in radians template inline Vector Rotate(Vector v, Float by) { Float sine(std::sin(by));