Ejemplo n.º 1
0
static wp_vector
CreateOriginalWaypoints()
{
  wp_vector org_wp;

  GeoPoint loc;

  // Bergneustadt
  loc.Latitude = Angle::degrees(fixed(51.051944444444445));
  loc.Longitude = Angle::degrees(fixed(7.7061111111111114));

  Waypoint wp(loc);
  wp.Altitude = fixed(488);
  wp.Name = _T("Bergneustadt");

  wp.Flags.Airport = true;
  wp.Flags.TurnPoint = true;
  wp.Flags.LandPoint = false;
  wp.Flags.Home = true;
  wp.Flags.StartPoint = false;
  wp.Flags.FinishPoint = false;
  wp.Flags.Restricted = false;
  org_wp.push_back(wp);

  // Aconcagua
  loc.Latitude = Angle::dms(fixed(32), fixed(39), fixed(12)).flipped();
  loc.Longitude = Angle::dms(fixed(70), fixed(0), fixed(42)).flipped();

  Waypoint wp2(loc);
  wp2.Altitude = fixed(6962);
  wp2.Name = _T("Aconcagua");

  wp2.Flags.Airport = false;
  wp2.Flags.TurnPoint = true;
  wp2.Flags.LandPoint = false;
  wp2.Flags.Home = false;
  wp2.Flags.StartPoint = false;
  wp2.Flags.FinishPoint = false;
  wp2.Flags.Restricted = false;
  org_wp.push_back(wp2);

  // Golden Gate Bridge
  loc.Latitude = Angle::dms(fixed(37), fixed(49), fixed(3));
  loc.Longitude = Angle::dms(fixed(122), fixed(28), fixed(42)).flipped();

  Waypoint wp3(loc);
  wp3.Altitude = fixed(227);
  wp3.Name = _T("Golden Gate Bridge");

  wp3.Flags.Airport = false;
  wp3.Flags.TurnPoint = true;
  wp3.Flags.LandPoint = false;
  wp3.Flags.Home = false;
  wp3.Flags.StartPoint = false;
  wp3.Flags.FinishPoint = false;
  wp3.Flags.Restricted = false;
  org_wp.push_back(wp3);

  // Red Square
  loc.Latitude = Angle::dms(fixed(55), fixed(45), fixed(15));
  loc.Longitude = Angle::dms(fixed(37), fixed(37), fixed(12));

  Waypoint wp4(loc);
  wp4.Altitude = fixed(123);
  wp4.Name = _T("Red Square");

  wp4.Flags.Airport = false;
  wp4.Flags.TurnPoint = true;
  wp4.Flags.LandPoint = true;
  wp4.Flags.Home = false;
  wp4.Flags.StartPoint = false;
  wp4.Flags.FinishPoint = false;
  wp4.Flags.Restricted = false;
  org_wp.push_back(wp4);

  // Sydney Opera
  loc.Latitude = Angle::dms(fixed(33), fixed(51), fixed(25)).flipped();
  loc.Longitude = Angle::dms(fixed(151), fixed(12), fixed(55));

  Waypoint wp5(loc);
  wp5.Altitude = fixed(5);
  wp5.Name = _T("Sydney Opera");

  wp5.Flags.Airport = false;
  wp5.Flags.TurnPoint = true;
  wp5.Flags.LandPoint = false;
  wp5.Flags.Home = false;
  wp5.Flags.StartPoint = false;
  wp5.Flags.FinishPoint = false;
  wp5.Flags.Restricted = false;
  org_wp.push_back(wp5);

  return org_wp;
}
static wp_vector
CreateOriginalWaypoints()
{
    wp_vector org_wp;

    GeoPoint loc;

    // Bergneustadt
    loc.latitude = Angle::Degrees(51.051944444444445);
    loc.longitude = Angle::Degrees(7.7061111111111114);

    Waypoint wp(loc);
    wp.elevation = fixed(488);
    wp.name = _T("Bergneustadt");
    wp.comment = _T("Rabbit holes, 20\" ditch south end of rwy");
    wp.runway.SetDirection(Angle::Degrees(40));
    wp.runway.SetLength(590);

    wp.type = Waypoint::Type::AIRFIELD;
    wp.flags.turn_point = true;
    wp.flags.home = true;
    wp.flags.start_point = false;
    wp.flags.finish_point = false;
    org_wp.push_back(wp);

    // Aconcagua
    loc.latitude = Angle::DMS(32, 39, 12).Flipped();
    loc.longitude = Angle::DMS(70, 0, 42).Flipped();

    Waypoint wp2(loc);
    wp2.elevation = fixed(6962);
    wp2.name = _T("Aconcagua");
    wp2.comment = _T("Highest mountain in south-america");

    wp2.type = Waypoint::Type::MOUNTAIN_TOP;
    wp2.flags.turn_point = true;
    wp2.flags.home = false;
    wp2.flags.start_point = false;
    wp2.flags.finish_point = false;
    org_wp.push_back(wp2);

    // Golden Gate Bridge
    loc.latitude = Angle::DMS(37, 49, 3);
    loc.longitude = Angle::DMS(122, 28, 42).Flipped();

    Waypoint wp3(loc);
    wp3.elevation = fixed(227);
    wp3.name = _T("Golden Gate Bridge");
    wp3.comment = _T("");

    wp3.type = Waypoint::Type::BRIDGE;
    wp3.flags.turn_point = true;
    wp3.flags.home = false;
    wp3.flags.start_point = false;
    wp3.flags.finish_point = false;
    org_wp.push_back(wp3);

    // Red Square
    loc.latitude = Angle::DMS(55, 45, 15);
    loc.longitude = Angle::DMS(37, 37, 12);

    Waypoint wp4(loc);
    wp4.elevation = fixed(123);
    wp4.name = _T("Red Square");
    wp4.runway.SetDirection(Angle::Degrees(90));
    wp4.runway.SetLength((unsigned)Units::ToSysUnit(fixed(0.01), Unit::STATUTE_MILES));

    wp4.type = Waypoint::Type::OUTLANDING;
    wp4.flags.turn_point = true;
    wp4.flags.home = false;
    wp4.flags.start_point = false;
    wp4.flags.finish_point = false;
    org_wp.push_back(wp4);

    // Sydney Opera
    loc.latitude = Angle::DMS(33, 51, 25).Flipped();
    loc.longitude = Angle::DMS(151, 12, 55);

    Waypoint wp5(loc);
    wp5.elevation = fixed(5);
    wp5.name = _T("Sydney Opera");
    wp5.comment = _T("");

    wp5.type = Waypoint::Type::NORMAL;
    wp5.flags.turn_point = true;
    wp5.flags.home = false;
    wp5.flags.start_point = false;
    wp5.flags.finish_point = false;
    org_wp.push_back(wp5);

    return org_wp;
}
Ejemplo n.º 3
0
static wp_vector
CreateOriginalWaypoints()
{
    wp_vector org_wp;

    GeoPoint loc;

    // Bergneustadt
    loc.Latitude = Angle::degrees(fixed(51.051944444444445));
    loc.Longitude = Angle::degrees(fixed(7.7061111111111114));

    Waypoint wp(loc);
    wp.altitude = fixed(488);
    wp.name = _T("Bergneustadt");
    wp.comment = _T("Rabbit holes, 20\" ditch south end of rwy");
    wp.runway.SetDirection(Angle::degrees(fixed(40)));
    wp.runway.SetLength(590);

    wp.type = Waypoint::TYPE_AIRFIELD;
    wp.flags.turn_point = true;
    wp.flags.home = true;
    wp.flags.start_point = false;
    wp.flags.finish_point = false;
    org_wp.push_back(wp);

    // Aconcagua
    loc.Latitude = Angle::dms(fixed(32), fixed(39), fixed(12)).flipped();
    loc.Longitude = Angle::dms(fixed(70), fixed(0), fixed(42)).flipped();

    Waypoint wp2(loc);
    wp2.altitude = fixed(6962);
    wp2.name = _T("Aconcagua");
    wp2.comment = _T("Highest mountain in south-america");

    wp2.type = Waypoint::TYPE_MOUNTAIN_TOP;
    wp2.flags.turn_point = true;
    wp2.flags.home = false;
    wp2.flags.start_point = false;
    wp2.flags.finish_point = false;
    org_wp.push_back(wp2);

    // Golden Gate Bridge
    loc.Latitude = Angle::dms(fixed(37), fixed(49), fixed(3));
    loc.Longitude = Angle::dms(fixed(122), fixed(28), fixed(42)).flipped();

    Waypoint wp3(loc);
    wp3.altitude = fixed(227);
    wp3.name = _T("Golden Gate Bridge");
    wp3.comment = _T("");

    wp3.type = Waypoint::TYPE_BRIDGE;
    wp3.flags.turn_point = true;
    wp3.flags.home = false;
    wp3.flags.start_point = false;
    wp3.flags.finish_point = false;
    org_wp.push_back(wp3);

    // Red Square
    loc.Latitude = Angle::dms(fixed(55), fixed(45), fixed(15));
    loc.Longitude = Angle::dms(fixed(37), fixed(37), fixed(12));

    Waypoint wp4(loc);
    wp4.altitude = fixed(123);
    wp4.name = _T("Red Square");
    wp4.runway.SetDirection(Angle::degrees(fixed(90)));
    wp4.runway.SetLength(Units::ToSysUnit(fixed(0.01), unStatuteMiles));

    wp4.type = Waypoint::TYPE_OUTLANDING;
    wp4.flags.turn_point = true;
    wp4.flags.home = false;
    wp4.flags.start_point = false;
    wp4.flags.finish_point = false;
    org_wp.push_back(wp4);

    // Sydney Opera
    loc.Latitude = Angle::dms(fixed(33), fixed(51), fixed(25)).flipped();
    loc.Longitude = Angle::dms(fixed(151), fixed(12), fixed(55));

    Waypoint wp5(loc);
    wp5.altitude = fixed(5);
    wp5.name = _T("Sydney Opera");
    wp5.comment = _T("");

    wp5.type = Waypoint::TYPE_NORMAL;
    wp5.flags.turn_point = true;
    wp5.flags.home = false;
    wp5.flags.start_point = false;
    wp5.flags.finish_point = false;
    org_wp.push_back(wp5);

    return org_wp;
}
Ejemplo n.º 4
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));
}