Ejemplo n.º 1
0
void PMTorus::createLines( PMLineArray& lines, int uStep, int vStep )
{
   int u, v;
   for( u = 0; u < uStep; ++u )
   {
      for( v = 0; v < vStep; ++v )
      {
         lines[ u * vStep + v ] = PMLine( u * vStep  + v, u * vStep + ( (v+1) %  vStep ) );
         lines[ uStep * vStep + u * vStep + v ] = PMLine( u * vStep  + v, ( (u+1) % uStep ) * vStep + v );
      }
   }
}
Ejemplo n.º 2
0
void PMCone::createLines( PMLineArray& lines, int steps )
{
   int i;
   for( i = 0; i < ( steps - 1 ); i++ )
   {
         lines[i] = PMLine( i, i + 1 );
         lines[i + steps] = PMLine( i + steps, i +  steps+ 1 );
   }
   lines[steps - 1] = PMLine( steps - 1, 0 );
   lines[steps * 2 - 1] = PMLine( steps * 2 - 1,  steps );

   for( i = 0; i < steps; i++ )
   {
         lines[i + 2 * steps] = PMLine( i, i + steps );
   }
}
Ejemplo n.º 3
0
void PMSuperquadricEllipsoid::createLines( PMLineArray& lines, int uStep, int vStep )
{
   int u, v;
   int offset = 0;

   // horizontal lines
   for( u = 0; u < ( uStep - 1 ); u++ )
   {
      for( v = 0; v < ( vStep - 1 ); v++ )
         lines[offset + v] =
            PMLine( u * vStep + v + 1, u * vStep + v + 2 );
      lines[offset + vStep - 1] =
         PMLine( u * vStep + 1, u * vStep + vStep );

      offset += vStep;
   }

   // vertical lines
   // lines at the "north pole"
   for( v = 0; v < vStep; v++ )
      lines[offset + v] = PMLine( 0, v + 1 );
   offset += vStep;

   for( v = 0; v < vStep; v++ )
   {
      for( u = 0; u < ( uStep - 2 ); u++ )
      {
         lines[offset + u] =
            PMLine( u * vStep + v + 1, ( u + 1 ) * vStep + v + 1 );
      }
      offset += ( uStep - 2 );
   }
   // lines at the "south pole"
   for( v = 0; v < vStep; v++ )
      lines[offset + v] = PMLine( ( uStep - 2 ) * vStep + v + 1,
                                    ( uStep - 1 ) * vStep + 1 );
   // offset += vStep;
}