Loading...
Searching...
No Matches
meshkit::RasterSurface Class Reference

Immutable bilinear elevation surface over a RasterData grid. More...

#include <meshkit/raster.hpp>

Collaboration diagram for meshkit::RasterSurface:

Public Member Functions

 RasterSurface (RasterData data)
 Validate a grid and take ownership of its samples.
 
double elevation (double x, double y) const
 Bilinearly interpolate the elevation at one XY point.
 
RasterQuery query (const Point2 *triangle, const double *z) const
 Bound the deviation between this surface and the plane through a triangle.
 
Providers providers (std::string identity={}) const
 Package this surface as job terrain providers.
 
const RasterData & data () const
 The shared samples; valid while this object exists and is not reassigned.
 

Detailed Description

Immutable bilinear elevation surface over a RasterData grid.

Copies share one immutable sample buffer, so copying is cheap and const member functions modify no shared state. NaN samples are unknown and are never interpolated across.

Constructor & Destructor Documentation

◆ RasterSurface()

meshkit::RasterSurface::RasterSurface ( RasterData data)
explicit

Validate a grid and take ownership of its samples.

Parameters
[in]dataGrid moved into shared immutable storage.
Exceptions
std::invalid_argumentWhen columns or rows is below 2, heights.size() differs from columns * rows, a spacing is not positive and finite, origin is not finite, maximumCellsPerQuery is 0, or the far corner node is not finite.
Here is the call graph for this function:

Member Function Documentation

◆ data()

const RasterData & meshkit::RasterSurface::data ( ) const
inline

The shared samples; valid while this object exists and is not reassigned.

◆ elevation()

double meshkit::RasterSurface::elevation ( double x,
double y ) const

Bilinearly interpolate the elevation at one XY point.

Parameters
[in]xX in the grid's XY units.
[in]yY in the grid's XY units.
Returns
Elevation in Z units; NaN outside the closed node extent or for nonfinite input. A NaN supporting node gives NaN (an infinite one a nonfinite result).

◆ providers()

Providers meshkit::RasterSurface::providers ( std::string identity = {}) const

Package this surface as job terrain providers.

Sets elevation, terrainWitness and terrainBound; maximumSize and cancelled stay empty. Each callback holds its own copy of this surface, so it remains usable after this object is destroyed. terrainWitness and terrainBound return query()'s bound (writing the witness through a non-null point argument) or NaN when the query is not valid. When it is resource-limited they throw native_detail::Stop (code raster_work_limit, status ResourceLimit), not a std::exception; the native job reports it as a failure.

Parameters
[in]identityCaller-supplied dataset/version identity copied into the result.
Returns
Owned provider set.
Here is the call graph for this function:

◆ query()

RasterQuery meshkit::RasterSurface::query ( const Point2 * triangle,
const double * z ) const

Bound the deviation between this surface and the plane through a triangle.

The triangle is clipped against every grid cell in its bounding range; the residual is evaluated at each clipped polygon's vertices and at the interior extremum of each clipped edge, where the maximum of a bilinear-minus-linear function over a convex polygon lies.

Parameters
[in]triangleThree borrowed XY corners, counterclockwise; not retained.
[in]zThree borrowed corner elevations in Z units, in the same order.
Returns
valid with bound, witness and cells on success. Not valid when an input is nonfinite, the triangle's bounding box leaves the node extent, the triangle is not strictly counterclockwise, the plane slope is nonfinite, an overlapped cell has a nonfinite node, or no cell overlaps with nonzero area. resourceLimited (and not valid) when the cell range exceeds RasterData::maximumCellsPerQuery.
Here is the call graph for this function:

The documentation for this class was generated from the following files: