Verified Commit 1f41d699 authored by Kuntal  Majumder's avatar Kuntal Majumder 😟

Changed multiply to divide, I was calculating weights wrong all the time

parent 1ca04c3f
......@@ -134,6 +134,7 @@ struct neighbour_iterator : public boost::iterator_facade<neighbour_iterator,
pos = position::end;
return;
}
if(nextPoint.x == graph.bottomRight.x()){ // end of a row move to next column
nextPoint = VertexDescriptor(graph.topLeft.x(), nextPoint.y + 1);
} else {
......@@ -143,7 +144,6 @@ struct neighbour_iterator : public boost::iterator_facade<neighbour_iterator,
if(nextPoint == currentPoint){
increment();
}
}
bool operator==(neighbour_iterator const& that) const {
......
......@@ -101,7 +101,7 @@ class AStarHeuristic : public boost::astar_heuristic<KisMagneticGraph, double> {
double dz = EuclideanDistance(prev, m_goal);
di = di/dz;
double dm = EuclideanDistance(v, m_goal);
return coeff_a * di + coeff_b * (dm - dz) ;
return coeff_a * di + coeff_b * (dm - dz);
}
};
......@@ -136,7 +136,7 @@ struct WeightMap{
data_type& operator[](key_type const& k) {
if (m_map.find(k) == m_map.end()) {
double edge_gradient = m_graph.getIntensity((k.first)) + m_graph.getIntensity((k.second))/2;
m_map[k] = EuclideanDistance(k.first, k.second) * (edge_gradient + 1);
m_map[k] = EuclideanDistance(k.first, k.second) / (edge_gradient + 1);
}
return m_map[k];
}
......
......@@ -53,7 +53,7 @@ void KisMagneticWorkerTest::testWorker()
auto points = worker.computeEdge(grayscaleDev, 10, startPos, endPos);
KIS_DUMP_DEVICE_2(grayscaleDev, rect, "draw", "dd");
QImage img = grayscaleDev->convertToQImage(0, rect);
QImage img = dev->convertToQImage(0, rect);
img = img.convertToFormat(QImage::Format_ARGB32);
QPainter gc(&img);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment