mirror of
https://github.com/vcmi/vcmi.git
synced 2025-11-29 23:07:48 +02:00
Cleanup
This commit is contained in:
@@ -207,15 +207,11 @@ float Path::curvedCost(const int3& src, const int3& dst, const int3& center)
|
|||||||
float W = 10.0f;// width of the transition area
|
float W = 10.0f;// width of the transition area
|
||||||
float A = 0.7f; // sine bias
|
float A = 0.7f; // sine bias
|
||||||
|
|
||||||
// Euclidean step distance:
|
// Euclidean distance:
|
||||||
float dx = dst.x - src.x;
|
float d = src.dist2d(dst);
|
||||||
float dy = dst.y - src.y;
|
|
||||||
float d = std::sqrt(dx*dx + dy*dy);
|
|
||||||
|
|
||||||
// Distance from dst to the zone center:
|
// Distance from dst to the zone center:
|
||||||
float rx = dst.x - center.x;
|
float r = dst.dist2d(center);
|
||||||
float ry = dst.y - center.y;
|
|
||||||
float r = std::sqrt(rx*rx + ry*ry);
|
|
||||||
|
|
||||||
// Compute normalized offset inside the zone:
|
// Compute normalized offset inside the zone:
|
||||||
// (R - W) is the inner edge, R is the outer edge.
|
// (R - W) is the inner edge, R is the outer edge.
|
||||||
@@ -232,11 +228,8 @@ Path::MoveCostFunction Path::createCurvedCostFunction(const Area & border)
|
|||||||
// Capture by value to ensure the Area object persists
|
// Capture by value to ensure the Area object persists
|
||||||
return [border = border](const int3& src, const int3& dst) -> float
|
return [border = border](const int3& src, const int3& dst) -> float
|
||||||
{
|
{
|
||||||
// Route main roads far from border
|
|
||||||
//float ret = dst.dist2d(src);
|
|
||||||
|
|
||||||
//float ret = nonEuclideanCostFunction(src, dst);
|
|
||||||
float ret = curvedCost(src, dst, border.getCenterOfMass());
|
float ret = curvedCost(src, dst, border.getCenterOfMass());
|
||||||
|
// Route main roads far from border
|
||||||
float dist = border.distanceSqr(dst);
|
float dist = border.distanceSqr(dst);
|
||||||
|
|
||||||
if(dist > 1.0f)
|
if(dist > 1.0f)
|
||||||
|
|||||||
@@ -93,8 +93,6 @@ bool RoadPlacer::createRoad(const int3 & destination)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//float ret = dst.dist2d(src);
|
|
||||||
//float ret = rmg::Path::nonEuclideanCostFunction(src, dst);
|
|
||||||
float ret = rmg::Path::curvedCost(src, dst, border.getCenterOfMass());
|
float ret = rmg::Path::curvedCost(src, dst, border.getCenterOfMass());
|
||||||
|
|
||||||
if (visitableTiles.contains(src) || visitableTiles.contains(dst))
|
if (visitableTiles.contains(src) || visitableTiles.contains(dst))
|
||||||
|
|||||||
Reference in New Issue
Block a user