summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFridrich Štrba <fridrich.strba@bluewin.ch>2016-01-02 15:02:54 +0100
committerFridrich Štrba <fridrich.strba@bluewin.ch>2016-01-02 15:02:54 +0100
commit70f19aebaa21586aa2833b2685dc12fbfaea1923 (patch)
treec2bd26286c6765f187e345bbbbf5ab729b058592
parent2f36fc6cc89d5778f7f57632cecd516d06fc8d84 (diff)
Small improvement
Change-Id: Id5832d351fb39c2d0889dbcecd12b1228e1a3e9b
-rw-r--r--src/lib/VSDContentCollector.cpp8
1 files changed, 5 insertions, 3 deletions
diff --git a/src/lib/VSDContentCollector.cpp b/src/lib/VSDContentCollector.cpp
index 8ded8c8..9560500 100644
--- a/src/lib/VSDContentCollector.cpp
+++ b/src/lib/VSDContentCollector.cpp
@@ -37,6 +37,9 @@ namespace
void computeRounding(double &prevX, double &prevY, double x0, double y0, double x, double y, double rounding,
double &newX0, double &newY0, double &newX, double &newY, double &maxRounding)
{
+ double prevHalfLength = sqrt((y0-prevY)*(y0-prevY)+(x0-prevX)*(x0-prevX)) / 2.0;
+ if (maxRounding > prevHalfLength)
+ maxRounding = prevHalfLength;
double halfLength = sqrt((y-y0)*(y-y0)+(x-x0)*(x-x0)) / 2.0;
if (maxRounding > halfLength)
maxRounding = halfLength;
@@ -48,10 +51,9 @@ void computeRounding(double &prevX, double &prevY, double x0, double y0, double
double lambda2 = atan2(y-y0, x-x0);
newX = x0+maxRounding*cos(lambda2);
newY = y0+maxRounding*sin(lambda2);
- prevX = newX;
- prevY = newY;
+ prevX = x0;
+ prevY = y0;
maxRounding = halfLength;
-
}
} // anonymous namespace