generating quadric surfaces

Hi All,

I have been generating data to form quadric surfaces (i.e. ellipsoid, hyperboloid of one and two sheets) with the following code:

for(int i=0;i<resol+1;i++)
            thelta = thelta_gap*i+start;

            for(int j=0;j<resol+1;j++)
                phi = phi_gap*j;

                dx = Math.sin(thelta)*Math.cos(phi);
                dy = Math.cos(thelta);
                dz = Math.sin(thelta)*Math.sin(phi);

                Sn = dx*dx*stress[1]+dy*dy*stress[0]+

                if(Sn<=0.) tempVal = 0.;
                else tempVal = Math.sqrt(k*k/Math.abs(Sn));
                xCoord[counter] = (float)(tempVal*dx);
                yCoord[counter] = (float)(tempVal*dy);
                zCoord[counter] = (float)(tempVal*dz);

                xCoord[counter] = xCoord[counter-resol];
                yCoord[counter] = yCoord[counter-resol];
                zCoord[counter] = zCoord[counter-resol];

But problems occur when the shape is either hyperboloid of one sheet or two sheet. For hyperboloid of two sheet, the parts of the two sheets that are close to the origin becomes white (fading away). For hyperboloid of one sheet only portions that are close to the origin are recognizable. Geometry "fades" and becomes spiky when moving away from the origin.

Does anyone have some ideas on how I can fix this problem?  Thanks very much.


  • 2002 messages navigation, sorted by:
    1. Thread
    2. Subject
    3. Author
    4. Date
    5. ↑ Table Of Contents
  • Search the visad archives: