ReactOS Fundraising Campaign 2012
 
€ 4,410 / € 30,000

Information | Donate

Home | Info | Community | Development | myReactOS | Contact Us

  1. Home
  2. Community
  3. Development
  4. myReactOS
  5. Fundraiser 2012

  1. Main Page
  2. Alphabetical List
  3. Data Structures
  4. Directories
  5. File List
  6. Data Fields
  7. Globals
  8. Related Pages

ReactOS Development > Doxygen

void sampleCompTop ( Real topVertex,
vertexArray leftChain,
Int  leftStartIndex,
vertexArray rightChain,
Int  rightStartIndex,
gridBoundaryChain leftGridChain,
gridBoundaryChain rightGridChain,
Int  gridIndex1,
Int  up_leftCornerWhere,
Int  up_leftCornerIndex,
Int  up_rightCornerWhere,
Int  up_rightCornerIndex,
primStream pStream 
)

Definition at line 470 of file sampleCompTop.cc.

Referenced by sampleConnectedComp().

{
  if(up_leftCornerWhere == 1 && up_rightCornerWhere == 1) //the top is topVertex with possible grid points
    {
      leftGridChain->getGrid()->outputFanWithPoint(leftGridChain->getVlineIndex(gridIndex1),
                           leftGridChain->getUlineIndex(gridIndex1),
                           rightGridChain->getUlineIndex(gridIndex1),
                           topVertex,
                           pStream);
      return;
    }

  else if(up_leftCornerWhere != 0)
    {
      Real* tempTop;
      Int tempRightStart;
      if(up_leftCornerWhere == 1){
    tempRightStart = rightStartIndex;
    tempTop = topVertex;
      }
      else
    {
      tempRightStart = up_leftCornerIndex+1;
      tempTop = rightChain->getVertex(up_leftCornerIndex);
    }
      sampleTopRightWithGridLine(tempTop, rightChain, tempRightStart, up_rightCornerIndex,
                 rightGridChain->getGrid(),
                 leftGridChain->getVlineIndex(gridIndex1),
                 leftGridChain->getUlineIndex(gridIndex1),
                 rightGridChain->getUlineIndex(gridIndex1),
                 pStream);
    }
  else if(up_rightCornerWhere != 2)
    {
      Real* tempTop;
      Int tempLeftStart;
      if(up_rightCornerWhere == 1)
    {
      tempLeftStart = leftStartIndex;
      tempTop = topVertex;
    }
      else //0
    {
      tempLeftStart = up_rightCornerIndex+1;
      tempTop = leftChain->getVertex(up_rightCornerIndex);
    }
/*
      sampleTopLeftWithGridLine(tempTop, leftChain, tempLeftStart, up_leftCornerIndex,
                leftGridChain->getGrid(),
                 leftGridChain->getVlineIndex(gridIndex1),
                 leftGridChain->getUlineIndex(gridIndex1),
                 rightGridChain->getUlineIndex(gridIndex1),
                 pStream);
*/
      sampleCompTopSimple(topVertex,
              leftChain,
              leftStartIndex,
              rightChain,
              rightStartIndex,
              leftGridChain,
              rightGridChain,
              gridIndex1,
              up_leftCornerWhere,
              up_leftCornerIndex,
              up_rightCornerWhere,
              up_rightCornerIndex,
              pStream);               
    }
  else //up_leftCornerWhere == 0, up_rightCornerWhere == 2.
    {
      sampleCompTopSimple(topVertex,
              leftChain,
              leftStartIndex,
              rightChain,
              rightStartIndex,
              leftGridChain,
              rightGridChain,
              gridIndex1,
              up_leftCornerWhere,
              up_leftCornerIndex,
              up_rightCornerWhere,
              up_rightCornerIndex,
              pStream);               
      return;
#ifdef NOT_REACHABLE //code is not reachable, for test purpose only
      //the following code is trying to do some optimization, but not quite working, also see sampleCompBot.C:
      Int sep_left, sep_right;
      if(findTopSeparator(leftChain,
              leftStartIndex,
              up_leftCornerIndex,
              rightChain,
              rightStartIndex,
              up_rightCornerIndex,
              sep_left,
              sep_right)
     ) //separator exists
    {

      if( leftChain->getVertex(sep_left)[0] >= leftGridChain->get_u_value(gridIndex1) &&
         rightChain->getVertex(sep_right)[0] <= rightGridChain->get_u_value(gridIndex1))
        {
          Int gridSep;
          Int segLeftSmall, segLeftLarge, segRightSmall, segRightLarge;
          Int valid=1; //whether the gridStep is valid or not.
          findTopLeftSegment(leftChain,
                 sep_left,
                 up_leftCornerIndex,
                 leftGridChain->get_u_value(gridIndex1),
                 segLeftSmall,
                 segLeftLarge);
          findTopRightSegment(rightChain,
                 sep_right,
                 up_rightCornerIndex,
                 rightGridChain->get_u_value(gridIndex1),
                 segRightSmall,
                 segRightLarge);
          if(leftChain->getVertex(segLeftSmall)[1] >= rightChain->getVertex(segRightSmall)[1])
        {
          gridSep = rightGridChain->getUlineIndex(gridIndex1);
          while(leftGridChain->getGrid()->get_u_value(gridSep) > leftChain->getVertex(segLeftSmall)[0])
            gridSep--;
          if(segLeftSmall<segLeftLarge)
            if(leftGridChain->getGrid()->get_u_value(gridSep) < leftChain->getVertex(segLeftSmall+1)[0])
              {
            valid = 0;
              }
        }
          else
        {
          gridSep = leftGridChain->getUlineIndex(gridIndex1);
          while(leftGridChain->getGrid()->get_u_value(gridSep) < rightChain->getVertex(segRightSmall)[0])
            gridSep++;
          if(segRightSmall<segRightLarge)
            if(leftGridChain->getGrid()->get_u_value(gridSep) > rightChain->getVertex(segRightSmall+1)[0])
              {
            valid = 0;
              }
        }       
          
          if(! valid)
        {
          sampleCompTopSimple(topVertex,
                      leftChain,
                      leftStartIndex,
                      rightChain,
                      rightStartIndex,
                      leftGridChain,
                      rightGridChain,
                      gridIndex1,
                      up_leftCornerWhere,
                      up_leftCornerIndex,
                      up_rightCornerWhere,
                      up_rightCornerIndex,
                      pStream);               
        }
          else
        {
          sampleTopLeftWithGridLinePost(leftChain->getVertex(segLeftSmall),
                        leftChain,
                        segLeftSmall+1,
                        segLeftSmall+1,
                        segLeftLarge,
                        up_leftCornerIndex,
                        leftGridChain->getGrid(),
                        leftGridChain->getVlineIndex(gridIndex1),
                        leftGridChain->getUlineIndex(gridIndex1),
                        gridSep,
                        pStream);
          sampleTopRightWithGridLinePost(rightChain->getVertex(segRightSmall),
                         rightChain,
                         segRightSmall+1,
                         segRightSmall+1,
                         segRightLarge,
                         up_rightCornerIndex,
                         leftGridChain->getGrid(),
                         leftGridChain->getVlineIndex(gridIndex1),
                         gridSep,
                         rightGridChain->getUlineIndex(gridIndex1),
                         pStream);
          Real tempBot[2];
          tempBot[0] = leftGridChain->getGrid()->get_u_value(gridSep);
          tempBot[1] = leftGridChain->get_v_value(gridIndex1);
          monoTriangulationRecGen(topVertex, tempBot,
                      leftChain, leftStartIndex, segLeftSmall,
                      rightChain, rightStartIndex, segRightSmall,
                      pStream);
        }
        }//end if both sides have vetices inside the gridboundary points
      else if(leftChain->getVertex(sep_left)[0] >= leftGridChain->get_u_value(gridIndex1)) //left is in, right is nout
        {

          Int segLeftSmall, segLeftLarge;
          findTopLeftSegment(leftChain,
                 sep_left,
                 up_leftCornerIndex,
                 leftGridChain->get_u_value(gridIndex1),
                 segLeftSmall,
                 segLeftLarge);       
          assert(segLeftLarge >= sep_left); 
              monoTriangulation2(leftChain->getVertex(segLeftLarge),
                 leftGridChain->get_vertex(gridIndex1),
                 leftChain,
                 segLeftLarge+1,
                 up_leftCornerIndex,
                 1, //a increase chain,
                 pStream);

          stripOfFanLeft(leftChain, segLeftLarge, segLeftSmall, 
                 leftGridChain->getGrid(),
                 leftGridChain->getVlineIndex(gridIndex1),
                 leftGridChain->getUlineIndex(gridIndex1),
                 rightGridChain->getUlineIndex(gridIndex1),
                 pStream, 0);


          monoTriangulationRecGen(topVertex, rightGridChain->get_vertex(gridIndex1),
                      leftChain, leftStartIndex, segLeftSmall,
                      rightChain, rightStartIndex, up_rightCornerIndex,
                      pStream);     
        }//end left in right out
      else if(rightChain->getVertex(sep_right)[0] <= rightGridChain->get_u_value(gridIndex1))
        {
          Int segRightSmall, segRightLarge;
          findTopRightSegment(rightChain,
                 sep_right,
                 up_rightCornerIndex,
                 rightGridChain->get_u_value(gridIndex1),
                 segRightSmall,
                 segRightLarge);
          assert(segRightLarge>=sep_right);
          monoTriangulation2(rightChain->getVertex(segRightLarge),
                 rightGridChain->get_vertex(gridIndex1),
                 rightChain,
                 segRightLarge+1,
                 up_rightCornerIndex,
                 0, //a decrease chain
                 pStream);
          stripOfFanRight(rightChain, segRightLarge, segRightSmall,
                  rightGridChain->getGrid(),
                  rightGridChain->getVlineIndex(gridIndex1),
                  leftGridChain->getUlineIndex(gridIndex1),
                  rightGridChain->getUlineIndex(gridIndex1),
                  pStream, 0);


          monoTriangulationRecGen(topVertex, leftGridChain->get_vertex(gridIndex1),
                      leftChain, leftStartIndex, up_leftCornerIndex,
                      rightChain, rightStartIndex,segRightSmall,
                      pStream);

        }//end left out rigth in
      else //left out , right out
        {

          sampleCompTopSimple(topVertex,
                  leftChain,
                  leftStartIndex,
                  rightChain,
                  rightStartIndex,
                  leftGridChain,
                  rightGridChain,
                  gridIndex1,
                  up_leftCornerWhere,
                  up_leftCornerIndex,
                  up_rightCornerWhere,
                  up_rightCornerIndex,
                  pStream);               
        }//end leftout, right out
    }//end if separator exixts.
      else //no separator
    {

      sampleCompTopSimple(topVertex,
                leftChain,
                  leftStartIndex,
                  rightChain,
                  rightStartIndex,
                  leftGridChain,
                  rightGridChain,
                  gridIndex1,
                up_leftCornerWhere,
                  up_leftCornerIndex,
                  up_rightCornerWhere,
                  up_rightCornerIndex,
                pStream);
    }
#endif
    }//end if 0,2
}//end if the function

Generated on Sat May 26 2012 05:08:26 for ReactOS by doxygen 1.7.6.1

ReactOS is a registered trademark or a trademark of ReactOS Foundation in the United States and other countries.