SWMMVis  6.0.0-alpha.4
Qt6/C++ GIS-based graphical user interface for the SWMMVis engine (6.0.0-alpha.4)
Loading...
Searching...
No Matches
screenpixels.h
Go to the documentation of this file.
1
22#ifndef OPENSWMM_RENDER_SCREENPIXELS_H
23#define OPENSWMM_RENDER_SCREENPIXELS_H
24
25namespace OpenSWMM::Render
26{
27
43constexpr double sceneSizeFromPixels(double pixelSize,
44 double pixelsPerSceneUnit) noexcept
45{
46 return (pixelsPerSceneUnit > 0.0)
47 ? (pixelSize / pixelsPerSceneUnit)
48 : 0.0;
49}
50
58constexpr double pixelsFromSceneSize(double sceneSize,
59 double pixelsPerSceneUnit) noexcept
60{
61 return sceneSize * pixelsPerSceneUnit;
62}
63
64} // namespace OpenSWMM::Render
65
66#endif // OPENSWMM_RENDER_SCREENPIXELS_H
Definition gisrasterlayer.h:40
constexpr double sceneSizeFromPixels(double pixelSize, double pixelsPerSceneUnit) noexcept
Convert a screen-pixel size to a scene-space offset.
Definition screenpixels.h:43
constexpr double pixelsFromSceneSize(double sceneSize, double pixelsPerSceneUnit) noexcept
Inverse of sceneSizeFromPixels — convert a scene-space offset back to its on-screen pixel size at the...
Definition screenpixels.h:58