Пример #1
0
MaybeDiff Difference(const Edge& lhs, const Edge& rhs) {
  if (IsAdherable(lhs, rhs)) {
    return rhs.End() - lhs.Begin();
  } else {
    return boost::none;
  }
}
Пример #2
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;
  }
}