Exemple #1
0
void
Trace::push_back(const AircraftState& state)
{
  assert(cached_size == delta_list.size());
  assert(cached_size == chronological_list.Count());

  if (empty()) {
    // first point determines origin for flat projection
    task_projection.reset(state.location);
    task_projection.update_fast();
  } else if (state.time < fixed(back().GetTime())) {
    // gone back in time

    if (unsigned(state.time) + 180 < back().GetTime()) {
      /* not fixable, clear the trace and restart from scratch */
      clear();
      return;
    }

    /* not much, try to fix it */
    EraseLaterThan(unsigned(state.time) - 10);
  } else if ((unsigned)state.time - back().GetTime() < 2)
    // only add one item per two seconds
    return;

  TracePoint tp(state);
  tp.project(task_projection);

  EnforceTimeWindow(tp.GetTime());

  if (size() >= max_size)
    Thin();

  assert(size() < max_size);

  TraceDelta &td = Insert(tp);
  td.InsertBefore(chronological_list);

  ++cached_size;

  if (!chronological_list.IsFirst(td))
    UpdateDelta(td.GetPrevious());

  ++append_serial;
}
Exemple #2
0
void
Trace::append(const AircraftState& state)
{
  assert(cached_size == delta_list.size());
  assert(cached_size == chronological_list.Count());

  if (empty()) {
    // first point determines origin for flat projection
    task_projection.reset(state.location);
    task_projection.update_fast();
  } else if (state.time < fixed(back().GetTime())) {
    // gone back in time, must reset. (shouldn't get here!)
    assert(1);
    clear();
    return;
  } else if ((unsigned)state.time - back().GetTime() < 2)
    // only add one item per two seconds
    return;

  if (size() >= m_max_points)
    Thin();

  assert(size() < m_max_points);

  TracePoint tp(state);
  tp.project(task_projection);

  TraceDelta &td = insert(tp);
  td.InsertBefore(chronological_list);

  ++cached_size;

  if (!chronological_list.IsFirst(td))
    update_delta(td.GetPrevious());

  ++append_serial;
}
void Binarization::Converge(unsigned char *buffer_in, unsigned char *buffer_out, bool inverse) {
	Thin(buffer_in, buffer_out, inverse);
	for(int i = 0; i < iterations_converging_ - 1; i++)
		Thin(buffer_out, buffer_out, inverse);
}