Skip to content

Commit 845d02a

Browse files
committed
mpl: remove unneeded function and alias from util.h
Signed-off-by: Arthur Koucher <[email protected]>
1 parent 9d95cd3 commit 845d02a

File tree

2 files changed

+4
-11
lines changed

2 files changed

+4
-11
lines changed

src/mpl/src/object.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,7 @@ class SoftMacro;
6868
class Cluster;
6969

7070
using 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

src/mpl/src/util.h

Lines changed: 3 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -39,8 +39,6 @@
3939

4040
namespace mpl {
4141

42-
using Point = std::pair<float, float>;
43-
4442
struct 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-
7667
inline 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();

0 commit comments

Comments
 (0)