|
QWT API (中文) 7.3.0
Qt绘图库 - 中文API文档
|
Bundles all widget resources that drawables need during rendering 更多...
#include <qwt3d_render_context.h>
Public 成员函数 | |
| QPointF | worldToScreen (const Triple &world) const |
| Projects a world-space point to screen pixel coordinates | |
| Triple | screenToWorld (const QPointF &screen) const |
| Unprojects screen pixel coordinates to a world-space point | |
| Triple | relativePosition (Triple rel) const |
| Converts a relative viewport position to world coordinates | |
Bundles all widget resources that drawables need during rendering
A value struct constructed per-call-site in Qwt3DPlot::paintGL() with the matrices, viewport, and shared shader programs current at that moment. Passed by const reference down the drawable draw chain, replacing the former Qwt3DPlot* back-pointer baked into Qwt3DDrawable (deferred smell #1, resolved).
The coordinate-conversion methods (worldToScreen, screenToWorld, relativePosition) are pure CPU math over the stored matrices and viewport — no OpenGL calls — so the context is self-contained and copyable.
Converts a relative viewport position to world coordinates
| rel | Relative position in viewport coordinates [0..1] |
Scales the relative position by the viewport dimensions to obtain screen pixel coordinates, then unprojects to world space.
| Triple Qwt3DRenderContext::screenToWorld | ( | const QPointF & | screen | ) | const |
Unprojects screen pixel coordinates to a world-space point
| screen | Screen-space point (pixel coordinates) |
Uses the inverse of the CPU-side modelView and projection matrices to unproject screen coordinates. The z-component is determined by the near plane (z=0 in NDC).
| QPointF Qwt3DRenderContext::worldToScreen | ( | const Triple & | world | ) | const |
Projects a world-space point to screen pixel coordinates
| world | World-space Triple |
Uses the CPU-side modelView and projection matrices to transform world coordinates to normalized device coordinates, then maps to viewport pixels.