QGroundControl
Ground Control Station for MAVLink Drones
Loading...
Searching...
No Matches
PatchSampler.h
Go to the documentation of this file.
1/****************************************************************************
2 *
3 * (c) 2009-2024 QGROUNDCONTROL PROJECT <http://www.qgroundcontrol.org>
4 *
5 * QGroundControl is licensed according to the terms in the file
6 * COPYING.md in the root of the source code directory.
7 *
8 ****************************************************************************/
9
10#pragma once
11
12#include <QtCore/QList>
13#include <QtCore/QVarLengthArray>
14
16#include "TileMath.h"
17
27{
28public:
34 struct EdgeStep
35 {
36 float step = 0.0f;
37 int row = 0;
38 int col = 0;
39 int ownZoom = -1;
40 int boundaryZoom = -1;
41 };
42
44 PatchSampler(const ElevationTilePyramid& pyramid, const TileMath::TileKey& key, int gridSize,
45 EdgeStep* edgeStep = nullptr);
46
48 QList<float> sample();
49
52 static double heightAtUV(const ElevationTilePyramid::Grid& grid, double u, double v);
53
54private:
55 struct BoundaryVertex
56 {
57 float height = 0.0f;
58 float mismatch = 0.0f;
59 int zoom = -1;
60 };
61
62 float _viewHeight(const ElevationTilePyramid::View& view, qint64 n, qint64 m) const;
63 BoundaryVertex _boundaryVertex(qint64 n, qint64 m, float own);
64 float _interiorCorrection(int row, int col) const;
65 void _trackEdgeStep(const QList<float>& corrections);
66 ElevationTilePyramid::View _resolveCell(qint64 cx, qint64 cy);
67 int _touchingCells(qint64 s, qint64 (&cells)[2]) const;
68
75 struct TileMemo
76 {
79 };
80
81 const ElevationTilePyramid& _pyramid;
82 const TileMath::TileKey _key;
83 const int _gridSize;
84 const int _shiftToMax;
85 const ElevationTilePyramid::View _patchView;
86 EdgeStep* const _edgeStep;
87 QVarLengthArray<TileMemo, 9> _memos;
88 QList<BoundaryVertex> _north;
89 QList<BoundaryVertex> _south;
90 QList<BoundaryVertex> _west;
91 QList<BoundaryVertex> _east;
92};
int32_t height
Definition UBXPlan.cc:44
QList< float > sample()
The (gridSize+1)^2 vertex heights, row-major from the NW corner.
static double heightAtUV(const ElevationTilePyramid::Grid &grid, double u, double v)
Decoded elevation samples for one tile, row-major from the NW corner.
int row
boundary vertex of the largest step
int boundaryZoom
zoom of the tile the boundary vertex resolved to
int ownZoom
zoom of the patch's backing tile; -1 = no data