FunctionSampler

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

Constructors

FunctionSampler

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

FunctionSampler

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

Properties

Function

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

Level

#
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.

public int Level { get; }

X0

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

X1

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

Y0

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

Y1

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

Methods

ComputeNextSampling

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

GraphSegments

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

GraphSegments

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