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


C++ Box::Add方法代码示例

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


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

示例1: main

void main()
{
	Box *b = new Box(Vector(0,-2,5),Vector(8,0,3),Vector(-8,0,3),Vector(0,-3,0));
//	Sphere *s = new Sphere(Vector(0,0,5),50);
	LightSource *Light1 = new PointLight(Vector(7,10,-10),20);
	BmpImage *img = new BmpImage("backgnd.bmp");
	ColorMap *cmap = new ColorMap(img);

	cmap->Scale = 25;

	Scene = new Environment;

	b->Mapping = new PlaneMap(Vector(0,-1,-1),Vector(1,0,0));
	b->Add(cmap);
	b->Ambient(0.3);
	b->Diffuse(0.8);
	b->Specular(0.3);
	b->Reflection(0.0);
	b->Refraction(0.0);
	b->PhongSize(5);
	b->DefMaterial.Med = Glass;
	b->DefMaterial.Color = 1;

	Scene->Add(b);
	Scene->Add(Light1);

	Background = SkyBlue;
	SetCamera(Vector(0),Vector(0,0,1),Vector(0,1,0));
	RenderScene(1.6,1.0,320,200,"SAMP0080.TGA");
}
开发者ID:berkus,项目名称:grayzer,代码行数:30,代码来源:example9.cpp

示例2: STLBoundarySeg

  STLBoundarySeg (int ai1, int ai2, const Array<Point<3> > & points,
		  const STLChart * chart)
    : p1(points.Get(ai1)), p2(points.Get(ai2)),
      i1(ai1), i2(ai2)
  {
    center = ::netgen::Center (p1, p2);
    rad = Dist (p1, center);
    
    p2d1 = chart->Project2d (p1);
    p2d2 = chart->Project2d (p2);
    
    boundingbox.Set (p2d1);
    boundingbox.Add (p2d2);
  }
开发者ID:liangcheng,项目名称:netgen,代码行数:14,代码来源:stltool.hpp

示例3: BlockFillLocalH

  void Meshing2 :: BlockFillLocalH (Mesh & mesh, const MeshingParameters & mp)
  {
    double filldist = mp.filldist;

    cout << "blockfill local h" << endl;
    cout << "rel filldist = " << filldist << endl;
    PrintMessage (3, "blockfill local h");

    Array<Point<3> > npoints;

    // adfront -> CreateTrees();

    Box<3> bbox ( Box<3>::EMPTY_BOX );
    double maxh = 0;

    for (int i = 0; i < adfront->GetNFL(); i++)
      {
	const FrontLine & line = adfront->GetLine (i);

	const Point<3> & p1 = adfront->GetPoint(line.L().I1());
	const Point<3> & p2 = adfront->GetPoint(line.L().I2());

	double hi = Dist (p1, p2);
	if (hi > maxh) maxh = hi;

	bbox.Add (p1);
	bbox.Add (p2);
      }


    cout << "bbox = " << bbox << endl;


    // Point<3> mpc = bbox.Center();
    bbox.Increase (bbox.Diam()/2);
    Box<3> meshbox = bbox;

    LocalH loch2 (bbox, 1);

    if (mp.maxh < maxh) maxh = mp.maxh;

    bool changed;
    do
      {
	mesh.LocalHFunction().ClearFlags();

	for (int i = 0; i < adfront->GetNFL(); i++)
	  {
	    const FrontLine & line = adfront->GetLine(i);

	    Box<3> bbox (adfront->GetPoint (line.L().I1()));
	    bbox.Add (adfront->GetPoint (line.L().I2()));


	    double filld = filldist * bbox.Diam();
	    bbox.Increase (filld);

	    mesh.LocalHFunction().CutBoundary (bbox);
	  }


	mesh.LocalHFunction().FindInnerBoxes (adfront, NULL);

	npoints.SetSize(0);
	mesh.LocalHFunction().GetInnerPoints (npoints);

	changed = false;
	for (int i = 0; i < npoints.Size(); i++)
	  {
	    if (mesh.LocalHFunction().GetH(npoints[i]) > 1.5 * maxh)
	      {
		mesh.LocalHFunction().SetH (npoints[i], maxh);
		changed = true;
	      }
	  }
      }
    while (changed);

    if (debugparam.slowchecks)
      (*testout) << "Blockfill with points: " << endl;
    *testout << "loch = " << mesh.LocalHFunction() << endl;

    *testout << "npoints = " << endl << npoints << endl;

    for (int i = 1; i <= npoints.Size(); i++)
      {
	if (meshbox.IsIn (npoints.Get(i)))
	  {
	    PointIndex gpnum = mesh.AddPoint (npoints.Get(i));
	    adfront->AddPoint (npoints.Get(i), gpnum);

	    if (debugparam.slowchecks)
	      {
		(*testout) << npoints.Get(i) << endl;

		Point<2> p2d (npoints.Get(i)(0), npoints.Get(i)(1));
		if (!adfront->Inside(p2d))
		  {
		    cout << "add outside point" << endl;
		    (*testout) << "outside" << endl;
//.........这里部分代码省略.........
开发者ID:AlexanderToifl,项目名称:viennamesh-dev,代码行数:101,代码来源:delaunay2d.cpp

示例4: BuildScene

  void VisualSceneGeometry :: BuildScene (int zoomall)
  {
    VisualScene::BuildScene(zoomall); // setting light ...
    Box<3> box;
    int hasp = 0;
    for (int i = 0; i < geometry->GetNTopLevelObjects(); i++)
      {
	const TriangleApproximation & ta =
	  *geometry->GetTriApprox(i);
	if (!&ta) continue;

	for (int j = 0; j < ta.GetNP(); j++)      
	  {
	    if (hasp)
	      box.Add (ta.GetPoint(j));
	    else
	      {
		hasp = 1;
		box.Set (ta.GetPoint(j));
	      }
	  }
      }
    if (hasp)
      {
	center = box.Center();
	rad = box.Diam() / 2;
      }
    else
      {
	center = Point3d(0,0,0);
	rad = 1;
      }

    CalcTransformationMatrices();

    for (int i = 0; i < trilists.Size(); i++)
      glDeleteLists (trilists[i], 1);
    trilists.SetSize(0);

    for (int i = 0; i < geometry->GetNTopLevelObjects(); i++)
      {
	trilists.Append (glGenLists (1));
	glNewList (trilists.Last(), GL_COMPILE); 
	glEnable (GL_NORMALIZE);
	const TriangleApproximation & ta =
	  *geometry->GetTriApprox(i);
	if (&ta) 
	  {
	    glEnableClientState(GL_VERTEX_ARRAY);
	    glVertexPointer(3, GL_DOUBLE, 0, &ta.GetPoint(0)(0));

	    glEnableClientState(GL_NORMAL_ARRAY);
	    glNormalPointer(GL_DOUBLE, 0, &ta.GetNormal(0)(0));
	    
	    for (int j = 0; j < ta.GetNT(); j++)
	      glDrawElements(GL_TRIANGLES, 3, GL_UNSIGNED_INT, & (ta.GetTriangle(j)[0]));

	    glDisableClientState(GL_VERTEX_ARRAY);
	    glDisableClientState(GL_NORMAL_ARRAY);
            /*
	    for (int j = 0; j < ta.GetNT(); j++)
	      {
		glBegin (GL_TRIANGLES);
		for (int k = 0; k < 3; k++)
		  {
		    int pi = ta.GetTriangle(j)[k];
		    glNormal3dv (ta.GetNormal(pi));
		    glVertex3dv (ta.GetPoint(pi));
                    cout << "v = " << ta.GetPoint(pi) << endl;
		  }
		glEnd ();
	      }
            */
	  }
	glEndList ();
      }
  }
开发者ID:liangcheng,项目名称:netgen,代码行数:77,代码来源:vscsg.cpp

示例5: GetBoundingBox

void STLLine :: GetBoundingBox (const Array<Point<3> > & ap, Box<3> & box) const
{
    box.Set (ap.Get (pts[0]));
    for (int i = 1; i < pts.Size(); i++)
        box.Add (ap.Get(pts[i]));
}
开发者ID:liangcheng,项目名称:netgen,代码行数:6,代码来源:stlline.cpp


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