Table Of Contents

Graph IDEProgramming ► Point Map

The following is a complete script for programming a 2D Point Map Plot (Heat Map Plot). It loads a wavy heat map made from 10,000 z-values on a square grid.

/* Declarations */

double cos(double a);
double sin(double a);

@@class() PointMap:Object

@@method(public, class) (id)alloc;
@@method(public, instance) (id)init;
@@method(public, instance) (void)emptyData;
@@method(public, instance) (unsigned)animationCount;
@@method(public, instance) (void) setGridXLength:(unsigned)xLength xMinimum:(double)xMinimum xMaximum:(double)xMaximum yLength:(unsigned)yLength yMinimum:(double)yMinimum yMaximum:(double)yMaximum;
@@method(public, instance) (void) appendValue:(double)aValue;
@@method(public, instance) (void)release;

@@end

/* Execution block */

{
id myPointMap;
int ix, iy;
double xValue, yValue, aValue;
unsigned animationCount;

myPointMap = [[PointMap alloc] init];

animationCount = [myPointMap animationCount];

printf("animationCount: %d\n", animationCount);

/*
Empty the data and then append new data.
*/

[myPointMap emptyData];

[myPointMap setGridXLength:100 xMinimum:0.0 xMaximum:10.0 yLength:100 yMinimum:0.0 yMaximum:10.0];

for(iy = 0; iy < 100; iy++)
{
yValue = iy * 0.1;

for(ix = 0; ix < 100; ix++)
{
xValue = ix * 0.1;
aValue = 5.0 * cos(xValue) + 5.0 * sin(yValue);
[myPointMap appendValue:aValue];
}
}

[myPointMap release];

}

The general API is define in the section Graphic. The following is API description specific to the Point Map Plot.

@@method(public, instance) (void) setGridXLength:(unsigned)xLength xMinimum:(double)xMinimum xMaximum:(double)xMaximum yLength:(unsigned)yLength yMinimum:(double)yMinimum yMaximum:(double)yMaximum;
  Call like this:

[myPointMap setGridXLength:100 xMinimum:0.0 xMaximum:10.0 yLength:100 yMinimum:0.0 yMaximum:10.0];

Sets the grid parameters. Since the grid is rectangular and uniform these are the only parameters needed to specify the grid.

@@method(public, instance) (void) appendValue:(double)aValue;
  Call like this:

[myPointMap appendValue:aValue];

Appends aValue to the list of values. Each value must be of type double. The number of values appended should equal the grid x-length times y-length.

@@method(public, instance) (void) appendAmplitude:(double)anAmplitude angle:(double)anAngle;
  Call like this:

[myPointMap appendAmplitude:anAmplitude angle:anAngle];

Appends anAmplitude to the array of data values and anAngle to the array of angle values. Each value must be of type double and anAngle must be in units of radians. The number of amplitudes and angles appended should each independently equal the grid x-length times y-length. Notice how the unit of angle is in radians but when entering angles in the user interface the units are in degrees. In order to see the angle values (vectors) the stroke unit must be turned on in the point map graphic.

@@method(public, instance) (void)emptyData;
  Call like this:

[myPointMap emptyData];

Removes (empties) all data from the graphic. Call this right before adding new data points.




© Copyright 1993-2019 by VVimaging, Inc. (VVI); All Rights Reserved. Please email support@vvi.com with any comments you have concerning this documentation. See Legal for trademark and legal information.