Added minimum distance between points when creating objects, and also deselecting objects with lasso tool improved

This commit is contained in:
Yousef Khadadeh 2025-08-06 10:39:34 +03:00
parent 7ffa039061
commit 6d8d532952
7 changed files with 22 additions and 1 deletions

View file

@ -275,3 +275,12 @@ template <typename T> std::string vec_pretty(const Vector<T, 2>& a) {
ss << "[" << a.x() << ", " << a.y() << "]";
return ss.str();
}
template <typename T> Vector<T, 2> ensure_points_have_distance(const Vector<T, 2>& a, const Vector<T, 2>& b, T d) {
Vector<T, 2> toRet = b;
if(std::abs(a.x() - b.x()) < d)
toRet.x() = a.x() + d;
if(std::abs(a.y() - b.y()) < d)
toRet.y() = a.y() + d;
return toRet;
}