VectSharp 2.6.1
A light library for C# vector graphics
All Classes Namespaces Functions Variables Enumerations Properties Events Pages
VectSharp.Plots.Function2DGrid Class Reference

Represents a function of two variables that has been sampled in some points. More...

Public Types

enum  GridType
 Describes the arrangement of the points that have been sampled. More...
 

Public Member Functions

 Function2DGrid (IReadOnlyList< IReadOnlyList< double > > dataPoints)
 Create a new Function2DGrid from a list of sampled values. More...
 
 Function2DGrid (Func< double[], double > function, double minX, double minY, double maxX, double maxY, int stepsX, int stepsY, GridType type)
 Create a new Function2DGrid by sampling the provided function. More...
 
Function2DGrid ToRectangular ()
 Converts a hexagonal grid into a rectangular grid. More...
 

Properties

IReadOnlyList< IReadOnlyList< double > > DataPoints [get]
 The points where the function has been sampled. More...
 
double MinX [get]
 The minimum X value that has been sampled. More...
 
double MaxX [get]
 The maximum X value that has been sampled. More...
 
double MinY [get]
 The minimum Y value that has been sampled. More...
 
double MaxY [get]
 The maximum Y value that has been sampled. More...
 
double MinZ [get]
 The minimum value that has been obtained for the function. More...
 
double MaxZ [get]
 The maximum value that has been obtained for the function. More...
 
int StepsX [get]
 If the function has been sampled along a regular grid, the number of steps between MinX and MaxX on the X axis. More...
 
int StepsY [get]
 If the function has been sampled along a regular grid, the number of steps between MinY and MaxY on the X axis. More...
 
GridType Type [get]
 The type of grid. More...
 

Detailed Description

Represents a function of two variables that has been sampled in some points.

Definition at line 29 of file Function2D.cs.

Member Enumeration Documentation

◆ GridType

Describes the arrangement of the points that have been sampled.

Definition at line 34 of file Function2D.cs.

Constructor & Destructor Documentation

◆ Function2DGrid() [1/2]

VectSharp.Plots.Function2DGrid.Function2DGrid ( IReadOnlyList< IReadOnlyList< double > >  dataPoints)

Create a new Function2DGrid from a list of sampled values.

Parameters
dataPointsThe sampled values. Each element of this IReadOnlyList<T> should be a collection of three values: the X coordinate of the sampled point, the Y coordinate of the sampled point, and the value of the function at that point.

Definition at line 117 of file Function2D.cs.

◆ Function2DGrid() [2/2]

VectSharp.Plots.Function2DGrid.Function2DGrid ( Func< double[], double >  function,
double  minX,
double  minY,
double  maxX,
double  maxY,
int  stepsX,
int  stepsY,
GridType  type 
)

Create a new Function2DGrid by sampling the provided function.

Parameters
functionThe function to sample.
minXThe minimum X value at which the function should be sampled.
minYThe minimum Y value at which the function should be sampled.
maxXThe maximum X value at which the function should be sampled.
maxYThe maximum Y value at which the function should be sampled.
stepsXIf type is not GridType.Irregular, the number of steps between minX and maxX on the X axis. Otherwise, the number of sampled points is determined by multiplying stepsX and stepsY together.
stepsYIf type is not GridType.Irregular, the number of steps between minY and maxY on the Y axis. Otherwise, the number of sampled points is determined by multiplying stepsX and stepsY together.
typeThe strategy used to select points to sample. If this is GridType.Irregular, uniformly distributed random points between (minX , minY ) and (maxX , maxY ) are sampled.

Definition at line 163 of file Function2D.cs.

Member Function Documentation

◆ ToRectangular()

Function2DGrid VectSharp.Plots.Function2DGrid.ToRectangular ( )

Converts a hexagonal grid into a rectangular grid.

Returns
If Type is GridType.Rectangular, this method returns the current instance.
If Type is GridType.HexagonHorizontal or GridType.HexagonVertical, a new Function2DGrid with Type equal to GridType.Rectangular is returned. The sampled points in this grid are obtained by performing a bilinear interpolation on the sampled points from this grid. The returned grid will always be "denser" than the current instance.
If Type is GridType.Irregular, an InvalidOperationException is thrown.
Exceptions
InvalidOperationExceptionThrown if Type is GridType.Irregular.

Definition at line 322 of file Function2D.cs.

Property Documentation

◆ DataPoints

IReadOnlyList<IReadOnlyList<double> > VectSharp.Plots.Function2DGrid.DataPoints
get

The points where the function has been sampled.

Definition at line 62 of file Function2D.cs.

◆ MaxX

double VectSharp.Plots.Function2DGrid.MaxX
get

The maximum X value that has been sampled.

Definition at line 72 of file Function2D.cs.

◆ MaxY

double VectSharp.Plots.Function2DGrid.MaxY
get

The maximum Y value that has been sampled.

Definition at line 82 of file Function2D.cs.

◆ MaxZ

double VectSharp.Plots.Function2DGrid.MaxZ
get

The maximum value that has been obtained for the function.

Definition at line 92 of file Function2D.cs.

◆ MinX

double VectSharp.Plots.Function2DGrid.MinX
get

The minimum X value that has been sampled.

Definition at line 67 of file Function2D.cs.

◆ MinY

double VectSharp.Plots.Function2DGrid.MinY
get

The minimum Y value that has been sampled.

Definition at line 77 of file Function2D.cs.

◆ MinZ

double VectSharp.Plots.Function2DGrid.MinZ
get

The minimum value that has been obtained for the function.

Definition at line 87 of file Function2D.cs.

◆ StepsX

int VectSharp.Plots.Function2DGrid.StepsX
get

If the function has been sampled along a regular grid, the number of steps between MinX and MaxX on the X axis.

Definition at line 98 of file Function2D.cs.

◆ StepsY

int VectSharp.Plots.Function2DGrid.StepsY
get

If the function has been sampled along a regular grid, the number of steps between MinY and MaxY on the X axis.

Definition at line 104 of file Function2D.cs.

◆ Type

GridType VectSharp.Plots.Function2DGrid.Type
get

The type of grid.

Definition at line 109 of file Function2D.cs.


The documentation for this class was generated from the following file: