File tree Expand file tree Collapse file tree 2 files changed +4
-11
lines changed
Expand file tree Collapse file tree 2 files changed +4
-11
lines changed Original file line number Diff line number Diff line change @@ -68,6 +68,7 @@ class SoftMacro;
6868class Cluster ;
6969
7070using UniqueClusterVector = std::vector<std::unique_ptr<Cluster>>;
71+ using Point = std::pair<float , float >;
7172
7273// ****************************************************************************
7374// This file includes the basic functions and basic classes for the HierRTLMP
Original file line number Diff line number Diff line change 3939
4040namespace mpl {
4141
42- using Point = std::pair<float , float >;
43-
4442struct SACoreWeights
4543{
4644 float area{0 .0f };
@@ -66,21 +64,15 @@ struct PenaltyData
6664 float normalization_factor{0 .0f };
6765};
6866
69- inline int computeDistance (const odb::Point& from, const odb::Point& to)
70- {
71- const int dx = std::abs (from.getX () - to.getX ());
72- const int dy = std::abs (from.getY () - to.getY ());
73- return static_cast <int >(std::sqrt (std::pow (dx, 2 ) + std::pow (dy, 2 )));
74- }
75-
7667inline odb::Point findCenterOfClosestRegion (
7768 const odb::Point& from,
7869 const std::vector<odb::Rect>& regions)
7970{
8071 odb::Point to;
81- int dist_to_closest_region = std::numeric_limits<int >::max ();
72+ double dist_to_closest_region = std::numeric_limits<double >::max ();
8273 for (const odb::Rect& region : regions) {
83- const int dist_to_region = computeDistance (from, region.center ());
74+ const double dist_to_region
75+ = std::sqrt (odb::Point::squaredDistance (from, region.center ()));
8476 if (dist_to_region < dist_to_closest_region) {
8577 dist_to_closest_region = dist_to_region;
8678 to = region.center ();
You can’t perform that action at this time.
0 commit comments