You are here: Symbol Reference > Dew Namespace > Dew.Math Namespace > Classes > Vector Structure > Vector Methods > PixelDownSample Method > Vector.PixelDownSample Method (int, TVec, int, int, TVec, TVec, TEquidistantSample)
Dew Math for .NET
ContentsIndexHome
PreviousUpNext
Vector.PixelDownSample Method (int, TVec, int, int, TVec, TVec, TEquidistantSample)

Downsamples (reduces) the number of vector elements.

Syntax
C#
Visual Basic
public void PixelDownSample(int Width, TVec Y, int Index, int Len, TVec X, TVec NX, TEquidistantSample Equidistant);

This method speeds up drawing of huge amounts of data (>> 2000 samples). You should pass your data to the PixelDownSample method before you pass the values to the Charting routine. The X and Y vectors contain the values for X and Y axis, that you would normally pass to the charting procedure. The downsampled Y is stored in the calling vector and downsampled X is stored in the NX vector. If your data is equidistant on X axis, you can omit the X vector or, if you are in doubt, allow the routine to downsample the X vector also. If your data is not equidistant on the X axis, you must indicate that by specifying the Equidistant parameter as False and provide X and NX vectors, where X containes the step on the X axis and NX will contain the downsampled result for X axis. 

With Width parameter you specify the width of the charting region in pixels. (Example: Chart.Width). The routine will reduce the number of samples in vectors Y and X in such a way that there will be no visual difference between the original and downsampled data. 

That however will no longer be true, if you will zoom-in on the data. The performance gain can be as big as 100x depending on the charting tool that you use. You can easily draw data series from vectors with length of over 1.000.000 samples in real time.

var a,b: Vector; begin a.SetIt(False,[0,0,0,1,2,3,1,2,3]); b.PixelDownSample(3,a); end;
Copyright (c) 1999-2024 by Dew Research. All rights reserved.
What do you think about this topic? Send feedback!