Exemplo n.º 1
0
void SL()
{
 //printf("\nEnter <SL>");
 S();
 SLP();
 //printf("\nExit <SL>");
}
Exemplo n.º 2
0
CubitStatus OCCSurface::principal_curvatures(
  CubitVector const& location, 
  double& curvature_1,
  double& curvature_2,
  CubitVector* closest_location )
{
  BRepAdaptor_Surface asurface(*myTopoDSFace);
  gp_Pnt p(location.x(), location.y(), location.z()), newP(0.0, 0.0, 0.0);
  double minDist=0.0, u, v;
  int i;
  BRepLProp_SLProps SLP(asurface, 2, Precision::PConfusion());
  Extrema_ExtPS ext(p, asurface, Precision::Approximation(), Precision::Approximation());
  if (ext.IsDone() && (ext.NbExt() > 0)) {
	  for ( i = 1 ; i <= ext.NbExt() ; i++ ) {
		  if ( (i==1) || (p.Distance(ext.Point(i).Value()) < minDist) ) {
			  minDist = p.Distance(ext.Point(i).Value());
			  newP = ext.Point(i).Value();
			  ext.Point(i).Parameter(u, v);
			  SLP.SetParameters(u, v);
		  }
	  }
  }
  if (closest_location != NULL)
    *closest_location = CubitVector(newP.X(), newP.Y(), newP.Z());

  if (SLP.IsCurvatureDefined())
  {
    curvature_1 = SLP.MinCurvature();
    curvature_2 = SLP.MaxCurvature();
  }
  return CUBIT_SUCCESS;
}
Exemplo n.º 3
0
void SLP()
{
 if(atEnd);

 else if(strcmp("B_END",token))
 {
 S();
 SLP();
 }
}
Exemplo n.º 4
0
//-------------------------------------------------------------------------
// Purpose       : Computes the closest_point on the surface to the input 
//                 location.  Optionally, it also computes and returns
//                 the normal to the surface at closest_location and the 
//                 principal curvatures(1-min, 2-max)
//
//-------------------------------------------------------------------------
CubitStatus OCCSurface::closest_point( CubitVector const& location, 
                                         CubitVector* closest_location,
                                         CubitVector* unit_normal_ptr,
                                         CubitVector* curvature_1,
                                         CubitVector* curvature_2)
{
  BRepAdaptor_Surface asurface(*myTopoDSFace);
  gp_Pnt p(location.x(), location.y(), location.z()), newP(0.0, 0.0, 0.0);
  double minDist=0.0, u, v;
  int i;
  BRepLProp_SLProps SLP(asurface, 2, Precision::PConfusion());
  Extrema_ExtPS ext(p, asurface, Precision::Approximation(), Precision::Approximation());
  if (ext.IsDone() && (ext.NbExt() > 0)) {
	  for ( i = 1 ; i <= ext.NbExt() ; i++ ) {
		  if ( (i==1) || (p.Distance(ext.Point(i).Value()) < minDist) ) {
			  minDist = p.Distance(ext.Point(i).Value());
			  newP = ext.Point(i).Value();
			  ext.Point(i).Parameter(u, v);
			  SLP.SetParameters(u, v);
		  }
	  }
  
	if (closest_location != NULL)
 	 	*closest_location = CubitVector(newP.X(), newP.Y(), newP.Z());
  	if (unit_normal_ptr != NULL) {
	  gp_Dir normal;
          //normal of a RefFace point to outside of the material
	  if (SLP.IsNormalDefined()) {
	    normal = SLP.Normal();
            CubitSense sense = get_geometry_sense();
            if(sense == CUBIT_REVERSED)
              normal.Reverse() ;
	      *unit_normal_ptr = CubitVector(normal.X(), normal.Y(), normal.Z()); 
	  }
  	}
  
        gp_Dir MaxD, MinD;
        if (SLP.IsCurvatureDefined())
        {
	   SLP.CurvatureDirections(MaxD, MinD);
           if (curvature_1 != NULL)
              *curvature_1 = CubitVector(MinD.X(), MinD.Y(), MinD.Z());
           if (curvature_2 != NULL)
              *curvature_2 = CubitVector(MaxD.X(), MaxD.Y(), MaxD.Z());
        }
  }
  return CUBIT_SUCCESS;
}
Exemplo n.º 5
0
void SLP()
{
 //printf("\nEnter <SLP>");

 if(!(strcmp(token,"CONSTANT") && strcmp(token,"BOOL_TYP") && strcmp(token,"FLT_TYP") && strcmp(token,"INT_TYP") && strcmp(token,"STR_TYP") && strcmp(token,"BOOL_TYP") && strcmp(token,"ID") && strcmp(token,"IF_") && strcmp(token,"ELSE_") && strcmp(token,"LOOP_THIS") && strcmp(token,"INPT_DATA") && strcmp(token,"PRNT_DATA") && strcmp(token,"B_START")))
 {
  S();
  SLP();
 }
 else if(!strcmp(token,"B_END"));
 else
 {
  error("Unexpected token ");
  printf("%s %s. Missing a proper token",token,lexeme);
  consume();
 }

 //printf("\nExit <SLP>");
}
Exemplo n.º 6
0
void SL()
{
 S();
 SLP();
}
Exemplo n.º 7
0
void Board::print()
{
    if (!Game::debugFlag)
    {
        SLP(1);
        CLS;
    }
    cout << endl;
    cout << Game::mainLang.rnd << movesRecord.size() + 1 << Game::mainLang.rnd1 << ", " << (sideFlag ? Game::mainLang.blk : Game::mainLang.wht) << Game::mainLang.trn << endll;
    cout << "      ";
    for (int i = 1; i <= 8; i++)
        cout << char('@' + i) << "   ";

    cout << endl << "    ┌───┬───┬───┬───┬───┬───┬───┬───┐" << endl;

    for (int i = 1; i <= 8; i++)
    {
        cout << "   " << i << "│";
        for (int j = 1; j <= 8; j++)
        {
            switch (cell[i][j].stat)
            {
                case Black:
                    cout << " ● │";
                    break;
                case White:
                    cout << " ○ │";
                    break;
                case Empty:
                    cout << "   │";
                    break;
                case Valid:
                    if (Game::assistFlag && ((Game::AIFlag == AI_MODE&&sideFlag == Game::humanSide) || (Game::AIFlag == NON_AI_MODE)))
                        cout << " ╋ │";
                    else
                        cout << "   │";
                    break;
                default:
                    fatalError(1);
            }
        }
        if (i - 8)
            cout << endl << "    ├───┼───┼───┼───┼───┼───┼───┼───┤";
        else
            cout << endl << "    └───┴───┴───┴───┴───┴───┴───┴───┘";
        if (i - 8) cout << endl;
    }
    cout << endl << left << "       "
        << Game::mainLang.blk << "(●):" << setw(2) << statusCount[Black] << "    "
        << Game::mainLang.wht << "(○):" << setw(2) << statusCount[White] << endl;

    if (movesRecord.size() && Game::AIFlag && sideFlag == Game::humanSide && !Game::AIPass && !Game::autoFlag)
    {
        if (Game::debugFlag)
        {
            ofstream out("timecsm.txt", ios::app);
            out << Game::mainLang.aps
                << movesRecord[movesRecord.size() - 1].x
                << char(movesRecord[movesRecord.size() - 1].y + '@')
                << Game::mainLang.aps1
                << endl
                << Game::mainLang.tmcsm1
                << double(clock() - startTime) / CLOCKS_PER_SEC
                << Game::mainLang.tmcsm
                << endll;
            out.close();
        }
        cout << endl << "        "
            << Game::mainLang.aps
            << movesRecord[movesRecord.size() - 1].x
            << char(movesRecord[movesRecord.size() - 1].y + '@')
            << Game::mainLang.aps1
            << endl << "          "
            << Game::mainLang.tmcsm1
            << double(clock() - startTime) / CLOCKS_PER_SEC
            << Game::mainLang.tmcsm
            << endll;
    }
    else cout << endll;
}