Skip to content

Commit b4ad02d

Browse files
authored
Merge pull request #555 from verilog-to-routing/master
[pull] master from verilog-to-routing:master
2 parents dadca7e + de62b15 commit b4ad02d

19 files changed

+881
-4372
lines changed

libs/libvtrutil/src/vtr_geometry.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -141,6 +141,10 @@ class Rect {
141141
template<class T>
142142
Rect<T> bounding_box(const Rect<T>& lhs, const Rect<T>& rhs);
143143

144+
//Return the intersection of two given rectangles
145+
template<class T>
146+
Rect<T> intersection(const Rect<T>& lhs, const Rect<T>& rhs);
147+
144148
//Sample on a uniformly spaced grid within a rectangle
145149
// sample(vtr::Rect(l, h), 0, 0, M) == l
146150
// sample(vtr::Rect(l, h), M, M, M) == h

libs/libvtrutil/src/vtr_geometry.tpp

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -182,6 +182,13 @@ Rect<T> bounding_box(const Rect<T>& lhs, const Rect<T>& rhs) {
182182
std::max(lhs.ymax(), rhs.ymax()));
183183
}
184184

185+
template<class T>
186+
Rect<T> intersection(const Rect<T>& lhs, const Rect<T>& rhs) {
187+
return Rect<T>(std::max(lhs.xmin(), rhs.xmin()),
188+
std::max(lhs.ymin(), rhs.ymin()),
189+
std::min(lhs.xmax(), rhs.xmax()),
190+
std::min(lhs.ymax(), rhs.ymax()));
191+
}
185192
//Only defined for integral types
186193
template<typename T, typename std::enable_if<std::is_integral<T>::value>::type...>
187194
Point<T> sample(const vtr::Rect<T>& r, T x, T y, T d) {

run_quick_test.pl

Lines changed: 0 additions & 22 deletions
This file was deleted.

0 commit comments

Comments
 (0)