Nevron .NET Vision Documentation
Triangulated Surface

Triangulated Surface series can display a set of data points with custom X, Y, Z coordinates as a 3D surface. It is similar to the Mesh Surface series, the main difference being that the Triangulated Surface doesn't require the data points to be ordered in a network. The control automatically creates a triangular irregular network in order to render the surface. The following image displays a Triangulated Surface chart.




Creating a Triangulated Surface

You have to create an instance of the NTriangulatedSurfaceSeries type and add it to the series collection of the chart. Surface series can be displayed only in 3D mode, so you have to enable 3D for the chart hosting the series:

C#
Copy Code
// obtain a reference to the Cartesian chart that is created by default
NChart chart = nChartControl1.Charts[0];

// switch in 3D
chart.Enable3D = true;

// set aspect 1:1:1
chart.Width = 50;
chart.Height = 50;
chart.Depth = 50;
// set projection
chart.Projection.SetPredefinedProjection(PredefinedProjection.PerspectiveTilted);
 
// create a surface series
NTriangulatedSurfaceSeries surface = new NTriangulatedSurfaceSeries(); 
// add the series to the chart series collection
chart.Series.Add(surface);
Visual Basic
Copy Code
' obtain a reference to the Cartesian chart that is created by default
Dim chart As NChart = NChartControl1.Charts(0)
' switch in 3D
chart.Enable3D = True
' set aspect 1:1:1
chart.Width = 50
chart.Height = 50
chart.Depth = 50
' set projection
chart.Projection.SetPredefinedProjection(PredefinedProjection.PerspectiveTilted)

' create a surface series
Dim surface As New NTriangulatedSurfaceSeries 
' add the series to the chart series collection
chart.Series.Add(surface)
Passing Data

Once the Triangulated Surface series is created you can add some data in it. Triangulated Surface series use the Values data series for y (elevation) values, the XValues data series - for x position values and the ZValues data series for z (depth) position values. You should add at least three distinct points in order to display a surface.

C#
Copy Code
// point 1
surface.Values.Add(5.0);
surface.XValues.Add(3.0);
surface.ZValues.Add(1.4);

// point 2
surface.Values.Add(1.9);
surface.XValues.Add(2.0);
surface.ZValues.Add(5.1);

// point 3
surface.Values.Add(3.5);
surface.XValues.Add(2.1);
surface.ZValues.Add(4.7);
Visual Basic
Copy Code
' point 1
surface.Values.Add(5.0)
surface.XValues.Add(3.0)
surface.ZValues.Add(1.4)

' point 2
surface.Values.Add(1.9)
surface.XValues.Add(2.0)
surface.ZValues.Add(5.1)

' point 3
surface.Values.Add(3.5)
surface.XValues.Add(2.1)
surface.ZValues.Add(4.7)
Surface with Custom Colors

With the Triangulated Surface you can assign a custom color for each data point. You can add the custom colors in the Colors data series.

C#
Copy Code
surface.Colors.Add(Color.Red);
surface.Colors.Add(Color.Green);
surface.Colors.Add(Color.Blue);
Visual Basic
Copy Code
surface.Colors.Add(Color.Red)
surface.Colors.Add(Color.Green)
surface.Colors.Add(Color.Blue)

Custom colors can be used both for the surface filling and for the surface frame lines. To enable custom colors for the surface filling, you have to set the FillMode property to SurfaceFillMode.CustomColors. To enable custom colors for the surface frame lines, you have to set the FrameColorMode property to SurfaceFrameColorMode.CustomColors.

The following image displays a triangulated surface with custom colors:

Surface Simplification

The surface simplification (or clustering) feature can be used for display of large data sets. It is capable to significantly decrease the number of displayed data points, while at the same time preserves the visual representation of the surface close to the original.

The following images show a triangulated surface with 10000 data points and its simplified version.

Triangulated Surface with 10000 Data Points Simplified Surface

 

You can enable the surface clustering by setting the ClusterMode property to Enabled. The following table lists the available options:

Cluster Mode Description
Auto Clustering is automatically enabled when the number of data points exceeds the value of AutoClusterThreshold, which by default is set to 10000. This is the default setting.
Enabled Clustering is always enabled regardless of the number of data points.
Disabled Clustering is always disabled regardless of the number of data points.

 

The ClusterBranchingFactor property controls how the internal data structure that represents the cluster grows when you add data points. Higher values for this property will reduce the memory footprint of the cluster, but will slow down the building speed and vice versa. By default this property is set to 10.

The ClusterDistanceFactor property controls the maximum distance between two data points if they are to be merged in a cluster. By default this property is set to 0.01, meaning that the cluster will roughly approximate each hundred points with a single point on a screen (the actual number of cluster points is not guaranteed and depends on the density of the data in different regions of the model space). Higher values for this property will diminish the number of visual points, but will decrease the precision of the resulting surface and vice versa.

The following code snippet shows how to enable clustering and to modify the default precision of the cluster:

C#
Copy Code

NTriangulatedSurfaceSeries surface = new NTriangulatedSurfaceSeries();

surface.ClusterMode = ClusterMode.Enabled;
surface.ClusterDistanceFactor = 0.005;

Visual Basic
Copy Code

Dim surface As New NTriangulatedSurfaceSeries

surface.ClusterMode = ClusterMode.Enabled
surface.ClusterDistanceFactor = 0.005

Isolines

The triangulated surface series can display lines with specified elevation and stroke style (isolines). The following code shows how to display an isoline at some value:

C#
Copy Code

NSurfaceIsoline isoline = new NSurfaceIsoline();

isoline.Value = 10;
isoline.StrokeStyle = new NStrokeStyle(1, Color.Red);

triangulatedSurface.Isolines.Add(isoline);

Visual Basic
Copy Code

Dim isoline As New NSurfaceIsoline

isoline.Value = 10
isoline.StrokeStyle = New NStrokeStyle(1, Color.Red)

triangulatedSurface.Isolines.Add(isoline)

Related Examples

Windows forms: Chart Gallery\Mesh Surface\...

Wpf: Chart Gallery\Mesh Surface\...

Web Forms: Chart Gallery\Mesh Surface\...

See Also

 

 


©2017. Nevron Software LLC.

Send Feedback