当前位置: 首页>>代码示例>>C++>>正文


C++ Triangle::Draw方法代码示例

本文整理汇总了C++中Triangle::Draw方法的典型用法代码示例。如果您正苦于以下问题:C++ Triangle::Draw方法的具体用法?C++ Triangle::Draw怎么用?C++ Triangle::Draw使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Triangle的用法示例。


在下文中一共展示了Triangle::Draw方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: Display

void Display() {
    glClear(GL_COLOR_BUFFER_BIT);

    // compute transformations here
    int N = 400;
    float scale_factor = 0.02f;
    float c = 0.04f;
    float fermat = 137.508f / 2.0;
    for (int i = 0; i < N; i ++){
        float theta = i * fermat * (float)M_PI / 180.0f;
        float r = c * sqrt(theta);
        glm::mat4 T = glm::translate(glm::mat4(1.0f),
                                     glm::vec3(r * cos(theta) , -r * sin(theta) ,0.0f));
        glm::mat4 R = glm::rotate(glm::mat4(1.0f), -theta,
                                  glm::vec3(0.0f, 0.0f, 1.0f));
        glm::mat4 S = glm::mat4(1.0f);
        S[0][0] = scale_factor;
        S[1][1] = scale_factor;
        triangle.Draw(T,R,S);
    }

}
开发者ID:lynneeai,项目名称:CS341,代码行数:22,代码来源:main.cpp

示例2: inquire

void Triangles::inquire() 
{    
  int PS=0;
  cout << flush;
  Triangles *OldCurrentTh=CurrentTh;
  CurrentTh = this;
  if (! Grafh ) InitDraw();
  unsigned  char c;
  int rd;
  float x,y;
  int setv =0;
  Int4 nbtrel=0;
  Int4 * reft = new Int4 [Max(nbt,1L)];
  if (NbSubDomains && subdomains[0].head)
    nbtrel = ConsRefTriangle(reft);
  else
    for (Int4 kkk=0;kkk<nbt;kkk++) reft[kkk]=0;
  // cout << "inquire **********************************************************************"<<endl ;
  if (verbosity>2)
    cout << "inquire: Nb de Triangle reel = " <<ConsRefTriangle(reft)<<endl;

  while (Show("Enter ? for help",PS==0), c=Getxyc(x,y), (c != 'F'  && c != 'f') )
    { rd = 0;
      couleur(1);
      //  cout << " #"<< c << "# " << (int) c << " xy=" << x << " "<< y  <<endl ;
      //     penthickness(2);
      if (c=='?') { int i=3;
        reffecran();
	Show("enter a keyboard character in graphic window to do",i++);
	i++;
	Show("f: to continue the process",i++);
	Show("p: openPS file to save plot, P: close PS file ",i++);
        Show("B: set backgound mesh has drawing mesh",i++);
	Show("H: show histogramme",i++);
	Show("i: initDraw",i++);
	Show("+ or - : zoom + or -",i++);
	Show("r: redraw  , =: reinit the viewport ",i++);
	Show("Q: quit / abort / stop ",i++);
	Show("q: show quadtree",i++);
	Show("g: show geometry",i++);
	Show("d: show triangle with det = 0",i++);
	Show("m: show all the metric",i++);
	Show("V: show all the vertices",i++);
	Show("T: show all the sub domain ref number",i++);
	Show("V: show all the vertices",i++);
	Show("D: Inforce the mesh to be Delaunay",i++);
	Show("b: show all the boundary edges ref number",i++);
	Show("k: find the triangle contening the point",i++);
	Show("v,o or  s : print the nearest vertex  s=> draw metric o=> optim around (debug)",i++);
	Show("t: find triangle contening the point  with brute force",i++);	
	Show("e: find the nearest edge of triangle contening the point",i++);
	Show("C: construct the in-circle in anistrope way",i++);
      }
      if (c=='p') openPS(0),PS=1;
      if (c=='P') closePS(),PS=0;
      if (c=='B') BTh.inquire();
      if ( c=='D') {
	for(int iter=0;iter < 50;iter++)
	  { int k = 0;
	    for (Int4 icount=0; icount<nbv; icount++) {
	      k += vertices[icount].Optim(1,0);
	    }
	    if (k !=0) cout << " Bizarre le maillage n'est  pas delaunay  nbswap = " << k << endl;
	    else break;
	  }
	rd =1;
      }
      
      if (c=='H') ShowHistogram();
      if (c=='i') {InitDraw();
      }
      if (c=='+'|| c==253) Grafh /= 2.,rd=1,cadreortho(x,y,Grafh);
      if (c=='-'|| c==250) Grafh *= 2.,rd=1,cadreortho(x,y,Grafh);
      if (c=='r') rd =1;
      if (c=='Q') CurrentTh=0,exit(1);
      if (c=='q' && quadtree) penthickness(2),
				couleur(6), 
				quadtree->Draw(),
				couleur(1),
				penthickness(1);
      if (c=='g') couleur(6),Gh.Draw();
      if (c=='d')
	{      
          couleur(4);
	  for(int i=0;i<nbt;i++)
	    if(triangles[i].det == 0) {
	      triangles[i].Draw();
	      cout << " Bizzare " << i << endl;
	    }
          couleur(1);
       
	}
      if (c=='m')  {Int4 i;
        couleur(2);
        for (i=0;i<nbv;i++)
	  ((Metric) vertices[i]).Draw(vertices[i]); 
        couleur(1);}
      if (c=='V')  {Int4 i;
        for (i=0;i<nbv;i++)
	  vertices[i].Draw(); }
//.........这里部分代码省略.........
开发者ID:manasdas17,项目名称:scilab-mip,代码行数:101,代码来源:MeshDraw.cpp


注:本文中的Triangle::Draw方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。