hi there,

i have created 2 objects using surface of revolution
in java.

i am facing difficulties in creating 3d objects like
vase, hour glass, wine bottle, chess ...

so what i need is the x, y , z equations to generate
these objects in order to get the output.

or modification to the files attached is also
welcomed.

thanks in advance.

__________________________________________________
Do You Yahoo!?
Get email at your own domain with Yahoo! Mail.
http://personal.mail.yahoo.com/
import java.applet.Applet;
import java.awt.*;
import java.math.*;

public class para2 extends Applet
{
  int uf,vf,i;
  double x,y,z,s,t;
  int e[]={0,-3000,3000}; //eye view {eu,ev,en}
  int u[]=new int[1000];
  int v[]=new int[1000];

  public void paint (Graphics g)
  {
    int xmax=799;
    int ymax=599;
    double p=Math.PI/180;
    s=-180;

    do {
         t=-90; i=1;
      do {
           
x=(double)(4*Math.cos(p*s)*((Math.exp(p*t)+Math.exp(-p*t)*2+Math.pow(p*t,2))));  // 
Longitude
           
z=(double)(2*Math.sin(p*t)*((Math.exp(p*t)+Math.exp(-p*t))/5)*(Math.sin(p*s)*4-Math.pow(p*t,2))/2);
           y=(double)(6*((Math.exp(p*t)-Math.exp(-p*t))/2));                        // 
Latitude
           uf=(int)(xmax/2-30-Math.round(3*(e[2]*x-e[0]*z)/(e[2]-z)));
           vf=(int)(ymax/2+150-Math.round(3*(e[2]*y-e[1]*z)/(e[2]-z)));

           if (t==-90) { u[i]=uf; v[i]=vf; i++; }
           if (s!=-180)
{
             g.drawLine(u[i],v[i],uf,vf);
             g.drawLine(u[i-1],v[i-1],uf,vf);
           }
           u[i]=uf; v[i]=vf;
           t=t+10; i++;         // Longitude interval
       } while (t<180);
       s=s+10;                  // Latitude interval
    } while (s<=180);
  }
}
import java.applet.Applet;
import java.awt.*;
import java.math.*;

public class para1 extends Applet
{
  int uf,vf,i;
  double x,y,z,s,t;
  int e[]={0,-1000,3000}; //eye view {eu,ev,en}
  int u[]=new int[1000];
  int v[]=new int[1000];

  public void paint (Graphics g)
  {
    int xmax=799;
    int ymax=599;
    double p=Math.PI/180;
    s=-180;

    do {
         t=-90; i=1;
      do {
           
x=(double)(4*Math.cos(p*s)*((Math.exp(p*t)+Math.exp(-p*t)*2+Math.pow(p*t,2))/2));  // 
Longitude
           
z=(double)(2*((Math.exp(p*t)+Math.exp(-p*t))/2)*Math.sin(p*s)-Math.pow(p*t,2));
           y=(double)(18*((Math.exp(p*t)-Math.exp(-p*t))/2));                        
// Latitude
           uf=(int)(xmax/2-30-Math.round(2*(e[2]*x-e[0]*z)/(e[2]-z)));
           vf=(int)(ymax/2+150-Math.round(2*(e[2]*y-e[1]*z)/(e[2]-z)));

           if (t==-90) { u[i]=uf; v[i]=vf; i++; }
           if (s!=-180)
{
             g.drawLine(u[i],v[i],uf,vf);
             g.drawLine(u[i-1],v[i-1],uf,vf);
           }
           u[i]=uf; v[i]=vf;
           t=t+10; i++;         // Longitude interval
       } while (t<180);
       s=s+10;                  // Latitude interval
    } while (s<=180);
  }
}

Reply via email to