geomc 1.0
A c++ linear algebra template library
|
An M-dimensional grid of interpolated data which can be continuously sampled. More...
#include <geomc/function/Raster.h>
Public Types | |
typedef PointType< I, M >::point_t | coord_t |
Type of sample location. I if M is 1, otherwise Vec<I,M> . | |
typedef PointType< index_t, M >::point_t | grid_t |
Type for indexing data, i.e. a grid coordinate. index_t if M is 1, Vec<index_t,M> otherwise. | |
typedef PointType< O, N >::point_t | sample_t |
Type of resultant data. O if N is 1, otherwise Vec<O,N> . | |
Public Member Functions | |
Raster (const grid_t &dims) | |
Raster (const grid_t &dims, const Rect< I, M > &domain) | |
Raster (const grid_t &dims, const O *src_data) | |
Raster (const grid_t &dims, const O *src_data, const Rect< I, M > &domain) | |
void | setAbyss (sample_t val) |
void | set (const grid_t &idx, const sample_t &val) |
template<EdgeBehavior Edge> | |
void | copy (sample_t *dest, const Rect< index_t, M > ®ion) const |
void | copy (sample_t *dest, const Rect< index_t, M > ®ion, EdgeBehavior edge) const |
template<EdgeBehavior Edge, Interpolation Interp> | |
sample_t | sample (const coord_t &pt) const |
sample_t | sample (const coord_t &pt, EdgeBehavior edge=EDGE_CLAMP, Interpolation interp=INTERP_LINEAR) const |
template<EdgeBehavior Edge> | |
sample_t | sample_discrete (const grid_t &pt) const |
sample_t | sample_discrete (const grid_t &pt, EdgeBehavior edge) const |
bool | contains_gridpt (const grid_t &idx) const |
grid_t | dataExtents () const |
Rect< I, M > | domain () const |
index_t | inputDimension () const |
index_t | outputDimension () const |
index_t | samplecount () const |
Protected Member Functions | |
coord_t | toGridSpace (const coord_t &pt) const |
template<EdgeBehavior Edge> | |
index_t | index (const grid_t &c) const |
Protected Attributes | |
grid_t | m_extent |
index_t | m_size |
boost::shared_array< O > | m_data |
sample_t | m_abyss |
Rect< I, M > | m_domain |
An M-dimensional grid of interpolated data which can be continuously sampled.
I | Domain data type. |
O | Range data type. |
M | Domain dimension. |
N | Range dimension. |
In other words, a function of IM → ON.
Rasters have two coordinate systems: Indexing space and sampling space. In indexing space, the stored sample values may be accessed and changed using integer grid coordinates, analogous to a multi-dimensional array.
Rasters may also be sampled continuously, and intermediate values between sample points will be generated via interpolation. The domain of sampling space may be specified by the user, and sampling coordinates will be renormalized to this region. If no domain is specified, sampling space is equal to indexing space (with the addition that intermediate values may be sampled). The user-specified domain has no effect on indexing space.
Some functions are overloaded to have some arguments as template parameters. This allows some low-level sampling code to be inlined which can improve speed by as much as 15%. The traditional function-argument versions are available for when the parameters must be chosen at runtime.
Construct a raster with dims
elements along each axis. The sampling domain will be constructed such that the lower extreme is at the origin and sample points are placed at integer coordinates.
dims | Number of samples along each axis. |
Construct a raster with dims
elements along each axis.
dims | Number of samples along each axis. |
domain | Desired boundary of the data region. The lower and upper coordinates correspond to the exact coordinates of the most extreme data points along each axis. |
Construct a Raster with dims
elements along each axis. Fill the raster with the data in src_data
. src_data
must have enough elements to fill the raster completely; in other words, the length of src_data
must be the product of the elements of dims
. The domain will be constructed to align with the sample grid coordinates; in other words, the lowest extreme is at the origin and sample points are placed at integer coordinates.
dims | Number of samples along each axis. |
src_data | Data to copy into this raster. |
Construct a Raster with dims
elements along each axis. Fill the raster with the data in src_data
. src_data
must have enough elements to fill the raster completely; in other words, the length of src_data
must be the product of the elements of dims
.
dims | Number of samples along each axis. |
src_data | Data to copy into this raster. |
domain | Desired boundary of the data region. The lower and upper coordinates correspond to the exact coordinates of the most extreme data points along each axis. |
|
inline |
true
if the grid location idx
is within the bounds of this raster and has data, false
otherwise. Copy the data in region
into the array dest
, in row-major (first dimension consecutive) order. Templated over edge sampling behavior.
Edge | Edge sampling behavior. |
dest | Destination array. |
region | Grid region of this Raster to copy from. |
|
inline |
Copy the data in region
into the array dest
, in row-major (first dimension consecutive) order. Dynamic edge sampling behavior.
dest | Destination array. |
region | Grid region of this raster to copy from. |
edge | Edge sampling behavior. |
|
inline |
Number of samples along each axis.
|
inline |
Boundary of the data region; upper and lower coordinates correspond exactly to the coordinates of the most extreme sample positions along each axis.
|
inline |
Number of input dimensions.
|
inline |
Number of output dimensions.
Sample this Raster at pt
.
Edge | Edge sampling behavior. |
Interp | Sample interpolation strategy. |
pt | Point to sample. |
|
inline |
Sample this Raster at pt
.
pt | Point to sample. |
edge | Edge sampling behavior. |
interp | Sample interpolation strategy. |
Retrieve the data at discrete grid location pt
.
Edge | sampling behavior. |
pt | Grid location to sample. |
pt
.
|
inline |
Retrieve the data at discrete grid location pt
.
pt | Grid location to sample. |
edge | Edge sampling behavior. |
pt
.
|
inline |
Number of grid sample points in this raster.
Set the value of the raster at the grid coordinate idx
.
idx | Coordinate of datapoint to set. |
val | New value of datapoint. |
|
inline |
Set the sample value to be used for "out-of-bounds" samples when EDGE_CONSTANT
behavior is used.