示例#1
0
bool IsSameEnough(const Edge& lhs, const Edge& rhs) {
  if (IsSameEnough(lhs.Center(), rhs.Center()) &&
      lhs.Length() == rhs.Length()) {
    Q_ASSERT((IsSameEnough(lhs.Begin(), rhs.Begin()) &&
              IsSameEnough(lhs.End(), rhs.End()) &&
              !IsSameEnough(lhs.Begin(), rhs.End()) &&
              !IsSameEnough(lhs.End(), rhs.Begin()) &&
              AngleDistance(lhs, rhs) == 0.0) ||
             (!IsSameEnough(lhs.Begin(), rhs.Begin()) &&
              !IsSameEnough(lhs.End(), rhs.End()) &&
              IsSameEnough(lhs.Begin(), rhs.End()) &&
              IsSameEnough(lhs.End(), rhs.Begin()) &&
              AngleDistance(lhs, rhs) == 180.0));
    return true;
  } else {
    return false;
  }
}
 set<Edge*> GetPrevEdges(size_t dist) {
     size_t init_len = Length();
     Edge* e = this;
     set<Edge*> result;
     while (e && init_len - e->Length() < dist) {
         result.insert(e);
         e = e->prev_edge_;
     }
     return result;
 }