Interpolation.Circular Method
Performs circular/angular linear interpolation at a single point.
Definition
Namespace: Numerics.NET
Assembly: Numerics.NET (in Numerics.NET.dll) Version: 10.0.0
C#
The interpolated angle at x (in the same units as angles).
Assembly: Numerics.NET (in Numerics.NET.dll) Version: 10.0.0
public static double Circular(
double[] xValues,
double[] angles,
double x,
bool isDegrees = false
)Parameters
- xValues Double[]
- The x-coordinates of the data points. Must be strictly increasing.
- angles Double[]
- The angular y-coordinates of the data points (in radians by default).
- x Double
- The x-coordinate at which to interpolate.
- isDegrees Boolean (Optional)
- If true, angles are in degrees; otherwise, radians.
Return Value
DoubleThe interpolated angle at x (in the same units as angles).
Remarks
This method performs linear interpolation on circular/angular data by unwrapping the angles to minimize discontinuities and then wrapping the result back to the standard range.
Note: This method creates an internal PiecewiseInterpolatingCurve object for evaluation. This method should only be used for one-off calculations. For repeated evaluations on the same data, use CircularLinearCurve(ReadOnlySpan<Double>, ReadOnlySpan<Double>, Boolean) to create a reusable curve object, which will be more efficient.
Exceptions
| Argument | xValues or angles is null. |
| Argument | xValues and angles have different lengths, or contain fewer than 2 elements. |
| Argument | x is outside the range of xValues. |