Skip to content

Commit

Permalink
+ replace insecure x/fabs(x) with sgn function
Browse files Browse the repository at this point in the history
  • Loading branch information
wwmayer committed Mar 24, 2016
1 parent 368cd7b commit 05ed514
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions src/Mod/Sketcher/Gui/CommandCreateGeo.cpp
Expand Up @@ -34,6 +34,7 @@
#include <boost/math/special_functions/fpclassify.hpp>
#include <Base/Console.h>
#include <Base/Exception.h>
#include <Base/Tools.h>

#include <Gui/Action.h>
#include <Gui/Application.h>
Expand Down Expand Up @@ -4721,15 +4722,17 @@ class DrawSketchHandlerSlot: public DrawSketchHandler
float dy = onSketchPos.fY - StartPos.fY;

lx=0;ly=0;a=0;
if(fabs(dx) > fabs(dy)){
double rev = 0;
if (fabs(dx) > fabs(dy)) {
lx = dx;
r = dy;
rev = dx/fabs(dx);
}else{
rev = Base::sgn(dx);
}
else {
ly = dy;
r = dx;
a = 8;
rev = dy/fabs(dy);
rev = Base::sgn(dy);
}

for (int i=0; i < 17; i++) {
Expand Down Expand Up @@ -4881,7 +4884,7 @@ class DrawSketchHandlerSlot: public DrawSketchHandler
protected:
BoxMode Mode;
Base::Vector2D StartPos;
double lx,ly,r,a,rev;
double lx,ly,r,a;
std::vector<Base::Vector2D> EditCurve;
std::vector<AutoConstraint> sugConstr1, sugConstr2;
};
Expand Down

0 comments on commit 05ed514

Please sign in to comment.