public override void Do(IDemoChartControl chartControl) { var random = new Random(DateTime.Now.Millisecond); // Generate demo structured surface. Vector3F[] positions = DemoHelper.GenerateSinPoints(size); // Randomly remove points from that grid for irregular grid, only 30% will be taken from original grid. Vector3F[] irregularPositions = positions.Where(t => random.NextDouble() > 0.7).ToArray(); // Surface data presentation creation. var surface = new ValueSurface { // Reader can be reused and we can create several presentations for 1 reader. // Note: this reader provider default implementation, so feel free to implement your own logic. Reader = new IrregularValueSurfaceDataReader( irregularPositions, // Define surface points. DemoHelper.ExtractZValues(irregularPositions, out OneAxisBounds valueBounds), // Surface values, here they are equal to Z values . 2, // As data is irregular in 2D space we should specify exclude axis index for triangulation. valueBounds), //Value axis bounds. // Setup presentation option. PresentationType = ValueSurfacePresentationType.SolidAndWireframe, // Set name. Name = "Surface" }; // Setup chart options. chartControl.Axes.IsAxes3DVisible = true; chartControl.ContextView.Camera2D.Projection = Projection2DTypes.XPosYPos; // Set data source. chartControl.DataSource = surface; } }
public override void Do(IDemoChartControl chartControl) { // Generate positions. Vector3F[] positions = DemoHelper.GenerateSinPoints(MapSize); // Creation of surface data presentation. var surface = new ValueSurface { // Data reader approach is used to improve performance for big data sets and their updates. Reader = new StructuredValueSurfaceDataReader( positions, // Surface positions. DemoHelper.ExtractZValues(positions, out OneAxisBounds valueBounds), // Surface values, for demo purposes values are extracted from Z position component, but in real world they are independent, size of array should be the same as for positions. MapSize, // Width and height are required for triangulation of structured grid. MapSize, valueBounds), //Bounds of value axes. // Set presentation option. PresentationType = ValueSurfacePresentationType.SolidAndWireframe, // Set name. Name = "Surface" }; // Setup chart options. chartControl.Axes.IsAxes3DVisible = true; // Setup chart data source. chartControl.DataSource = surface; } }
public override void Do(IDemoChartControl chartControl) { // Generate positions. var positions = new Vector3F[PointsCount]; for (int i = 0; i < PointsCount; i++) { positions[i] = new Vector3F( (float)Random.NextDouble() * MaxRadius, (float)Random.NextDouble() * MaxRadius, (float)Random.NextDouble() * MaxRadius); } // Creation of data presentation. var points = new ValuePoints { // Reader can be reused and we can create several presentations for 1 reader. Reader = new DefaultPositionValueMaskDataReader( positions, // Points positions. DemoHelper.ExtractZValues(positions, out OneAxisBounds valueBounds), // Points values, for demo purposes values are extracted from Z position component, but in real world they are independent. valueBounds), // We must specify value axis bounds. // Set name. Name = "Points" }; // Setup chart options. chartControl.Axes.IsAxes3DVisible = true; // Set chart data source. chartControl.DataSource = points; } }
public override void Do(IDemoChartControl chartControl) { // Generate vertex positions. Vector3F[] positions = DemoHelper.GenerateSinPoints(Resolution); // Generates initial values (for this case extract it as Z coordinates of positions). initialValues = DemoHelper.ExtractZValues(positions, out OneAxisBounds valueRange); // Current values storage. var currentValues = new float[initialValues.Length]; Array.Copy(initialValues, currentValues, initialValues.Length); // Create value surface data reader. var reader = new StructuredValueSurfaceDataReader(positions, currentValues, Resolution, Resolution, valueRange); // Create value surface presentation data. var valueSurface = new ValueSurface { // Set data reader. Reader = reader, // Set presentation type. PresentationType = ValueSurfacePresentationType.Solid, // Set name. Name = "Surface" }; // Setup chart options. chartControl.Axes.IsAxes3DVisible = true; chartControl.ContextView.Mode2D = false; chartControl.ContextView.Camera2D.Projection = Projection2DTypes.XPosYPos; // Set chart data source. chartControl.DataSource = valueSurface; // Start animation. animationHelper.Start( argument => argument, argument => { // Generates new values and update reader with it. float[] randomizedValues = GenerateValues(argument, reader.ValueRange); reader.UpdateValues(randomizedValues, 0, reader.VertexCount, 0); }, 0, 0.025f * ((float)UpdateInterval / 16), UpdateInterval); }
public override void Do(IDemoChartControl chartControl) { // We take the same data as for surfaces for demo purposes, in current case it contains redundant x, y values. Vector3F[] xyzPoints = DemoHelper.GenerateSinPoints(Resolution); // Extract only values from z array. float[] values = DemoHelper.ExtractZValues(xyzPoints); // Create geometry. var geometry = new RectTextureGeometry { Origin = Vector3F.Zero, DirectionX = Vector3F.UnitX, DirectionY = Vector3F.UnitY, Size = new Vector2F(1f, 1f) }; var rasterData = new ValueRasterData { // Linear interpolation. InterpolationType = RasterDataInterpolationType.Linear, // Float data reader specification (values, data stride/width and value axis bounds). Reader = new FloatIntensityImage2DReader(values, Resolution, new OneAxisBounds(-1f, 1f)), // Set geometry. Geometry = geometry, // Set name. Name = "Surface" }; // Setup view settings. chartControl.ContextView.Mode2D = true; chartControl.ContextView.Camera2D.Projection = Projection2DTypes.XPosYPos; // Set chart data source. chartControl.DataSource = rasterData; }