Cleaning up compile warnings, mainly in Sketcher

fabs() instead of std::abs(), add cmath include
This commit is contained in:
Ian Rees 2015-06-04 18:12:39 +02:00 committed by wmayer
parent 37fbcb64a6
commit 418cefd7ee
5 changed files with 23 additions and 12 deletions

View File

@ -288,7 +288,7 @@ bool Part2DObject::seekTrimPoints(const std::vector<Geometry *> &geomlist,
if (periodic) {
// in case both points coincide, cancel the selection of one of both
if (abs(param2-param1-period) < 1e-10) {
if (fabs(param2-param1-period) < 1e-10) {
if (param2 - pickedParam >= pickedParam - param1)
GeoId2 = -1;
else

View File

@ -42,7 +42,9 @@
# include <BRepOffsetAPI_NormalProjection.hxx>
# include <BRepBuilderAPI_MakeFace.hxx>
# include <Standard_Version.hxx>
#endif
# include <cmath>
# include <vector>
#endif // #ifndef _PreComp_
#include <Base/Writer.h>
#include <Base/Reader.h>
@ -51,8 +53,6 @@
#include <Mod/Part/App/Geometry.h>
#include <vector>
#include "SketchObject.h"
#include "SketchObjectPy.h"
#include "Sketch.h"
@ -1527,6 +1527,8 @@ int SketchObject::ExposeInternalGeometry(int GeoId)
focus2=true;
focus2elementindex=(*it)->First;
break;
default:
return -1;
}
}
}
@ -1690,6 +1692,8 @@ int SketchObject::DeleteUnusedInternalGeometry(int GeoId)
focus2=true;
focus2elementindex=(*it)->First;
break;
default:
return -1;
}
}
}
@ -2765,7 +2769,7 @@ bool SketchObject::AutoLockTangencyAndPerpty(Constraint *cstr, bool bForce, bool
if (angleErr < -M_PI) angleErr += M_PI*2;
//the autodetector
if(abs(angleErr) > M_PI/2 )
if(fabs(angleErr) > M_PI/2 )
angleDesire += M_PI;
cstr->Value = angleDesire + angleOffset; //external tangency. The angle stored is offset by Pi/2 so that a value of 0.0 is invalid and threated as "undecided".

View File

@ -134,8 +134,14 @@ public:
/// trim a curve
int trim(int geoId, const Base::Vector3d& point);
/// Exposes all internal geometry of an object supporting internal geometry
/*!
* \return -1 on error
*/
int ExposeInternalGeometry(int GeoId);
/// Deletes all unused (not further constrained) internal geometry
/*!
* \return -1 on error
*/
int DeleteUnusedInternalGeometry(int GeoId);
/// retrieves for a Vertex number the corresponding GeoId and PosId

View File

@ -29,7 +29,8 @@
# include <Inventor/nodes/SoText2.h>
# include <Inventor/nodes/SoFont.h>
# include <QPainter>
#endif
# include <cmath>
#endif // #ifndef _PreComp_
/// Here the FreeCAD includes sorted by Base,App,Gui......
#include <Base/Console.h>
@ -195,7 +196,7 @@ int DrawSketchHandler::seekAutoConstraint(std::vector<AutoConstraint> &suggested
// the angle between the line and the hitting direction are over around 6 degrees (it is substantially parallel)
// or if it is an sketch axis (that can not move to accomodate to the shape), then only if it is around 6 degrees with the normal (around 84 degrees)
if(abs(cosangle) < 0.995f || ((GeoId==-1 || GeoId==-2) && abs(cosangle) < 0.1))
if (fabs(cosangle) < 0.995f || ((GeoId==-1 || GeoId==-2) && fabs(cosangle) < 0.1))
suggestedConstraints.push_back(constr);
@ -292,7 +293,7 @@ int DrawSketchHandler::seekAutoConstraint(std::vector<AutoConstraint> &suggested
Base::Vector3d focus1PMirrored = focus1P + 2*distancetoline*norm; // mirror of focus1 with respect to the line
double error = abs((focus1PMirrored-focus2P).Length() - 2*a);
double error = fabs((focus1PMirrored-focus2P).Length() - 2*a);
if ( error< tangDeviation) {
tangId = i;
@ -347,7 +348,7 @@ int DrawSketchHandler::seekAutoConstraint(std::vector<AutoConstraint> &suggested
Base::Vector3d focus1PMirrored = focus1P + 2*distancetoline*norm; // mirror of focus1 with respect to the line
double error = abs((focus1PMirrored-focus2P).Length() - 2*a);
double error = fabs((focus1PMirrored-focus2P).Length() - 2*a);
if ( error< tangDeviation ) {
tangId = i;

View File

@ -1,5 +1,5 @@
/***************************************************************************
* Copyright (c) 2009 Jürgen Riegel <juergen.riegel@web.de> *
* Copyright (c) 2009 Juergen Riegel <juergen.riegel@web.de> *
* *
* This file is part of the FreeCAD CAx development system. *
* *
@ -382,7 +382,7 @@ void TaskSketcherConstrains::on_listWidgetConstraints_itemChanged(QListWidgetIte
{
double n1 = 1.0;
double n2 = 1.0;
if(abs(v->Value)>=1) {
if (fabs(v->Value) >= 1) {
n2 = v->Value;
} else {
n1 = 1/v->Value;
@ -545,7 +545,7 @@ void TaskSketcherConstrains::slotConstraintsChanged(void)
double v = (*it)->Value;
double n1 = 1.0;
double n2 = 1.0;
if(abs(v)>=1) {
if (fabs(v) >= 1) {
n2 = v;
} else {
n1 = 1/v;