Skip to content

Commit 5abc104

Browse files
caseorumkonskarm
authored andcommitted
Calculate vSize(vap) only when needed
1 parent 730e874 commit 5abc104

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

src/utils/LinearAlg2D.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -240,10 +240,9 @@ coord_t LinearAlg2D::getDistFromLine(const Point& p, const Point& a, const Point
240240
const Point vab = b - a;
241241
const Point vap = p - a;
242242
const double ab_size = vSize(vab);
243-
const coord_t ap_size = vSize(vap);
244243
if(ab_size == 0) //Line of 0 length. Assume it's a line perpendicular to the direction to p.
245244
{
246-
return ap_size;
245+
return vSize(vap);
247246
}
248247
const coord_t area_times_two = abs((b.Y - a.Y) * p.X - (b.X - a.X) * p.Y + b.X * a.Y - b.Y * a.X);
249248
const coord_t px_size = area_times_two / ab_size;

0 commit comments

Comments
 (0)