GridBoundaryCondition Structure

Describes how grid boundaries are handled when sampling outside the nominal index range during interpolation stencil assembly (used by tensor-product splines).

Definition

Namespace: Numerics.NET.Curves.Surfaces
Assembly: Numerics.NET (in Numerics.NET.dll) Version: 10.1.0
C#
public readonly struct GridBoundaryCondition
Inheritance
Object  →  ValueType  →  GridBoundaryCondition

Remarks

Boundary conditions control how tensor-product grid surfaces access grid values when building local interpolation stencils that extend beyond the grid extent. For example, a 4-point cubic kernel near the grid edge may require samples at indices i=-1 or i=N (outside the valid range [0, N-1]). The boundary condition determines how these out-of-range indices are mapped to valid values.

Distinction from ExtrapolationMode:

  • GridBoundaryCondition (this type): Applies during construction/evaluation when the interpolation kernel needs to access grid values outside the nominal index range [0, N-1]. It affects how the stencil is assembled.
  • ExtrapolationMode: Applies during query evaluation when a query coordinate falls outside the grid domain. It controls whether to throw an exception, return a fill value, clamp to boundaries, or use periodic/reflective coordinate mapping.

Usage: Boundary conditions are primarily used by tensor-product spline interpolation (via CreateCubicTensorSpline(IReadOnlyList<IReadOnlyList<Double>>, IReadOnlyList<Double>, GridBoundaryCondition, ExtrapolationMode) and CreateTensorSpline(IReadOnlyList<IReadOnlyList<Double>>, IReadOnlyList<Double>, ISplineKernel1D, GridBoundaryCondition, ExtrapolationMode)). The specialized 2D/3D cubic surfaces (created with [!:GridSurface.CreateCubic(Vector<double>, Vector<double>, Matrix<double>)]) do not use GridBoundaryCondition; their boundary behavior is determined by the CubicSplineKind used internally (always Natural in current implementation).

Available boundary conditions:

  • Clamp (default): Clamp out-of-range indices to the nearest edge (repeat edge values).
  • Periodic: Wrap indices periodically using modulo arithmetic (for periodic data such as angles).
  • Reflect: Mirror indices at boundaries for symmetric extension (useful for even functions).
  • Fill(Double): Use a constant fill value for out-of-range samples (isolates edges).

Properties

Clamp Gets a boundary condition that clamps out-of-range indices to the nearest edge.
Periodic Gets a boundary condition that wraps indices periodically using modulo arithmetic.
Reflect Gets a boundary condition that mirrors indices at the boundaries for symmetric extension.
Value Gets the value used when the boundary condition is Fill(Double). Ignored for all other boundary condition types.

Methods

EqualsIndicates whether this instance and a specified object are equal.
(Inherited from ValueType)
Fill Creates a boundary condition that uses a constant fill value for out-of-range samples.
GetHashCodeReturns the hash code for this instance.
(Inherited from ValueType)
GetTypeGets the Type of the current instance.
(Inherited from Object)
ToStringReturns the fully qualified type name of this instance.
(Inherited from ValueType)

See Also