mirror of
https://github.com/The-OpenROAD-Project/RePlAce.git
synced 2026-05-30 03:35:07 +08:00
rename Coordi -> Point
This commit is contained in:
@@ -61,7 +61,7 @@ set (REPLACE_SRC
|
||||
src/fft.cpp
|
||||
src/fftsg.cpp
|
||||
src/fftsg2d.cpp
|
||||
src/coordi.cpp
|
||||
src/point.cpp
|
||||
src/plot.cpp
|
||||
src/logger.cpp
|
||||
)
|
||||
|
||||
@@ -1,17 +0,0 @@
|
||||
#include "coordi.h"
|
||||
|
||||
namespace replace {
|
||||
|
||||
FloatCoordi::FloatCoordi() : x(0), y(0) {}
|
||||
FloatCoordi::FloatCoordi(float inputX, float inputY) {
|
||||
x = inputX;
|
||||
y = inputY;
|
||||
}
|
||||
|
||||
IntCoordi::IntCoordi() : x(0), y(0) {}
|
||||
IntCoordi::IntCoordi(int inputX, int inputY) {
|
||||
x = inputX;
|
||||
y = inputY;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1170,7 +1170,7 @@ NesterovBase::placerToNesterov(Pin* pin) {
|
||||
// gcell update
|
||||
void
|
||||
NesterovBase::updateGCellLocation(
|
||||
std::vector<FloatCoordi>& coordis) {
|
||||
std::vector<FloatPoint>& coordis) {
|
||||
for(auto& coordi : coordis) {
|
||||
int idx = &coordi - &coordis[0];
|
||||
gCells_[idx]->setLocation( coordi.x, coordi.y );
|
||||
@@ -1180,7 +1180,7 @@ NesterovBase::updateGCellLocation(
|
||||
// gcell update
|
||||
void
|
||||
NesterovBase::updateGCellCenterLocation(
|
||||
std::vector<FloatCoordi>& coordis) {
|
||||
std::vector<FloatPoint>& coordis) {
|
||||
for(auto& coordi : coordis) {
|
||||
int idx = &coordi - &coordis[0];
|
||||
gCells_[idx]->setCenterLocation( coordi.x, coordi.y );
|
||||
@@ -1189,7 +1189,7 @@ NesterovBase::updateGCellCenterLocation(
|
||||
|
||||
void
|
||||
NesterovBase::updateGCellDensityCenterLocation(
|
||||
std::vector<FloatCoordi>& coordis) {
|
||||
std::vector<FloatPoint>& coordis) {
|
||||
for(auto& coordi : coordis) {
|
||||
int idx = &coordi - &coordis[0];
|
||||
gCells_[idx]->setDensityCenterLocation(
|
||||
@@ -1347,9 +1347,9 @@ NesterovBase::updateWireLengthForceWA(
|
||||
}
|
||||
|
||||
// get x,y WA Gradient values with given GCell
|
||||
FloatCoordi
|
||||
FloatPoint
|
||||
NesterovBase::getWireLengthGradientWA(GCell* gCell, float wlCoeffX, float wlCoeffY) {
|
||||
FloatCoordi gradientPair;
|
||||
FloatPoint gradientPair;
|
||||
|
||||
for(auto& gPin : gCell->gPins()) {
|
||||
auto tmpPair = getWireLengthGradientPinWA(gPin, wlCoeffX, wlCoeffY);
|
||||
@@ -1367,7 +1367,7 @@ NesterovBase::getWireLengthGradientWA(GCell* gCell, float wlCoeffX, float wlCoef
|
||||
//
|
||||
// You can't understand the following function
|
||||
// unless you read the (4.13) formula
|
||||
FloatCoordi
|
||||
FloatPoint
|
||||
NesterovBase::getWireLengthGradientPinWA(GPin* gPin, float wlCoeffX, float wlCoeffY) {
|
||||
|
||||
float gradientMinX = 0, gradientMinY = 0;
|
||||
@@ -1422,34 +1422,34 @@ NesterovBase::getWireLengthGradientPinWA(GPin* gPin, float wlCoeffX, float wlCoe
|
||||
/ ( waExpMaxSumY * waExpMaxSumY );
|
||||
}
|
||||
|
||||
return FloatCoordi(gradientMinX - gradientMaxX,
|
||||
return FloatPoint(gradientMinX - gradientMaxX,
|
||||
gradientMinY - gradientMaxY);
|
||||
}
|
||||
|
||||
FloatCoordi
|
||||
FloatPoint
|
||||
NesterovBase::getWireLengthPreconditioner(GCell* gCell) {
|
||||
return FloatCoordi( gCell->gPins().size(),
|
||||
return FloatPoint( gCell->gPins().size(),
|
||||
gCell->gPins().size() );
|
||||
}
|
||||
|
||||
FloatCoordi
|
||||
FloatPoint
|
||||
NesterovBase::getDensityPreconditioner(GCell* gCell) {
|
||||
float areaVal = static_cast<float>(gCell->dx())
|
||||
* static_cast<float>(gCell->dy());
|
||||
|
||||
return FloatCoordi(areaVal, areaVal);
|
||||
return FloatPoint(areaVal, areaVal);
|
||||
}
|
||||
|
||||
// get GCells' electroForcePair
|
||||
// i.e. get DensityGradient with given GCell
|
||||
FloatCoordi
|
||||
FloatPoint
|
||||
NesterovBase::getDensityGradient(GCell* gCell) {
|
||||
std::pair<int, int> pairX
|
||||
= bg_.getDensityMinMaxIdxX(gCell);
|
||||
std::pair<int, int> pairY
|
||||
= bg_.getDensityMinMaxIdxY(gCell);
|
||||
|
||||
FloatCoordi electroForce;
|
||||
FloatPoint electroForce;
|
||||
|
||||
for(int i = pairX.first; i < pairX.second; i++) {
|
||||
for(int j = pairY.first; j < pairY.second; j++) {
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
#include <memory>
|
||||
#include <unordered_map>
|
||||
|
||||
#include "coordi.h"
|
||||
#include "point.h"
|
||||
|
||||
namespace replace {
|
||||
|
||||
@@ -730,14 +730,14 @@ public:
|
||||
|
||||
// update gCells with lx, ly
|
||||
void updateGCellLocation(
|
||||
std::vector<FloatCoordi>& coordis);
|
||||
std::vector<FloatPoint>& points);
|
||||
|
||||
// update gCells with cx, cy
|
||||
void updateGCellCenterLocation(
|
||||
std::vector<FloatCoordi>& coordis);
|
||||
std::vector<FloatPoint>& points);
|
||||
|
||||
void updateGCellDensityCenterLocation(
|
||||
std::vector<FloatCoordi>& coordis);
|
||||
std::vector<FloatPoint>& points);
|
||||
|
||||
int binCntX() const;
|
||||
int binCntY() const;
|
||||
@@ -766,22 +766,22 @@ public:
|
||||
float wlCoeffX,
|
||||
float wlCoeffY);
|
||||
|
||||
FloatCoordi
|
||||
FloatPoint
|
||||
getWireLengthGradientPinWA(GPin* gPin,
|
||||
float wlCoeffX, float wlCoeffY);
|
||||
|
||||
FloatCoordi
|
||||
FloatPoint
|
||||
getWireLengthGradientWA(GCell* gCell,
|
||||
float wlCoeffX, float wlCoeffY);
|
||||
|
||||
// for preconditioner
|
||||
FloatCoordi
|
||||
FloatPoint
|
||||
getWireLengthPreconditioner(GCell* gCell);
|
||||
|
||||
FloatCoordi
|
||||
FloatPoint
|
||||
getDensityPreconditioner(GCell* gCell);
|
||||
|
||||
FloatCoordi
|
||||
FloatPoint
|
||||
getDensityGradient(GCell* gCell);
|
||||
|
||||
int64_t getHpwl();
|
||||
|
||||
@@ -11,10 +11,10 @@ using namespace std;
|
||||
namespace replace {
|
||||
|
||||
static float
|
||||
getDistance(vector<FloatCoordi>& a, vector<FloatCoordi>& b);
|
||||
getDistance(vector<FloatPoint>& a, vector<FloatPoint>& b);
|
||||
|
||||
static float
|
||||
getSecondNorm(vector<FloatCoordi>& a);
|
||||
getSecondNorm(vector<FloatPoint>& a);
|
||||
|
||||
NesterovPlaceVars::NesterovPlaceVars()
|
||||
: maxNesterovIter(2000),
|
||||
@@ -65,23 +65,23 @@ void NesterovPlace::init() {
|
||||
log_->procBegin("NesterovInit", 3);
|
||||
|
||||
const int gCellSize = nb_->gCells().size();
|
||||
curSLPCoordi_.resize(gCellSize, FloatCoordi());
|
||||
curSLPWireLengthGrads_.resize(gCellSize, FloatCoordi());
|
||||
curSLPDensityGrads_.resize(gCellSize, FloatCoordi());
|
||||
curSLPSumGrads_.resize(gCellSize, FloatCoordi());
|
||||
curSLPCoordi_.resize(gCellSize, FloatPoint());
|
||||
curSLPWireLengthGrads_.resize(gCellSize, FloatPoint());
|
||||
curSLPDensityGrads_.resize(gCellSize, FloatPoint());
|
||||
curSLPSumGrads_.resize(gCellSize, FloatPoint());
|
||||
|
||||
nextSLPCoordi_.resize(gCellSize, FloatCoordi());
|
||||
nextSLPWireLengthGrads_.resize(gCellSize, FloatCoordi());
|
||||
nextSLPDensityGrads_.resize(gCellSize, FloatCoordi());
|
||||
nextSLPSumGrads_.resize(gCellSize, FloatCoordi());
|
||||
nextSLPCoordi_.resize(gCellSize, FloatPoint());
|
||||
nextSLPWireLengthGrads_.resize(gCellSize, FloatPoint());
|
||||
nextSLPDensityGrads_.resize(gCellSize, FloatPoint());
|
||||
nextSLPSumGrads_.resize(gCellSize, FloatPoint());
|
||||
|
||||
prevSLPCoordi_.resize(gCellSize, FloatCoordi());
|
||||
prevSLPWireLengthGrads_.resize(gCellSize, FloatCoordi());
|
||||
prevSLPDensityGrads_.resize(gCellSize, FloatCoordi());
|
||||
prevSLPSumGrads_.resize(gCellSize, FloatCoordi());
|
||||
prevSLPCoordi_.resize(gCellSize, FloatPoint());
|
||||
prevSLPWireLengthGrads_.resize(gCellSize, FloatPoint());
|
||||
prevSLPDensityGrads_.resize(gCellSize, FloatPoint());
|
||||
prevSLPSumGrads_.resize(gCellSize, FloatPoint());
|
||||
|
||||
curCoordi_.resize(gCellSize, FloatCoordi());
|
||||
nextCoordi_.resize(gCellSize, FloatCoordi());
|
||||
curCoordi_.resize(gCellSize, FloatPoint());
|
||||
nextCoordi_.resize(gCellSize, FloatPoint());
|
||||
|
||||
for(auto& gCell : nb_->gCells()) {
|
||||
nb_->updateDensityCoordiLayoutInside( gCell );
|
||||
@@ -89,7 +89,7 @@ void NesterovPlace::init() {
|
||||
curSLPCoordi_[idx]
|
||||
= prevSLPCoordi_[idx]
|
||||
= curCoordi_[idx]
|
||||
= FloatCoordi(gCell->dCx(), gCell->dCy());
|
||||
= FloatPoint(gCell->dCx(), gCell->dCy());
|
||||
}
|
||||
|
||||
// bin update
|
||||
@@ -174,23 +174,23 @@ void NesterovPlace::init() {
|
||||
|
||||
// clear reset
|
||||
void NesterovPlace::reset() {
|
||||
vector<FloatCoordi> ().swap(curSLPCoordi_);
|
||||
vector<FloatCoordi> ().swap(curSLPWireLengthGrads_);
|
||||
vector<FloatCoordi> ().swap(curSLPDensityGrads_);
|
||||
vector<FloatCoordi> ().swap(curSLPSumGrads_);
|
||||
vector<FloatPoint> ().swap(curSLPCoordi_);
|
||||
vector<FloatPoint> ().swap(curSLPWireLengthGrads_);
|
||||
vector<FloatPoint> ().swap(curSLPDensityGrads_);
|
||||
vector<FloatPoint> ().swap(curSLPSumGrads_);
|
||||
|
||||
vector<FloatCoordi> ().swap(nextSLPCoordi_);
|
||||
vector<FloatCoordi> ().swap(nextSLPWireLengthGrads_);
|
||||
vector<FloatCoordi> ().swap(nextSLPDensityGrads_);
|
||||
vector<FloatCoordi> ().swap(nextSLPSumGrads_);
|
||||
vector<FloatPoint> ().swap(nextSLPCoordi_);
|
||||
vector<FloatPoint> ().swap(nextSLPWireLengthGrads_);
|
||||
vector<FloatPoint> ().swap(nextSLPDensityGrads_);
|
||||
vector<FloatPoint> ().swap(nextSLPSumGrads_);
|
||||
|
||||
vector<FloatCoordi> ().swap(prevSLPCoordi_);
|
||||
vector<FloatCoordi> ().swap(prevSLPWireLengthGrads_);
|
||||
vector<FloatCoordi> ().swap(prevSLPDensityGrads_);
|
||||
vector<FloatCoordi> ().swap(prevSLPSumGrads_);
|
||||
vector<FloatPoint> ().swap(prevSLPCoordi_);
|
||||
vector<FloatPoint> ().swap(prevSLPWireLengthGrads_);
|
||||
vector<FloatPoint> ().swap(prevSLPDensityGrads_);
|
||||
vector<FloatPoint> ().swap(prevSLPSumGrads_);
|
||||
|
||||
vector<FloatCoordi> ().swap(curCoordi_);
|
||||
vector<FloatCoordi> ().swap(nextCoordi_);
|
||||
vector<FloatPoint> ().swap(curCoordi_);
|
||||
vector<FloatPoint> ().swap(nextCoordi_);
|
||||
}
|
||||
|
||||
// to execute following function,
|
||||
@@ -202,9 +202,9 @@ void NesterovPlace::reset() {
|
||||
//
|
||||
void
|
||||
NesterovPlace::updateGradients(
|
||||
std::vector<FloatCoordi>& sumGrads,
|
||||
std::vector<FloatCoordi>& wireLengthGrads,
|
||||
std::vector<FloatCoordi>& densityGrads) {
|
||||
std::vector<FloatPoint>& sumGrads,
|
||||
std::vector<FloatPoint>& wireLengthGrads,
|
||||
std::vector<FloatPoint>& densityGrads) {
|
||||
|
||||
wireLengthGradSum_ = 0;
|
||||
densityGradSum_ = 0;
|
||||
@@ -234,12 +234,12 @@ NesterovPlace::updateGradients(
|
||||
sumGrads[i].x = wireLengthGrads[i].x + densityPenalty_ * densityGrads[i].x;
|
||||
sumGrads[i].y = wireLengthGrads[i].y + densityPenalty_ * densityGrads[i].y;
|
||||
|
||||
FloatCoordi wireLengthPreCondi
|
||||
FloatPoint wireLengthPreCondi
|
||||
= nb_->getWireLengthPreconditioner(gCell);
|
||||
FloatCoordi densityPrecondi
|
||||
FloatPoint densityPrecondi
|
||||
= nb_->getDensityPreconditioner(gCell);
|
||||
|
||||
FloatCoordi sumPrecondi(
|
||||
FloatPoint sumPrecondi(
|
||||
wireLengthPreCondi.x + densityPenalty_ * densityPrecondi.x,
|
||||
wireLengthPreCondi.y + densityPenalty_ * densityPrecondi.y);
|
||||
|
||||
@@ -323,25 +323,25 @@ NesterovPlace::doNesterovPlace() {
|
||||
|
||||
// fill in nextCoordinates with given stepLength_
|
||||
for(size_t k=0; k<nb_->gCells().size(); k++) {
|
||||
FloatCoordi nextCoordi(
|
||||
FloatPoint nextCoordi(
|
||||
curSLPCoordi_[k].x + stepLength_ * curSLPSumGrads_[k].x,
|
||||
curSLPCoordi_[k].y + stepLength_ * curSLPSumGrads_[k].y );
|
||||
|
||||
FloatCoordi nextSLPCoordi(
|
||||
FloatPoint nextSLPCoordi(
|
||||
nextCoordi.x + coeff * (nextCoordi.x - curCoordi_[k].x),
|
||||
nextCoordi.y + coeff * (nextCoordi.y - curCoordi_[k].y));
|
||||
|
||||
GCell* curGCell = nb_->gCells()[k];
|
||||
|
||||
nextCoordi_[k]
|
||||
= FloatCoordi(
|
||||
= FloatPoint(
|
||||
nb_->getDensityCoordiLayoutInsideX(
|
||||
curGCell, nextCoordi.x),
|
||||
nb_->getDensityCoordiLayoutInsideY(
|
||||
curGCell, nextCoordi.y));
|
||||
|
||||
nextSLPCoordi_[k]
|
||||
= FloatCoordi(
|
||||
= FloatPoint(
|
||||
nb_->getDensityCoordiLayoutInsideX(
|
||||
curGCell, nextSLPCoordi.x),
|
||||
nb_->getDensityCoordiLayoutInsideY(
|
||||
@@ -486,7 +486,7 @@ NesterovPlace::updateInitialPrevSLPCoordi() {
|
||||
= curSLPCoordi_[i].y + npVars_.initialPrevCoordiUpdateCoef
|
||||
* curSLPSumGrads_[i].y;
|
||||
|
||||
FloatCoordi newCoordi(
|
||||
FloatPoint newCoordi(
|
||||
nb_->getDensityCoordiLayoutInsideX( curGCell, prevCoordiX),
|
||||
nb_->getDensityCoordiLayoutInsideY( curGCell, prevCoordiY) );
|
||||
|
||||
@@ -536,10 +536,10 @@ NesterovPlace::updateNextIter() {
|
||||
|
||||
float
|
||||
NesterovPlace::getStepLength(
|
||||
std::vector<FloatCoordi>& prevSLPCoordi_,
|
||||
std::vector<FloatCoordi>& prevSLPSumGrads_,
|
||||
std::vector<FloatCoordi>& curSLPCoordi_,
|
||||
std::vector<FloatCoordi>& curSLPSumGrads_ ) {
|
||||
std::vector<FloatPoint>& prevSLPCoordi_,
|
||||
std::vector<FloatPoint>& prevSLPSumGrads_,
|
||||
std::vector<FloatPoint>& curSLPCoordi_,
|
||||
std::vector<FloatPoint>& curSLPSumGrads_ ) {
|
||||
|
||||
float coordiDistance
|
||||
= getDistance(prevSLPCoordi_, curSLPCoordi_);
|
||||
@@ -578,7 +578,7 @@ NesterovPlace::updateDb() {
|
||||
|
||||
|
||||
static float
|
||||
getDistance(vector<FloatCoordi>& a, vector<FloatCoordi>& b) {
|
||||
getDistance(vector<FloatPoint>& a, vector<FloatPoint>& b) {
|
||||
float sumDistance = 0.0f;
|
||||
for(size_t i=0; i<a.size(); i++) {
|
||||
sumDistance += (a[i].x - b[i].x) * (a[i].x - b[i].x);
|
||||
@@ -589,7 +589,7 @@ getDistance(vector<FloatCoordi>& a, vector<FloatCoordi>& b) {
|
||||
}
|
||||
|
||||
static float
|
||||
getSecondNorm(vector<FloatCoordi>& a) {
|
||||
getSecondNorm(vector<FloatPoint>& a) {
|
||||
float norm = 0;
|
||||
for(auto& coordi : a) {
|
||||
norm += coordi.x * coordi.x + coordi.y * coordi.y;
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#ifndef __REPLACE_NESTEROV_PLACE__
|
||||
#define __REPLACE_NESTEROV_PLACE__
|
||||
|
||||
#include "coordi.h"
|
||||
#include "point.h"
|
||||
#include <memory>
|
||||
#include <vector>
|
||||
|
||||
@@ -40,24 +40,24 @@ public:
|
||||
void doNesterovPlace();
|
||||
|
||||
void updateCoordi(
|
||||
std::vector<FloatCoordi>& coordi);
|
||||
std::vector<FloatPoint>& coordi);
|
||||
void updateBins();
|
||||
void updateWireLength();
|
||||
|
||||
void updateGradients(
|
||||
std::vector<FloatCoordi>& sumGrads,
|
||||
std::vector<FloatCoordi>& wireLengthGrads,
|
||||
std::vector<FloatCoordi>& densityGrads );
|
||||
std::vector<FloatPoint>& sumGrads,
|
||||
std::vector<FloatPoint>& wireLengthGrads,
|
||||
std::vector<FloatPoint>& densityGrads );
|
||||
|
||||
void updateWireLengthCoef(float overflow);
|
||||
|
||||
void updateInitialPrevSLPCoordi();
|
||||
|
||||
float getStepLength(
|
||||
std::vector<FloatCoordi>& prevCoordi_,
|
||||
std::vector<FloatCoordi>& prevSumGrads_,
|
||||
std::vector<FloatCoordi>& curCoordi_,
|
||||
std::vector<FloatCoordi>& curSumGrads_ );
|
||||
std::vector<FloatPoint>& prevCoordi_,
|
||||
std::vector<FloatPoint>& prevSumGrads_,
|
||||
std::vector<FloatPoint>& curCoordi_,
|
||||
std::vector<FloatPoint>& curSumGrads_ );
|
||||
|
||||
void updateNextIter();
|
||||
float getPhiCoef(float scaledDiffHpwl);
|
||||
@@ -73,26 +73,26 @@ private:
|
||||
// SLP is Step Length Prediction.
|
||||
//
|
||||
// y_st, y_dst, y_wdst, w_pdst
|
||||
std::vector<FloatCoordi> curSLPCoordi_;
|
||||
std::vector<FloatCoordi> curSLPWireLengthGrads_;
|
||||
std::vector<FloatCoordi> curSLPDensityGrads_;
|
||||
std::vector<FloatCoordi> curSLPSumGrads_;
|
||||
std::vector<FloatPoint> curSLPCoordi_;
|
||||
std::vector<FloatPoint> curSLPWireLengthGrads_;
|
||||
std::vector<FloatPoint> curSLPDensityGrads_;
|
||||
std::vector<FloatPoint> curSLPSumGrads_;
|
||||
|
||||
// y0_st, y0_dst, y0_wdst, y0_pdst
|
||||
std::vector<FloatCoordi> nextSLPCoordi_;
|
||||
std::vector<FloatCoordi> nextSLPWireLengthGrads_;
|
||||
std::vector<FloatCoordi> nextSLPDensityGrads_;
|
||||
std::vector<FloatCoordi> nextSLPSumGrads_;
|
||||
std::vector<FloatPoint> nextSLPCoordi_;
|
||||
std::vector<FloatPoint> nextSLPWireLengthGrads_;
|
||||
std::vector<FloatPoint> nextSLPDensityGrads_;
|
||||
std::vector<FloatPoint> nextSLPSumGrads_;
|
||||
|
||||
// z_st, z_dst, z_wdst, z_pdst
|
||||
std::vector<FloatCoordi> prevSLPCoordi_;
|
||||
std::vector<FloatCoordi> prevSLPWireLengthGrads_;
|
||||
std::vector<FloatCoordi> prevSLPDensityGrads_;
|
||||
std::vector<FloatCoordi> prevSLPSumGrads_;
|
||||
std::vector<FloatPoint> prevSLPCoordi_;
|
||||
std::vector<FloatPoint> prevSLPWireLengthGrads_;
|
||||
std::vector<FloatPoint> prevSLPDensityGrads_;
|
||||
std::vector<FloatPoint> prevSLPSumGrads_;
|
||||
|
||||
// x_st and x0_st
|
||||
std::vector<FloatCoordi> curCoordi_;
|
||||
std::vector<FloatCoordi> nextCoordi_;
|
||||
std::vector<FloatPoint> curCoordi_;
|
||||
std::vector<FloatPoint> nextCoordi_;
|
||||
|
||||
float wireLengthGradSum_;
|
||||
float densityGradSum_;
|
||||
|
||||
@@ -160,7 +160,7 @@ int PlotEnv::GetTotalImageHeight() {
|
||||
return imageHeight + 2 * yMargin;
|
||||
}
|
||||
|
||||
int PlotEnv::GetX(FloatCoordi &coord) {
|
||||
int PlotEnv::GetX(FloatPoint &coord) {
|
||||
return (coord.x - pb_->die().dieLx()) * unitX + xMargin;
|
||||
}
|
||||
|
||||
@@ -168,7 +168,7 @@ int PlotEnv::GetX(float coord) {
|
||||
return (coord - pb_->die().dieLx()) * unitX + xMargin;
|
||||
}
|
||||
|
||||
int PlotEnv::GetY(FloatCoordi &coord) {
|
||||
int PlotEnv::GetY(FloatPoint &coord) {
|
||||
return (origHeight - (coord.y - pb_->die().dieLy())) * unitY + yMargin;
|
||||
}
|
||||
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
|
||||
#include <vector>
|
||||
#include <memory>
|
||||
#include "coordi.h"
|
||||
#include "point.h"
|
||||
|
||||
//
|
||||
// The following structure/header will be removed.
|
||||
@@ -87,9 +87,9 @@ class PlotEnv {
|
||||
void InitCellColors(std::string colorFile);
|
||||
int GetTotalImageWidth();
|
||||
int GetTotalImageHeight();
|
||||
int GetX(FloatCoordi &coord);
|
||||
int GetX(FloatPoint &coord);
|
||||
int GetX(float coord);
|
||||
int GetY(FloatCoordi &coord);
|
||||
int GetY(FloatPoint &coord);
|
||||
int GetY(float coord);
|
||||
|
||||
void DrawModule(CImgObj *img, const unsigned char color[], float opacity);
|
||||
|
||||
17
src/point.cpp
Normal file
17
src/point.cpp
Normal file
@@ -0,0 +1,17 @@
|
||||
#include "point.h"
|
||||
|
||||
namespace replace {
|
||||
|
||||
FloatPoint::FloatPoint() : x(0), y(0) {}
|
||||
FloatPoint::FloatPoint(float inputX, float inputY) {
|
||||
x = inputX;
|
||||
y = inputY;
|
||||
}
|
||||
|
||||
IntPoint::IntPoint() : x(0), y(0) {}
|
||||
IntPoint::IntPoint(int inputX, int inputY) {
|
||||
x = inputX;
|
||||
y = inputY;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,20 +3,20 @@
|
||||
|
||||
namespace replace {
|
||||
|
||||
class FloatCoordi {
|
||||
class FloatPoint {
|
||||
public:
|
||||
float x;
|
||||
float y;
|
||||
FloatCoordi();
|
||||
FloatCoordi(float x, float y);
|
||||
FloatPoint();
|
||||
FloatPoint(float x, float y);
|
||||
};
|
||||
|
||||
class IntCoordi {
|
||||
class IntPoint {
|
||||
public:
|
||||
int x;
|
||||
int y;
|
||||
IntCoordi();
|
||||
IntCoordi(int x, int y);
|
||||
IntPoint();
|
||||
IntPoint(int x, int y);
|
||||
};
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user