Measurement Studio for VC++

cancel
Showing results for 
Search instead for 
Did you mean: 

3d graphing function

Hey,

I am trying to write a program that contains a 3d graph using Measurement Studio for Visual C++. I am trying to use the function Plot3DCurve. I am trying to make the graph into an intensity graph (which is why I am viewing it from the top). Do you know what parameters I should use in the function Plot3DCurve so that it will look like the intensity graph of the default 3d graph image (when you create the object,I want the graph to display that 3d image in an intensity graph...but I do not know what parameters to use).
0 Kudos
Message 1 of 2
(3,069 Views)
I don't know if you'll be able to do what you want with Plot3DCurve. I think that Plot3DSimpleSurface or Plot3DSurface is what you're looking for. Below is an example that demonstrates how to get a color spectrum intensity plot of a dual sine surface plot that is similar to the plot that is displayed at design-time. To run this example, create a new Measurement Studio for Visual C++ project, add a graph to the dialog, create a member variable for it called m_graph3D, and add the code below to the dialog's OnInitDialog method:

// Configure a top-down view of the surface and zoom in on the plot a little.
m_graph3D.ViewMode = CNiGraph3D::ViewXYPlane;
m_graph3D.ViewDistance = 0.7;

// Configure the plot for a color spectrum surface
plot.
CNiPlot3D plot = m_graph3D.Plots.Item(1);
plot.Style = CNiPlot3D::Surface;
plot.ColorMapAutoScale = false;
plot.ColorMapInterpolate = true;
plot.ColorMapLog = false;
plot.ColorMapStyle = CNiPlot3D::ColorSpectrum;

// Generate the dual sine surface data.
const int SIZE = 41;
CNiReal64Vector xData(SIZE);
CNiReal64Vector yData(SIZE);
CNiReal64Matrix zData(SIZE, SIZE);
int i, j;

for (i = 0; i < SIZE; ++i)
xData[i] = yData[i] = ((i - 20.0) / 20.0) * CNiMath::Pi;

for (i = 0; i < SIZE; ++i)
{
for (j = 0; j < SIZE; ++j)
zData(j, i) = sin(xData[i]) * cos(yData[j]) + 2.0;
}

// Plot the data.
m_graph3D.Plot3DSurface(xData, yData, zData);

When you compile and run you should see a result like the attached screenshot. Please reply with more information if this does not demonstrate what you're trying to do.

- Elton
Message 2 of 2
(3,069 Views)