Hello,
There isn't a built-in function to display triplots (2D triangular plots). One option would be to find a C third-party library or function and call it within CVI.
A basic implementation of triplots in CVI would involve using the PlotPolygon function.
First you would have two 1D arrays - one for the X values of the triangles and one for the Y values of the triangles
Then, you would have a 2D M x 3 array. Each row would contains indices into the vectors x and y that define a single triangle.
Use the indices in each column of the 2D array to index into the X and Y arrays. Then pass the resulting value into the PlotPolygon function.
void TriPlot () {
int x [100];
int y [100];
int m [3][5];
int i, j = 0;
int xArray[3];
int yArray[3];
for (i = 0; i < 100; i++) {
x [i] = Random(0, 50);
y [i] = Random(0, 50);
}
for (i = 0; i < 3; i++)
for (j = 0; j < 5; j++)
m[i][j] = Random(0, 99);
for (i = 0; i < 5; i++) {
xArray[0] = x[m[0][i]];
xArray[1] = x[m[1][i]];
xArray[2] = x[m[2][i]];
yArray[0] = y[m[0][i]];
yArray[1] = y[m[1][i]];
yArray[2] = y[m[2][i]];
PlotPolygon (panelHandle, PANEL_GRAPH, xArray, yArray, 3, VAL_INTEGER, VAL_INTEGER, VAL_RED, VAL_TRANSPARENT);
}
}
The above code creates random triangles, but you could generate the triangle points by your particular algorithm (to make the equilateral, etc).
I hope that helps.
Wendy L
LabWindows/CVI Developer Newsletter