FunctionSampler

public sealed class FunctionSampler
A utility class for creating a visual sampling of a function.

Constructors

FunctionSampler

#
public FunctionSampler(double x0, double x1, double y0, double y1, int samples, Func<double, double> function)
Create a new sampler based on an evaluation delegate.
x0 (double)Lowest x value for sampling region.
x1 (double)Highest x value for sampling region.
y0 (double)Lowest y value visible within sampling region.
y1 (double)Highest y value visible within sampling region.
samples (int)Number of samples required. This is usually the number of visible pixels.
function (Func<double, double>)Delegate.

FunctionSampler

#
public FunctionSampler(double x0, double x1, double y0, double y1, int samples, Function function)
Create a new sampler based on an IFunction.
x0 (double)Lowest x value for sampling region.
x1 (double)Highest x value for sampling region.
y0 (double)Lowest y value visible within sampling region.
y1 (double)Highest y value visible within sampling region.
samples (int)Number of samples required. This is usually the number of visible pixels.
function (Function)Function.

Properties

Function

#
public Func<double, double> Function { get; }
Gets the sampling function.

Level

#
public int Level { get; }
Gets the level of sampling density currently available.

Negative or zero means no samples have been computed at all.

A positive integer indices every nth sample has been computed.

X0

#
public double X0 { get; }
Left most edge of the sampling region.

X1

#
public double X1 { get; }
Rightmost edge of the sampling region.

Y0

#
public double Y0 { get; }
Bottom edge of the sampling region.

Y1

#
public double Y1 { get; }
Top edge of the sampling region.

Methods

ComputeNextSampling

#
public TimeSpan ComputeNextSampling()
Compute the next level sampling density.
Time it took to compute this sampling. If no additional sampling was performed, this method returns TimeSpan.Zero

GraphSegments

#
public IEnumerable<Point2d[]> GraphSegments()
Iterate over all defined stretches of samples. Think of these as the graph segments.
A collection of zero or more segments, each containing one or more points.

GraphSegments

#
public IEnumerable<PointF[]> GraphSegments(RectangleF frame)
Iterate over all defined stretches of samples. Think of these as the graph segments.
frame (RectangleF)Visible frame for mapping the samples into.
A collection of zero or more segments, each containing one or more points.