MaybeDiff Difference(const Tile& lhs, const Edge& rhs) { if (const auto adherable = GetAdherableEdge(lhs, rhs)) { return rhs.End() - adherable->Begin(); } else { return boost::none; } }
MaybeDiff Difference(const Edge& lhs, const Edge& rhs) { if (IsAdherable(lhs, rhs)) { return rhs.End() - lhs.Begin(); } else { return boost::none; } }
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; } }