Debian Codegraph @

thirdparty/msdfgen/core/Projection.cpp

raw symbols SCIP
1
2 #include "Projection.h"
3
4 namespace msdfgen {
5
6 Projection::Projection() : scale(1), translate(0) { }
7
8 Projection::Projection(const Vector2 &scale, const Vector2 &translate) : scale(scale), translate(translate) { }
9
10 Point2 Projection::project(const Point2 &coord) const {
11 return scale*(coord+translate);
12 }
13
14 Point2 Projection::unproject(const Point2 &coord) const {
15 return coord/scale-translate;
16 }
17
18 Vector2 Projection::projectVector(const Vector2 &vector) const {
19 return scale*vector;
20 }
21
22 Vector2 Projection::unprojectVector(const Vector2 &vector) const {
23 return vector/scale;
24 }
25
26 double Projection::projectX(double x) const {
27 return scale.x*(x+translate.x);
28 }
29
30 double Projection::projectY(double y) const {
31 return scale.y*(y+translate.y);
32 }
33
34 double Projection::unprojectX(double x) const {
35 return x/scale.x-translate.x;
36 }
37
38 double Projection::unprojectY(double y) const {
39 return y/scale.y-translate.y;
40 }
41
42 }