Path: blob/master/thirdparty/msdfgen/core/Projection.h
9903 views
1#pragma once23#include "Vector2.hpp"45namespace msdfgen {67/// A transformation from shape coordinates to pixel coordinates.8class Projection {910public:11Projection();12Projection(const Vector2 &scale, const Vector2 &translate);13/// Converts the shape coordinate to pixel coordinate.14Point2 project(const Point2 &coord) const;15/// Converts the pixel coordinate to shape coordinate.16Point2 unproject(const Point2 &coord) const;17/// Converts the vector to pixel coordinate space.18Vector2 projectVector(const Vector2 &vector) const;19/// Converts the vector from pixel coordinate space.20Vector2 unprojectVector(const Vector2 &vector) const;21/// Converts the X-coordinate from shape to pixel coordinate space.22double projectX(double x) const;23/// Converts the Y-coordinate from shape to pixel coordinate space.24double projectY(double y) const;25/// Converts the X-coordinate from pixel to shape coordinate space.26double unprojectX(double x) const;27/// Converts the Y-coordinate from pixel to shape coordinate space.28double unprojectY(double y) const;2930private:31Vector2 scale;32Vector2 translate;3334};3536}373839