ILNumerics Ultimate VS

Surface Constructor (FuncSingle, Single, Single, Single, Single, Int32, Single, Single, Int32, FuncSingle, Single, Single, TupleSingle, Single, Colormap, Object)

ILNumerics Ultimate VS Documentation
ILNumerics - Technical Application Development
Creates a new surface plot from a function delegate

[ILNumerics Visualization Engine]

Namespace:  ILNumerics.Drawing.Plotting
Assembly:  ILNumerics.Drawing (in ILNumerics.Drawing.dll) Version: ILNumerics Ultimate VS 4
Syntax

public Surface(
	Func<float, float, float> ZFunc,
	float xmin = -10f,
	float xmax = 10f,
	int xlen = 50,
	float ymin = -10f,
	float ymax = 10f,
	int ylen = 50,
	Func<float, float, float> CFunc = null,
	Tuple<float, float> colorsDataRange = null,
	Colormap colormap = null,
	Object tag = null
)

Parameters

ZFunc
Type: SystemFuncSingle, Single, Single
function delegate or lambda expression for computing the Z values out of X and Y parameters
xmin (Optional)
Type: SystemSingle
[optional] minimal x axis range
xmax (Optional)
Type: SystemSingle
[optional] maximum x axis range
xlen (Optional)
Type: SystemInt32
[optional] number of steps on the x axis
ymin (Optional)
Type: SystemSingle
[optional] minimal y axis range
ymax (Optional)
Type: SystemSingle
[optional] maximum y axis range
ylen (Optional)
Type: SystemInt32
[optional] number of steps on the y axis
CFunc (Optional)
Type: SystemFuncSingle, Single, Single
[optional] function delegate or lambda expression for computing the colors for the grid point (x,y) tuples; default: colormapped heights (Z-values)
colorsDataRange (Optional)
Type: SystemTupleSingle, Single
[optional] if not null, the lower (Item1) and the upper (Item2) limit of the inherent data range of the C parameter in colormap mode. If null, the maximum and the minimum values are taken from C.
colormap (Optional)
Type: ILNumerics.Drawing.PlottingColormap
[optional] Colormap to be used for colormappings, default: 'ILNumerics'
tag (Optional)
Type: SystemObject
[optional]tag used to identify the surface within the scene graph
Remarks

The surface is constructed by evaluating ZFunc for every grid point. The optional parameters xmin, xmax and xlen define the grid points for the X axis; ymin, ymax and ylen for the Y axis accordingly. Axes generate 50 points running from -5 to 5 per default.

If either of X or Y is null, the coords are computed based on a regular spacing, starting at 0 and running along the X and Y axis with a step width of 1.

The optional CFunc parameter is used to define the coloring of each grid point. If omitted, the Z values (heights) are mapped to the current colormap. Otherwise, the CFunc is evaluated for each grid point.

The optional colormap parameter can be used to set the surfaces colormap to an individual map. If this parameter is ommitted, the predefined 'ILNumerics' colormap is taken by default.

[ILNumerics Visualization Engine]

Examples

The following example generates a surface from a lambda expression. The Z values are computed from the x,y tuples on every gridpoint from the function:
(x, y) => (float)(Math.Sin(x) * Math.Cos(y) * Math.Exp(-(x * x * y * y) / 4)

The ranges for the X and Y axes are left at their defaults. The colors are generated from the function

(x,y) => x * y

The complete scene setup:

private void ilPanel1_Load(object sender, EventArgs e) {
    var scene = new Scene() {
        new PlotCube(twoDMode: false) {
            new Surface((x, y) => (float)(Math.Sin(x) * Math.Cos(y) * Math.Exp(-(x * x * y * y) / 4)), 
                      CFunc: (x,y) => x * y, colormap: Colormaps.Jet) { 
                UseLighting = true,
                Children = { new Colorbar() },
            }
        } 
    };
    ilPanel1.Scene = scene;
}

Download this example within View and modify it interactively.

See Also

Reference