From Saturday, Nov 23rd 7:00 PM CST - Sunday, Nov 24th 7:45 AM CST, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

Any idea on how to plot a Hyperboloid of 1 sheet in a 3D graph

I'm trying to write code in the 3D graph to show a Hyperboloid of one sheet. I need the x,y, and z variables to be adjustable by sliders coming from values of a DAQ card. I also need to place a sphere at the center (the z plane) minima of the hyperboloid also of adjustable r. The variables shouldn't be a problem but the the 3d matrix is. Does anybody have a solution that might make sense?

0 Kudos
Message 1 of 3
(3,076 Views)

First off, are you using the CW 3D Graph library from toolslib? And are you specifically trying to use the CW3DGraphLib_CWPlot3DPlot3DCurve function?

Could you also provide some more infromation about the 3d martix that you are having a problem with?

Thank you

Jacob R. | Applications Engineer | National Instruments

0 Kudos
Message 2 of 3
(3,049 Views)

Hi Jacob

 

I figured it out. Not quite intuitive. But my next issue is that I also want to add a sphere at the minimum of the hyperboloid. I can only display one or the other but not both. I also need to change the color of each 3d entity.

Many Thanks.

 

Here is the code  for the hyperboloid and the sphere:

 

 

   /* Generating Data */
   for (i = 0; i < 41; ++i)
    t[i] = (i - 20.0) / 20.0 * PI;
   for (i = 0; i < 41; ++i)
    for(j = 0; j < 41; ++j)
     {
     // here is the matrix for the Hyperboloid 
     xData[j][i] = aa*cosh(t[j])*cos(t[i]);
     yData[j][i] = bb*cosh(t[j])*sin(t[i]);
     zData[j][i] = cc*sinh(t[j]);
     
     // here is the matrix for the sphere
     xData2[j][i] = (r*cos(t[j])*sin(t[i]));
     yData2[j][i] = (r*sin(t[j])*sin(t[i]));
     zData2[j][i] = (r*cos(t[i]));
     }
   hrChk (CA_VariantSet2DArray(&xVt2, CAVT_DOUBLE, 41, 41, xData2));
   hrChk (CA_VariantSet2DArray(&yVt2, CAVT_DOUBLE, 41, 41, yData2));
   hrChk (CA_VariantSet2DArray(&zVt2, CAVT_DOUBLE, 41, 41, zData2));
   
   
   hrChk (CA_VariantSet2DArray(&xVt, CAVT_DOUBLE, 41, 41, xData));
   hrChk (CA_VariantSet2DArray(&yVt, CAVT_DOUBLE, 41, 41, yData));
   hrChk (CA_VariantSet2DArray(&zVt, CAVT_DOUBLE, 41, 41, zData));
   
   /* Display data */
   CW3DGraphLib__DCWGraph3DSetPlotAreaColor (gGraph, NULL, 2);
   CW3DGraphLib__DCWGraph3DSetByRefPlotAreaColor (gGraph, NULL, 5);
   hrChk (CW3DGraphLib__DCWGraph3DPlot3DParametricSurface(gGraph,
    NULL, xVt, yVt, zVt, CA_DEFAULT_VAL));
   hrChk (CW3DGraphLib__DCWGraph3DPlot3DParametricSurface(gGraph,
    NULL, xVt2, yVt2, zVt2, CA_DEFAULT_VAL));
   

0 Kudos
Message 3 of 3
(3,045 Views)