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 File Reference

Inverse-zoom helpers for screen-pixel-sized geometry. More...

Go to the source code of this file.

Namespaces

namespace  OpenSWMM
 
namespace  OpenSWMM::Render
 

Functions

constexpr double OpenSWMM::Render::sceneSizeFromPixels (double pixelSize, double pixelsPerSceneUnit) noexcept
 Convert a screen-pixel size to a scene-space offset.
 
constexpr double OpenSWMM::Render::pixelsFromSceneSize (double sceneSize, double pixelsPerSceneUnit) noexcept
 Inverse of sceneSizeFromPixels — convert a scene-space offset back to its on-screen pixel size at the current zoom.
 

Detailed Description

Inverse-zoom helpers for screen-pixel-sized geometry.

Author
Caleb Buahin caleb.nosp@m..bua.nosp@m.hin@g.nosp@m.mail.nosp@m..com
Date
2026
License\n GPL-3.0-or-later
    Plan reference: RENDERING_OUTPUT_SUBLAYERS_PLAN.md §2 Decision 2
    and §3 (SublayerContext carries pixelsPerSceneUnit so sublayer
    buildOrUpdateNode() implementations can emit screen-pixel-sized
    vertices regardless of zoom).

    Pixels-per-scene-unit is the absolute scale factor on the X-axis
    of the view matrix (`|m11|`). When the user zooms in by 2×,
    pixelsPerSceneUnit doubles; the same on-screen pixel size becomes
    a smaller scene-space offset.

    All functions are constexpr / noexcept / pure-numeric so they
    pull in no Qt headers. Keep this header dependency-free so it
    can be included from the tightest QSG inner loops.