Пример #1
0
void
TaskPointTest::Run()
{
  GeoPoint gp1(Angle::degrees(fixed(20)), Angle::degrees(fixed(50)));
  GeoPoint gp2(Angle::degrees(fixed(21)), Angle::degrees(fixed(50)));

  DummyTaskPoint tp1(TaskPoint::AST, gp1, fixed(1234));
  DummyTaskPoint tp2(TaskPoint::AAT, gp2, fixed(1337));
  DummyTaskPoint tp3(TaskPoint::START, gp1, fixed(1234));
  DummyTaskPoint tp4(TaskPoint::FINISH, gp2, fixed(1337));

  ok1(tp1.IsIntermediatePoint());
  ok1(tp1.GetType() == TaskPoint::AST);
  ok1(equals(tp1.GetBaseElevation(), 1234));
  ok1(!tp1.HasTarget());
  ok1(equals(tp1.Distance(gp2), gp1.distance(gp2)));
  ok1(equals(tp1.GetLocation(), gp1));

  ok1(tp2.IsIntermediatePoint());
  ok1(tp2.GetType() == TaskPoint::AAT);
  ok1(tp2.HasTarget());

  ok1(!tp3.IsIntermediatePoint());
  ok1(tp3.GetType() == TaskPoint::START);
  ok1(!tp3.HasTarget());

  ok1(!tp4.IsIntermediatePoint());
  ok1(tp4.GetType() == TaskPoint::FINISH);
  ok1(!tp4.HasTarget());
}
Пример #2
0
int main()
{

  // First, some point examples

  tracktable::TrajectoryPoint tp1(100.0,40);
  tracktable::TrajectoryPoint tp2(105.0,45);

  // This works, but...
  boost::geometry::distance<
     tracktable::PointBaseLonLat<double>,
     tracktable::PointBaseLonLat<double> >(tp1,tp2);

  // This doesn't.  Probably a boost geometry registration issue...
  boost::geometry::distance(tp1,tp2);


  // Now some point/track distance examples

  tracktable::TrajectoryPoint tp3(110.0,30);
  tracktable::TrajectoryPoint tp4(115.0,35);
  tracktable::TrajectoryPoint tp5(120.0,40);
  tracktable::TrajectoryPoint tp6(125.0,45);

  tracktable::PointBaseLonLat<double> ll3(110.0,30);
  tracktable::PointBaseLonLat<double> ll4(115.0,35);
  tracktable::PointBaseLonLat<double> ll5(120.0,40);
  tracktable::PointBaseLonLat<double> ll6(125.0,45);

  tracktable::Trajectory<tracktable::TrajectoryPoint> tp_traj;
  tracktable::Trajectory<tracktable::PointBaseLonLat<double> > ll_traj;

  tp_traj.add_point(tp3);
  tp_traj.add_point(tp4);
  tp_traj.add_point(tp5);
  tp_traj.add_point(tp6);

  ll_traj.add_point(ll3);
  ll_traj.add_point(ll4);
  ll_traj.add_point(ll5);
  ll_traj.add_point(ll6);

  // This doesn't work, but probably would if the linestring was registered
  boost::geometry::distance(ll_traj,ll3);

  // This doesn't work and needs to linestring and point registered
  boost::geometry::distance(tp_traj,tp3);

  // Now some math examples

  // This doesn't work...
  boost::geometry::multiply_value(tp3,0.5);

  // ...but this does.  Again, probably a registration issue
  boost::geometry::multiply_value(ll3,0.5);

  return 0;
}
Пример #3
0
int main(int argc, char *argv[])
{
	TreeNode tp1(1);
	TreeNode tq1(1);
	TreeNode tp2(2);
	TreeNode tq2(2);
	TreeNode tp3(3);
	TreeNode tq3(3);
	//tp1.left = &tp2;
	//tp1.right = &tp3;
	//tq1.left = &tq2;
	//tq1.right = &tq3;

	Solution so;
	std::cout << so.isSameTree(&tp1, &tp2) << std::endl;

	return 0;
}