Loading...
Searching...
No Matches
raster.hpp
Go to the documentation of this file.
1// SPDX-License-Identifier: Apache-2.0
2#pragma once
3#include "job.hpp"
4#include <memory>
5namespace meshkit
6{
13struct RasterData {
15 std::uint32_t columns = 0, rows = 0;
21 double xSpacing = 1, ySpacing = 1;
25 std::vector<double> heights; // Row-major node samples, NaN = unknown.
27 std::uint64_t maximumCellsPerQuery = 4000000;
28};
29
36 bool valid = false, resourceLimited = false;
42 double bound = 0;
48 std::uint64_t cells = 0;
49};
50// Immutable native bilinear surface. Providers share storage and perform no
51// Python/GDAL calls. The certificate concerns this surface, not physical DEM
52// accuracy. Every intersected grid cell must have four finite node samples.
60{
61 std::shared_ptr<const RasterData> data_;
62
63public:
79 double elevation(double x, double y) const;
94 RasterQuery query(const Point2 *triangle, const double *z) const;
107 Providers providers(std::string identity = {}) const;
109 const RasterData &data() const { return *data_; }
110};
111}
Point or displacement vector in the horizontal (XY) plane.
Definition geometry.hpp:21
Providers providers(std::string identity={}) const
Package this surface as job terrain providers.
Definition raster.cpp:156
const RasterData & data() const
The shared samples; valid while this object exists and is not reassigned.
Definition raster.hpp:109
double elevation(double x, double y) const
Bilinearly interpolate the elevation at one XY point.
Definition raster.cpp:18
RasterSurface(RasterData data)
Validate a grid and take ownership of its samples.
Definition raster.cpp:7
RasterQuery query(const Point2 *triangle, const double *z) const
Bound the deviation between this surface and the plane through a triangle.
Definition raster.cpp:33
The Qt-free MeshKit library: job events and progress (meshkit::runtime), the neutral mesh model,...
Optional caller callbacks used by runJob(), plus the provider identity.
Definition job.hpp:204
Regular grid of elevation samples at nodes, in the mesh's XY and Z units.
Definition raster.hpp:13
std::uint32_t rows
Node count along Y; must be >= 2.
Definition raster.hpp:15
double ySpacing
Node spacing along Y in XY units; must be positive and finite.
Definition raster.hpp:21
Point2 origin
XY position of node (0, 0), the minimum-x, minimum-y corner; must be finite.
Definition raster.hpp:19
std::vector< double > heights
Z-unit samples; size columns * rows, node (i, j) at index j * columns + i.
Definition raster.hpp:25
std::uint64_t maximumCellsPerQuery
Most grid cells one query may visit (cells in the triangle's bounding range); nonzero.
Definition raster.hpp:27
double xSpacing
Node spacing along X in XY units; must be positive and finite.
Definition raster.hpp:21
std::uint32_t columns
Node (not cell) count along X; must be >= 2.
Definition raster.hpp:15
Result of RasterSurface::query() for one triangle.
Definition raster.hpp:34
bool valid
True when bound certifies the whole triangle; false for any refusal (see query()).
Definition raster.hpp:36
bool resourceLimited
True when the cell range exceeded RasterData::maximumCellsPerQuery; valid is then false.
Definition raster.hpp:36
std::uint64_t cells
Grid cells whose overlap with the triangle has nonzero area (partial if the query stopped at a nonfin...
Definition raster.hpp:48
double bound
Upper bound, in Z units, on |bilinear surface - triangle plane| over the triangle,...
Definition raster.hpp:42
Point2 witness
XY point where the largest residual was sampled; the triangle's first corner when no sample exceeded ...
Definition raster.hpp:45