Example #1
0
/**
 * draw_icosahedron:
 * @solid: TRUE if the icosahedron should be solid.
 *
 * Renders a icosahedron.
 * The icosahedron is centered at the modeling coordinates origin
 * and has a radius of 1.0. 
 *
 **/
void
draw_icosahedron (gboolean solid)
{
  if (solid)
    icosahedron (GL_TRIANGLES);
  else
    icosahedron (GL_LINE_LOOP);
}
Example #2
0
void display()
{
   glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
   glEnable(GL_DEPTH_TEST);
   glEnable(GL_CULL_FACE);

   glLoadIdentity();

   
   //view angle
   if (mode == 0) //rotation for ortho mode
   {
      glRotatef(ph, 1,0,0);
      glRotatef(th, 0,1,0);
      glScaled(0.4,0.4,0.4);
   }
   else if (mode == 1) //rotation for perspective mode
   {
      ex = Sin(-th)*Cos(ph)*8;
      ey = Sin(ph)*8;
      ez = Cos(-th)*Cos(ph)*8;

      gluLookAt(ex,ey,ez , 0,0,0 , 0,Cos(ph),0);
      //glScaled(0.3,0.3,0.3);
   }
   else //mode == 2              // rotation and movement for FP mode
   {                             // occur in keyboard & special
      vx = ex - Sin(th)*Cos(ph); // here we simply update
      vy = ey - Sin(ph);         // location of view target
      vz = ez - Cos(th)*Cos(ph);

      gluLookAt(ex,ey,ez , vx,vy,vz , 0,Cos(ph),0);
   }


   sphere(0, 0, 0, 1.5*r, 0.5); //Jupiter
   glPushMatrix();
   glRotated(r/2, 0,1,0);
   cube(1, 0, 0, r, 0.25); //IO
   glPopMatrix();
   glPushMatrix();
   glRotated(r/4, 0,1,0);
   octahedron(-2, 0, 0, 4.0/3.0*r, 0.25); //Europa
   glPopMatrix();
   glPushMatrix();
   glRotated(r/8, 0,1,0);
   dodecahedron(3, 0, 0, -1.125*r, 0.25); //Ganymede
   glPopMatrix();
   glPushMatrix();
   glRotated(r/18.4, 0,1,0);
   icosahedron(4, 0, 0, 0.75*r, 0.25); //Callisto
   glPopMatrix();

   r = glutGet(GLUT_ELAPSED_TIME)*rate;
   r = fmod(r, 360*24*18.4);
   glFlush();
   glutSwapBuffers();
}
void APIENTRY
glutSolidIcosahedron(void)
{
  icosahedron(GL_TRIANGLES);
}
/* CENTRY */
void APIENTRY
glutWireIcosahedron(void)
{
  icosahedron(GL_LINE_LOOP);
}
Example #5
0
main(int argc, char *argv[])
{
  int i,j;
  char *s;
  char *progname;
  int solid = TETRA;

  progname = argv[0];

  while (--argc > 0 && (*++argv)[0]=='-') {
    for (s = argv[0]+1; *s; s++)
      switch (*s) {
        case 's':
          xscale = atof (*++argv);
          yscale = atof (*++argv);
          zscale = atof (*++argv);
          argc -= 3;
          break;
        case 't':
          solid = TETRA;
          break;
        case 'o':
          solid = OCTA;
          break;
        case 'c':
          solid = CUBE;
          break;
        case 'i':
          solid = ICOSA;
          break;
        case 'd':
          solid = DODECA;
          break;
        default:
          usage (progname);
          exit (-1);
          break;
      }
  }

  switch (solid) {
    case TETRA:
      tetra();
      break;
    case OCTA:
      octa();
      break;
    case CUBE:
      cube();
      break;
    case ICOSA:
      icosahedron();
      break;
    case DODECA:
      dodecahedron();
      break;
    default:
      exit (-1);
      break;
  }

  write_file();
}
Example #6
0
void APIENTRY auxSolidIcosahedron (GLdouble radius)
{
    GLdouble center[3] = {(GLdouble)0.0, (GLdouble)0.0, (GLdouble)0.0};

    icosahedron (center, radius, GL_TRIANGLES);
}
Example #7
0
/*  Render wire frame or solid icosahedra.  If no display list with
 *  the current model size exists, create a new display list.
 */
void APIENTRY auxWireIcosahedron (GLdouble radius)
{
    GLdouble center[3] = {(GLdouble)0.0, (GLdouble)0.0, (GLdouble)0.0};
    icosahedron (center, radius, GL_LINE_LOOP);
}
Example #8
0
std::vector<Manifold::Triangle> Manifold::icosahedron(PointOfReferencePtr por) {
	return icosahedron(por, 1.);
}
Example #9
0
void
glutSolidIcosahedron(void)
{
  icosahedron(GL_TRIANGLES);
}
Example #10
0
void
glutWireIcosahedron(void)
{
  icosahedron(GL_LINE_LOOP);
}