BlinkenArea - GitList
Repositories
Blog
Wiki
libetherpix
Code
Commits
Branches
Tags
Search
Tree:
5bca604
Branches
Tags
master
libetherpix
simulator
transform.h
implement drawing pixels
Stefan Schuermans
commited
5bca604
at 2017-06-10 23:09:20
transform.h
Blame
History
Raw
/* * EtherPix simulator * * Copyright 2017 Stefan Schuermans <stefan schuermans info> * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, version 3 of the License. * * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ #ifndef TRANSFORM_H #define TRANSFORM_H #include "bbox.h" /// coordinate transformation class Transform { public: /** * @brief constructor * @param[in] bb boundig box of input coordinates * @param[in] width width of output coordinate speace (left to right) * @param[in] height height of output coordinate space (top to bottom) */ Transform(BBox const &bb, double width, double height); /// check if initialized bool checkInit() const { return m_init; } /** * @brief apply transformation * @param[in] in_x input x coordinate * @param[in] in_y input y coordinate * @param[out] out_x output x coordinate * @param[out] out_y output y coordinate */ void apply(double in_x, double in_y, double &out_x, double &out_y) const; /** * @brief apply zoom * @param[in] in_r input radius * @param[out] out_r output radius */ void applyZoom(double in_r, double &out_r) const; protected: bool m_init; ///< initialization flag, false means no transformation data double m_zoom; ///< zoom factor (use negative for y direction) double m_shift_x; ///< shift in x direction double m_shift_y; ///< shift in y direction }; #endif // #ifndef TRANSFORM_H