Mesh.

 

Let's create a mesh by a two-dimensional array of the points lying on a paraboloid:

 

int x_sz = 20;

 int y_sz =20;

 SG_POINT*  pnts = new SG_POINT[x_sz*y_sz];

 

 for (int i=0;i<x_sz;i++)

         for (int j=0;j<y_sz;j++)

         {

                 pnts[i*y_sz+j].x = i-x_sz/2;

                 pnts[i*y_sz+j].y = j-y_sz/2;

                 pnts[i*y_sz+j].z = 0.1*(pnts[i*y_sz+j].x*pnts[i*y_sz+j].x+

                                                         pnts[i*y_sz+j].y*pnts[i*y_sz+j].y);

         }

 

 sgCObject* msh= sgSurfaces::Mesh(x_sz,y_sz,pnts);

 

 delete [] pnts;

 

 sgGetScene()->AttachObject(msh);

 msh->SetAttribute(SG_OA_COLOR,30);

 msh->SetAttribute(SG_OA_LINE_THICKNESS, 1);

 

See also:

sgSurfaces::Mesh  

sgGetScene sgCScene::AttachObject   sgCObject::SetAttribute

 

Illustration:

mesh