Пример #1
0
void test_wait_for_either_of_five_futures_5()
{
    boost::packaged_task<int> pt(make_int_slowly);
    boost::unique_future<int> f1(pt.get_future());
    boost::packaged_task<int> pt2(make_int_slowly);
    boost::unique_future<int> f2(pt2.get_future());
    boost::packaged_task<int> pt3(make_int_slowly);
    boost::unique_future<int> f3(pt3.get_future());
    boost::packaged_task<int> pt4(make_int_slowly);
    boost::unique_future<int> f4(pt4.get_future());
    boost::packaged_task<int> pt5(make_int_slowly);
    boost::unique_future<int> f5(pt5.get_future());
    
    boost::thread(::cast_to_rval(pt5));
    
    unsigned const future=boost::wait_for_any(f1,f2,f3,f4,f5);
    
    BOOST_CHECK(future==4);
    BOOST_CHECK(!f1.is_ready());
    BOOST_CHECK(!f2.is_ready());
    BOOST_CHECK(!f3.is_ready());
    BOOST_CHECK(!f4.is_ready());
    BOOST_CHECK(f5.is_ready());
    BOOST_CHECK(f5.get()==42);
}
Пример #2
0
void HelloScene::drawAfter()
{
    SGraphic.drawLine(10, 10, 300, 300);
    CBPoint pt1(200,100);
    CBPoint pt2(250,100);
    CBPoint pt3(250,150);
    CBPoint pt4(200,150);
    SGraphic.drawLineLoop(pt1, pt2, pt3, pt4);
    CBRect rect(200,200,50,50);
    SGraphic.drawRect(rect);
    CBPoint pt5(400, 200);
    SGraphic.drawCircle(pt5, 100);
}
Пример #3
0
void HelloScene::drawAfter()
{
    SGraphic.drawLine(10, 10, 300, 300);
    CBPoint pt1(100,50);
    CBPoint pt2(125,50);
    CBPoint pt3(125,75);
    CBPoint pt4(100,75);
    SGraphic.drawLineLoop(pt1, pt2, pt3, pt4);
    CBRect rect(100,100,30,30);
    SGraphic.drawRect(rect);
    CBPoint pt5(200, 100);
    SGraphic.drawCircle(pt5, 50);
}
Пример #4
0
Cube::Cube(){
    geoType = CUBE_GEO;
    p = new Poly();
    Point pt1(0,0,0);
    Point pt2(0,0,10);
    Point pt3(10,0,10);
    Point pt4(10,0,0);
    Point pt5(10,10,0);
    Point pt6(10,10,10);
    Point pt7(0,10,10);
    Point pt8(0,10,0);

    p->addFace(pt1, pt2, pt7, pt8); // bottom
    p->addFace(pt3, pt4, pt5, pt6); // right
    p->addFace(pt1, pt2, pt3, pt4); // front 
    p->addFace(pt5, pt6, pt7, pt8); // top
    p->addFace(pt1, pt4, pt5, pt8); // left
    p->addFace(pt2, pt3, pt6, pt7); // back 

    p->computeNormals();
    this->addPoly(p); // this adds it to scene
    p->bound();
    this->bound();
}
Пример #5
0
void CFWL_CheckBoxTP::InitCheckPath(FX_FLOAT fCheckLen) {
  if (!m_pCheckPath) {
    m_pCheckPath.reset(new CFX_Path);
    m_pCheckPath->Create();
    FX_FLOAT fWidth = kSignPath;
    FX_FLOAT fHeight = -kSignPath;
    FX_FLOAT fBottom = kSignPath;
    CFX_PointF pt1(fWidth / 15.0f, fBottom + fHeight * 2 / 5.0f);
    CFX_PointF pt2(fWidth / 4.5f, fBottom + fHeight / 16.0f);
    CFX_PointF pt3(fWidth / 3.0f, fBottom);
    CFX_PointF pt4(fWidth * 14 / 15.0f, fBottom + fHeight * 15 / 16.0f);
    CFX_PointF pt5(fWidth / 3.6f, fBottom + fHeight / 3.5f);
    CFX_PointF pt12(fWidth / 7.0f, fBottom + fHeight * 2 / 7.0f);
    CFX_PointF pt21(fWidth / 5.0f, fBottom + fHeight / 5.0f);
    CFX_PointF pt23(fWidth / 4.4f, fBottom + fHeight * 0 / 16.0f);
    CFX_PointF pt32(fWidth / 4.0f, fBottom);
    CFX_PointF pt34(fWidth * (1 / 7.0f + 7 / 15.0f),
                    fBottom + fHeight * 4 / 5.0f);
    CFX_PointF pt43(fWidth * (1 / 7.0f + 7 / 15.0f),
                    fBottom + fHeight * 4 / 5.0f);
    CFX_PointF pt45(fWidth * 7 / 15.0f, fBottom + fHeight * 8 / 7.0f);
    CFX_PointF pt54(fWidth / 3.4f, fBottom + fHeight / 3.5f);
    CFX_PointF pt51(fWidth / 3.6f, fBottom + fHeight / 4.0f);
    CFX_PointF pt15(fWidth / 3.5f, fBottom + fHeight * 3.5f / 5.0f);
    m_pCheckPath->MoveTo(pt1.x, pt1.y);
    FX_FLOAT px1 = pt12.x - pt1.x;
    FX_FLOAT py1 = pt12.y - pt1.y;
    FX_FLOAT px2 = pt21.x - pt2.x;
    FX_FLOAT py2 = pt21.y - pt2.y;
    m_pCheckPath->BezierTo(pt1.x + px1 * FX_BEZIER, pt1.y + py1 * FX_BEZIER,
                           pt2.x + px2 * FX_BEZIER, pt2.y + py2 * FX_BEZIER,
                           pt2.x, pt2.y);
    px1 = pt23.x - pt2.x;
    py1 = pt23.y - pt2.y;
    px2 = pt32.x - pt3.x;
    py2 = pt32.y - pt3.y;
    m_pCheckPath->BezierTo(pt2.x + px1 * FX_BEZIER, pt2.y + py1 * FX_BEZIER,
                           pt3.x + px2 * FX_BEZIER, pt3.y + py2 * FX_BEZIER,
                           pt3.x, pt3.y);
    px1 = pt34.x - pt3.x;
    py1 = pt34.y - pt3.y;
    px2 = pt43.x - pt4.x;
    py2 = pt43.y - pt4.y;
    m_pCheckPath->BezierTo(pt3.x + px1 * FX_BEZIER, pt3.y + py1 * FX_BEZIER,
                           pt4.x + px2 * FX_BEZIER, pt4.y + py2 * FX_BEZIER,
                           pt4.x, pt4.y);
    px1 = pt45.x - pt4.x;
    py1 = pt45.y - pt4.y;
    px2 = pt54.x - pt5.x;
    py2 = pt54.y - pt5.y;
    m_pCheckPath->BezierTo(pt4.x + px1 * FX_BEZIER, pt4.y + py1 * FX_BEZIER,
                           pt5.x + px2 * FX_BEZIER, pt5.y + py2 * FX_BEZIER,
                           pt5.x, pt5.y);
    px1 = pt51.x - pt5.x;
    py1 = pt51.y - pt5.y;
    px2 = pt15.x - pt1.x;
    py2 = pt15.y - pt1.y;
    m_pCheckPath->BezierTo(pt5.x + px1 * FX_BEZIER, pt5.y + py1 * FX_BEZIER,
                           pt1.x + px2 * FX_BEZIER, pt1.y + py2 * FX_BEZIER,
                           pt1.x, pt1.y);
    FX_FLOAT fScale = fCheckLen / kSignPath;
    CFX_Matrix mt;
    mt.Set(1, 0, 0, 1, 0, 0);
    mt.Scale(fScale, fScale);
    CFX_PathData* pData = m_pCheckPath->GetPathData();
    pData->Transform(&mt);
  }
}
Пример #6
0
static gboolean
expose (GtkWidget *da, GdkEventExpose *event, gpointer user_data)
{
	GdkGLContext *glcontext = gtk_widget_get_gl_context (da);
	GdkGLDrawable *gldrawable = gtk_widget_get_gl_drawable (da);

	// g_print (" :: expose\n");

	if (!gdk_gl_drawable_gl_begin (gldrawable, glcontext))
	{
		g_assert_not_reached ();
	}

	/* draw in here */
	glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
	
	//glDepthFunc(GL_GREATER);  // The Type Of Depth Testing (Less Or Equal)
    glEnable(GL_DEPTH_TEST);  
    
    glMaterialfv(GL_FRONT_AND_BACK, GL_DIFFUSE, material_diffuse);
    
         
	glPushMatrix();

	glRotatef (ang, 1, 0, 1);
	// glRotatef (ang, 0, 1, 0);
	// glRotatef (ang, 0, 0, 1);

	glShadeModel(GL_SMOOTH);
	glLightModeli(GL_LIGHT_MODEL_TWO_SIDE, GL_TRUE);
	glEnable(GL_LIGHTING);
	glEnable(GL_LIGHT0);
	

/*
	glBegin (GL_LINES);
	glColor3f (1., 0., 0.);
	glVertex3f (0., 0., 0.);
	glVertex3f (1., 0., 0.);
	glEnd ();

	glBegin (GL_LINES);
	glColor3f (0., 1., 0.);
	glVertex3f (0., 0., 0.);
	glVertex3f (0., 1., 0.);
	glEnd ();

	glBegin (GL_LINES);
	glColor3f (0., 0., 1.);
	glVertex3f (0., 0., 0.);
	glVertex3f (0., 0., 1.);
	glEnd (); */

	FreeREP::Init();

    Geom_Vec3 pt1(0,0,0);
    Geom_Vec3 pt2(0,1,0);
    Geom_Vec3 pt3(1,1,0);
    Geom_Vec3 pt4(1,0,0);

    Geom_Vec3 pt5(0.5,0.5,0);
    Geom_Vec3 pt6(0.5,.75,0);
    Geom_Vec3 pt7(.75,.75,0);


    Topo_Line *l1 = new Topo_Line(pt1,pt2);
    Topo_Line *l2 = new Topo_Line(pt2,pt3);
    Topo_Line *l3 = new Topo_Line(pt3,pt4);

    Topo_Arc *a1 = new Topo_Arc(Geom_Ax2(pt4,Geom_Vec3(0,0,-1),Geom_Vec3(-1,0,0)),1,M_PI/2,0);

    Topo_Line *l4 = new Topo_Line(pt5,pt6);
    Topo_Line *l5 = new Topo_Line(pt6,pt7);
    Topo_Line *l6 = new Topo_Line(pt7,pt5);

/*
    Topo_Edge *e1 = new Topo_Edge();
    e1->Add(l1);
    e1->Add(l2);
    //e1->Add(l3);
    e1->Add(a1);
    e1->Reverse();

    Topo_Edge *e2 = new Topo_Edge();
    e2->Add(l4);
    e2->Add(l5);
    e2->Add(l6);
*/
/*
    glBegin(GL_LINE_STRIP);
    e1->GetVertices(.01,vCall);
    glEnd();

    glBegin(GL_LINE_STRIP);
    e2->GetVertices(.01,vCall);
    glEnd(); */

/*
    Topo_Face *face = new Topo_Face_Planar(Geom_Plane(Geom_Vec3(0,0,0),Geom_Vec3(0,0,-1)));
    face->Add(e1);
    face->Add(e2);*/

    glPolygonMode(GL_FRONT_AND_BACK, GL_LINE);
    glPolygonMode(GL_FRONT_AND_BACK, GL_FILL);
    glEnable(GL_AUTO_NORMAL);
    
    //Draw a coordinate axis on the screen
    glBegin(GL_LINES);
    
    glVertex3d(0,0,0);
    glVertex3d(0,0,.5);
    
    glVertex3d(0,0,0);
    glVertex3d(0,.5,0);
    
    glVertex3d(0,0,0);
    glVertex3d(.5,0,0);
    
    glEnd();
    
    glPushMatrix();
    glScaled(.25,.25,.25);
    
    glPushMatrix();
    glTranslated(-.5,.5,0);
    t3dDraw3D("Y", 0, 0, 0.05f);
	glPopMatrix();

	glPushMatrix();
    glTranslated(.5,-.5,0); 
    glRotated(90,0,0,1);
    t3dDraw3D("X", 0, 0, 0.05f);
	glPopMatrix();
	
	glTranslated(-.5,0,0.5); 
    glRotated(90,1,0,0);
    t3dDraw3D("Z", 0, 0, 0.05f);
	
	
	glPopMatrix();

    glBegin(GL_TRIANGLES);
    //face->Triangulate(.01,vCall);
    glEnd();
    
    Topo_Face_Spheric *sphere = new Topo_Face_Spheric(Geom_Ax2(Geom_Vec3(0,0,0),Geom_Vec3(0,0,1),Geom_Vec3(1,0,0)),1);
    glBegin(GL_TRIANGLES);
    //sphere->Triangulate(.01,vCall);
    glEnd();
    
    Topo_Face_Toroidal *toroid = new Topo_Face_Toroidal(Geom_Ax2(Geom_Vec3(0,0,0),Geom_Vec3(0,0,1),Geom_Vec3(1,0,0)),.5,.125);
    glBegin(GL_TRIANGLES);
    //toroid->Triangulate(.01,vCall);
    glEnd();

    //Topo_Solid *solid = BrepAlgoExtrude(face,Geom_Vec3(0,0,.5));

    glBegin(GL_TRIANGLES); 
    //solid->Triangulate(.001,vCall); 
    glEnd(); 
    
    std::vector<Topo_Shape*> shapes = ReadIGES("Tests/Pawn.igs");// = ReadFREP("Tests/SimpleFaces.FREP");
    
//    shapes.push_back(MakeSphere(Geom_Ax2(Geom_Vec3(0,0,0),Geom_Vec3(0,0,1),Geom_Vec3(1,0,0)),1));
//    shapes.push_back(MakeSphere(Geom_Ax2(Geom_Vec3(0,0,0),Geom_Vec3(0,0,1),Geom_Vec3(1,0,0)),0.25));
//    shapes.push_back(MakeCone(Geom_Ax2(Geom_Vec3(0,0,0),Geom_Vec3(0,0,1),Geom_Vec3(1,0,0)),.5,1,1));
    
    for(int i=0; i < shapes.size(); i++)
    {
    	ICanTriangulate *obj = dynamic_cast<ICanTriangulate*>(shapes[i]);
    	if(obj)
    	{
 #ifdef DRAWFACES
    		glBegin(GL_TRIANGLES);
    		obj->Triangulate(.01,vCall);
    		glEnd();
 #endif
 #ifdef DRAWEDGES
    		Topo_Face *face = dynamic_cast<Topo_Face*>(shapes[i]);
    		if(face)
    		{
    			Topo_Edge* edge = face->GetFirstEdge();
    			while(edge)
    			{
	    			glBegin(GL_LINE_STRIP);
    				edge->GetVertices(.01,dvCall);
    				glEnd();	
    				
    				edge = face->GetNextEdge();	
    			}	
    		}

    		Topo_Solid *solid = dynamic_cast<Topo_Solid*>(shapes[i]);
    		if(solid)
    		{
    			face = solid->GetFirstFace();
    			while(face)
    			{
    				Topo_Edge* edge = face->GetFirstEdge();
    				while(edge)
    				{
		    			glBegin(GL_LINE_STRIP);
    					edge->GetVertices(.01,dvCall);
    					glEnd();	
    				
    					edge = face->GetNextEdge();	
    				}
    				face = solid->GetNextFace();
    			}	
    		}
    	
 #endif
    	}
    	else
    	{
    		Topo_Edge *edge = dynamic_cast<Topo_Edge*>(shapes[i]);
    		if(edge)
    		{
    			glBegin(GL_LINE_STRIP);
    			edge->GetVertices(.01,dvCall);
    			glEnd();	
    		}
    		
    		Topo_Wire *wire = dynamic_cast<Topo_Wire*>(shapes[i]);
    		if(wire)
    		{
    			glBegin(GL_LINE_STRIP);
    			wire->GetVertices(.01,dvCall);
    			glEnd();	
    		}	
    			
    	}
    }
    
/*    Topo_Face *tface = solid->GetFirstFace();
    while(tface)
    {
        Topo_Edge *tedge = tface->GetFirstEdge();
        while(tedge)
        {
            glBegin(GL_LINE_STRIP);
            tedge->GetVertices(.01,vCall);
            glEnd();

            tedge = tface->GetNextEdge();
        }

        tface = solid->GetNextFace();
    }*/


	glPopMatrix ();

	if (gdk_gl_drawable_is_double_buffered (gldrawable))
		gdk_gl_drawable_swap_buffers (gldrawable);

	else
		glFlush ();

	gdk_gl_drawable_gl_end (gldrawable);

	return TRUE;
}
Пример #7
0
void test_RT()
{
  typedef RT                 Cls;

  //  _test_cls_regular_3( Cls() );
  typedef traits::Bare_point Point;
  typedef traits::Weighted_point Weighted_point;

  typedef typename Cls::Vertex_handle                Vertex_handle;
  typedef typename Cls::Cell_handle                  Cell_handle; 
  typedef typename Cls::Facet                        Facet;
  typedef typename Cls::Edge                         Edge;
  
  typedef std::list<Weighted_point>                  list_point;
  typedef typename Cls::Finite_cells_iterator        Finite_cells_iterator;

  // temporary version

  int n, m;
  int count = 0;

  // For dimension 0, we need to check that the point of highest weight is the
  // one that finally ends up in the vertex.
  std::cout << " test dimension 0 " << std::endl;
  Cls T0;
  T0.insert(Weighted_point( Point (0,0,0), 0) );
  T0.insert(Weighted_point( Point (0,0,0), 1) );
  T0.insert(Weighted_point( Point (0,0,0), -1) );
  assert(T0.dimension() == 0);
  assert(T0.number_of_vertices() == 1);
  assert(T0.finite_vertices_begin()->point().weight() == 1);

  std::cout << " test dimension 1 " << std::endl;
  Cls T1;
  std::cout << " number of inserted points : " ;
  Weighted_point p[5];
  for ( m=0; m<5; m++) {
    if ( (m%2)== 0 ) 
      p[m] = Weighted_point( Point( 2*m,0,0 ), 2 );
    else 
      p[m] = Weighted_point( Point( -2*m+1,0,0 ), 2 );
    T1.insert( p[m] );
    count++;
    if (count <10)
      std::cout << count << '\b' ;
    else
      if (count < 100)
	std::cout << count << '\b' << '\b' ;
      else
	std::cout << count << '\b' << '\b' << '\b' ;
    std::cout.flush();
  }
  assert( T1.is_valid() );
  std::cout << std::endl << " number of vertices : " 
      << T1.number_of_vertices() << std::endl;

  std::cout << " number of inserted points : " ;
  Weighted_point q[5];
  for ( m=0; m<5; m++) {
    if ( (m%2)== 0 )
      q[m] = Weighted_point( Point( 2*m+1,0,0 ), 5 );
    else 
      q[m] = Weighted_point( Point( -2*m+1,0,0 ), 5 );
    T1.insert( q[m] );
    count++;
    if (count <10)
      std::cout << count << '\b' ;
    else
      if (count < 100)
  std::cout << count << '\b' << '\b' ;
      else
  std::cout << count << '\b' << '\b' << '\b' ;
    std::cout.flush();  
  }
  assert( T1.is_valid() );
  std::cout << std::endl << " number of vertices : " 
      << T1.number_of_vertices() << std::endl;

  std::cout << " number of inserted points : " ;
  Weighted_point r[10];
  for ( m=0; m<10; m++) {
    if ( (m%2)== 0 ) 
      r[m] = Weighted_point( Point( m,0,0 ), 1 );
    else 
      r[m] = Weighted_point( Point( -m,0,0 ), 1 );
    T1.insert( r[m] );
    count++;
    if (count <10)
      std::cout << count << '\b' ;
    else
      if (count < 100)
  std::cout << count << '\b' << '\b' ;
      else
  std::cout << count << '\b' << '\b' << '\b' ;
    std::cout.flush();  
  }
  assert( T1.is_valid() );
  std::cout << std::endl << " number of vertices : " 
      << T1.number_of_vertices() << std::endl;
  assert( T1.dimension()==1 );

  // The following is distilled from a bug report by Wulue Zhao
  // ([email protected]), a student of Tamal Dey.
  Point pt0(0,0,0);
  Point pt1( 1,0,0), pt2(2,0,0),  pt3(3,0,0);
  Point pt4(-1,0,0), pt5(-2,0,0), pt6(-3,0,0);

  Weighted_point wp0(pt0,10.0);
  Weighted_point wp1(pt1,0.0),  wp2(pt2,0.0),  wp3(pt3,0.0);
  Weighted_point wp4(pt4,0.0),  wp5(pt5,0.0),  wp6(pt6,0.0);

  Cls T11;

  T11.insert(wp0);
  T11.insert(wp1);
  T11.insert(wp2);
  T11.insert(wp3);
  T11.insert(wp4);
  T11.insert(wp5);
  T11.insert(wp6);

  assert(T11.is_valid());

  // And another distilled bug report from the same guy.
 {
  Point p1(-0.07, 0.04, 0.04);
  Point p2(0.09, 0.04, 0.04);
  Point p3(0.09, -0.05, 0.04);
  Point p4(0.05, -0.05, 0.04);
  Point p5(0.05, 0.0, 0.04);
  Point p6(-0.07, 0.0, 0.04);
  Point p7(-0.07, 0.04, -0.04);
  Point p8(0.09, 0.04, -0.04);
  Point p9(0.09, -0.05, -0.04);
  Point p10(0.05, -0.05, -0.04);
  Point p11(0.05, 0.0, -0.04);
  Point p12(-0.07, 0.0, -0.04);

  Weighted_point wp1(p1,0);
  Weighted_point wp2(p2,0);
  Weighted_point wp3(p3,0);
  Weighted_point wp4(p4,0);
  Weighted_point wp5(p5,0);
  Weighted_point wp6(p6,0);
  Weighted_point wp7(p7,0);
  Weighted_point wp8(p8,0);
  Weighted_point wp9(p9,0);
  Weighted_point wp10(p10,0);
  Weighted_point wp11(p11,0);
  Weighted_point wp12(p12,0);
  Weighted_point wp13(p3,0.3); // wp13 has the same coordinates with wp3

  Cls T111;

  T111.insert(wp1);
  T111.insert(wp2);
  T111.insert(wp3);
  T111.insert(wp13); // it doesnot work inserting wp13 here
  T111.insert(wp4);
  T111.insert(wp5);
  T111.insert(wp6);
  T111.insert(wp7);
  T111.insert(wp8);
  T111.insert(wp9);
  T111.insert(wp10);
  T111.insert(wp11);
  T111.insert(wp12);

  assert(T111.is_valid());
 }

  std::cout << " test dimension 2 " << std::endl;
  std::cout << " number of inserted points : " ;
  Cls T2;

  count = 0 ;
  int px=1, py=1;
  int qx=-1, qy=2;
  Weighted_point s[400];
  for (m=0; m<10; m++)
    for (n=0; n<10; n++) {
      s[m+20*n] = Weighted_point( Point(m*px+n*qx, m*py+n*qy, 0), 1 );
      T2.insert( s[m+20*n] );
      count++;
      if (count <10)
  std::cout << count << '\b' ;
      else
  if (count < 100)
    std::cout << count << '\b' << '\b' ;
  else
    std::cout << count << '\b' << '\b' << '\b' ;
      std::cout.flush();
    }
  for (m=10; m<20; m++)
    for (n=0; n<10; n++) {
      s[m+20*n] = Weighted_point( Point(m*px+n*qx, m*py+n*qy, 0), -1 );
      T2.insert( s[m+20*n] );
      count++;
      if (count <10)
  std::cout << count << '\b' ;
      else
  if (count < 100)
    std::cout << count << '\b' << '\b' ;
  else
    std::cout << count << '\b' << '\b' << '\b' ;
      std::cout.flush();
    }
  for (m=0; m<10; m++)
    for (n=10; n<20; n++) {
      s[m+20*n] = Weighted_point( Point(m*px+n*qx, m*py+n*qy, 0), -2 );
      T2.insert( s[m+20*n] );
      count++;
      if (count <10)
  std::cout << count << '\b' ;
      else
  if (count < 100)
    std::cout << count << '\b' << '\b' ;
  else
    std::cout << count << '\b' << '\b' << '\b' ;
      std::cout.flush();
    }
  for (m=10; m<20; m++)
    for (n=10; n<20; n++) {
      s[m+20*n] = Weighted_point( Point(m*px+n*qx, m*py+n*qy, 0), 5 );
      T2.insert( s[m+20*n] );
      count++;
      if (count <10)
  std::cout << count << '\b' ;
      else
  if (count < 100)
    std::cout << count << '\b' << '\b' ;
  else
    std::cout << count << '\b' << '\b' << '\b' ;
      std::cout.flush();
    }
 
  std::cout << std::endl << " number of vertices : " 
      << T2.number_of_vertices() << std::endl;
  assert( T2.dimension()==2 );
  assert( T2.is_valid() );

 // dimension 3
  std::cout << " test dimension 3" << std::endl;
  Cls T;

  list_point lp;
  int a, b, d;
  for (a=0;a!=10;a++)
    //    for (b=0;b!=10;b++)
    for (b=0;b!=5;b++)
      //      for (d=0;d!=10;d++)
      for (d=0;d!=5;d++)
  lp.push_back(Weighted_point( Point(a*b-d*a + (a-b)*10 +a ,
             a-b+d +5*b,
             a*a-d*d+b),
             a*b-a*d) );
  list_point::iterator it;
  count = 0 ;
  std::cout << " number of inserted points : " ;
  for (it=lp.begin(); it!=lp.end(); ++it){
    count++;
    T.insert(*it);
    if (count <10)
      std::cout << count << '\b' ;
    else
      if (count < 100)
        std::cout << count << '\b' << '\b' ;
      else 
        if (count < 1000)
          std::cout << count << '\b' << '\b' << '\b' ;
        else
    std::cout << count << std::endl;
    std::cout.flush();
  }
  std::cout << std::endl;

  std::cout << " number of vertices : " 
      << T.number_of_vertices() << std::endl;
  assert(T.is_valid());
  assert(T.dimension()==3);

  T.clear();
  std::cout << " test iterator range insert" << std::endl;
  T.insert (lp.begin(), lp.end());

  std::cout << " number of vertices : " 
      << T.number_of_vertices() << std::endl;
  assert(T.is_valid());
  assert(T.dimension()==3);


    //test nearest_power_vertex
  std::cout << " test nearest_power_vertex " << std::endl;
  Point pp1(0.0, 0.0, 0.0);
  Point pp2(1.0, 0.0, 0.0);
  Point pp3(0.0, 1.0, 0.0);
  Point pp4(0.0, 0.0, 1.0);
  Point pp5(1.0, 1.0, 0.0);
  Point pp6(0.0, 1.0, 1.0);
  Point pp7(1.0, 0.0, 1.0);
  Point pp8(1.0, 1.0, 1.0);

  Weighted_point wpp1(pp1, 1.0);
  Weighted_point wpp2(pp2, 2.0);
  Weighted_point wpp3(pp3, 1.0);
  Weighted_point wpp4(pp4, 4.0);
  Weighted_point wpp5(pp5, 1.0);
  Weighted_point wpp6(pp6, 1.0);
  Weighted_point wpp7(pp7, 1.0);
  Weighted_point wpp8(pp8, 8.0);

  Cls T3;

  T3.insert(wpp1);
  Vertex_handle v2 = T3.insert(wpp2);
  assert( T3.nearest_power_vertex(Point(0.5,0.5,0.5)) == v2);
  
  T3.insert(wpp3);
  Vertex_handle v4 = T3.insert(wpp4);
  assert( T3.nearest_power_vertex(Point(0.5,0.5,0.5)) == v4);

  T3.insert(wpp5);
  T3.insert(wpp6);
  T3.insert(wpp7);
  // Avoid inserting the same point twice, now that hidden points are handled,
  // insert (existing_point) returns Vertex_handle().
  // T3.insert(wpp8);
  Vertex_handle v8 = T3.insert(wpp8);
  Point query(0.5,0.5,0.5);
  assert(T3.nearest_power_vertex(query) == v8);
  assert(T3.nearest_power_vertex(Weighted_point(query,1.0)) == v8 );
  assert(T3.nearest_power_vertex_in_cell(query ,v8->cell()) == v8); 
  
  // test dual
  std::cout << " test dual member functions" << std::endl;
  Finite_cells_iterator fcit = T3.finite_cells_begin();
  for( ; fcit != T3.finite_cells_end(); ++fcit) {
    Point cc = T3.dual(fcit);
    Vertex_handle ncc = T3.nearest_power_vertex(cc);
    assert(fcit->has_vertex(ncc));
  }

  // test Gabriel
  std::cout << " test is_Gabriel " << std::endl;
  Point q0(0.,0.,0.);
  Point q1(2.,0.,0.);
  Point q2(0.,2.,0.);
  Point q3(0.,0.,2.);

  Weighted_point wq0(q0,0.);
  Weighted_point wq1(q1,0.);
  Weighted_point wq2(q2,0.);
  Weighted_point wq3(q3,0.);
  Weighted_point wq01(q0,2.);
  
  Cls T4;
  Vertex_handle v0 = T4.insert(wq0);
  Vertex_handle v1 = T4.insert(wq1);
  v2 = T4.insert(wq2);
  Vertex_handle v3 = T4.insert(wq3);
  Cell_handle c;
  int i,j,k,l;
  assert(T4.is_facet(v0,v1,v2,c,j,k,l));
  i = 6 - (j+k+l);
  Facet f = std::make_pair(c,i);
  assert(T4.is_Gabriel(c,i));
  assert(T4.is_Gabriel(f));
  assert(T4.is_facet(v1,v2,v3,c,j,k,l));
  i = 6 - (j+k+l);
  assert(!T4.is_Gabriel(c,i));
  assert(T4.is_edge(v0,v1,c,i,j));
  assert(T4.is_Gabriel(c,i,j));
  Edge e = make_triple(c,i,j);
  assert(T4.is_Gabriel(e));
  assert(T4.is_edge(v2,v3,c,i,j));
  assert(T4.is_Gabriel(c,i,j));
  
  Vertex_handle v01 = T4.insert(wq01);
  (void) v01; // kill warning
  assert(T4.is_edge(v2,v3,c,i,j));
  assert(!T4.is_Gabriel(c,i,j));

  Weighted_point wwq0(q0,0.);
  Weighted_point wwq1(q1,0.);
  Weighted_point wwq2(q2,0.);
  Weighted_point wwq3(q3,5.);
  Cls T5;
  v0 = T5.insert(wwq0);
  v1 = T5.insert(wwq1);
  v2 = T5.insert(wwq2);
  v3 = T5.insert(wwq3);
  assert(T5.nearest_power_vertex(v3->point().point()) == v3);
  assert(T5.nearest_power_vertex(v0->point().point()) == v3);
  assert(T5.is_Gabriel(v3));
  assert(!T5.is_Gabriel(v0));
}