diff --git a/src/Mod/Mesh/App/Core/Approximation.cpp b/src/Mod/Mesh/App/Core/Approximation.cpp index 06e824429c..e1b73e66e1 100644 --- a/src/Mod/Mesh/App/Core/Approximation.cpp +++ b/src/Mod/Mesh/App/Core/Approximation.cpp @@ -51,10 +51,7 @@ using namespace MeshCore; -Approximation::Approximation() - : _bIsFitted(false), _fLastResult(FLOAT_MAX) -{ -} +Approximation::Approximation() = default; Approximation::~Approximation() { @@ -567,18 +564,8 @@ void QuadraticFit::CalcZValues( double x, double y, double &dZ1, double &dZ2 ) c // ------------------------------------------------------------------------------- SurfaceFit::SurfaceFit() - : PlaneFit() + : _fCoeff{} { - _fCoeff[0] = 0.0; - _fCoeff[1] = 0.0; - _fCoeff[2] = 0.0; - _fCoeff[3] = 0.0; - _fCoeff[4] = 0.0; - _fCoeff[5] = 0.0; - _fCoeff[6] = 0.0; - _fCoeff[7] = 0.0; - _fCoeff[8] = 0.0; - _fCoeff[9] = 0.0; } float SurfaceFit::Fit() @@ -1029,8 +1016,6 @@ struct LMCylinderFunctor CylinderFit::CylinderFit() : _vBase(0,0,0) , _vAxis(0,0,1) - , _fRadius(0) - , _initialGuess(false) { } @@ -1296,7 +1281,6 @@ void CylinderFit::ProjectToCylinder() SphereFit::SphereFit() : _vCenter(0,0,0) - , _fRadius(0) { } @@ -1417,9 +1401,8 @@ void SphereFit::ProjectToSphere() // ------------------------------------------------------------------------------- PolynomialFit::PolynomialFit() + : _fCoeff{} { - for (float & i : _fCoeff) - i = 0.0f; } float PolynomialFit::Fit() diff --git a/src/Mod/Mesh/App/Core/Approximation.h b/src/Mod/Mesh/App/Core/Approximation.h index 4926e90a10..a7e3ac60e3 100644 --- a/src/Mod/Mesh/App/Core/Approximation.h +++ b/src/Mod/Mesh/App/Core/Approximation.h @@ -169,9 +169,11 @@ protected: void GetMgcVectorArray( std::vector< Wm4::Vector3 >& rcPts ) const; protected: + //NOLINTBEGIN std::list< Base::Vector3f > _vPoints; /**< Holds the points for the fit algorithm. */ - bool _bIsFitted; /**< Flag, whether the fit has been called. */ - float _fLastResult; /**< Stores the last result of the fit */ + bool _bIsFitted{false}; /**< Flag, whether the fit has been called. */ + float _fLastResult{FLOAT_MAX}; /**< Stores the last result of the fit */ + //NOLINTEND }; // ------------------------------------------------------------------------------- @@ -233,10 +235,12 @@ public: Base::BoundBox3f GetBoundings() const; protected: + //NOLINTBEGIN Base::Vector3f _vBase; /**< Base vector of the plane. */ Base::Vector3f _vDirU; Base::Vector3f _vDirV; Base::Vector3f _vDirW; /**< Normal of the plane. */ + //NOLINTEND }; // ------------------------------------------------------------------------------- @@ -398,8 +402,8 @@ public: protected: Base::Vector3f _vBase; /**< Base vector of the cylinder. */ Base::Vector3f _vAxis; /**< Axis of the cylinder. */ - float _fRadius; /**< Radius of the cylinder. */ - bool _initialGuess; + float _fRadius{0}; /**< Radius of the cylinder. */ + bool _initialGuess{false}; }; // ------------------------------------------------------------------------------- @@ -434,7 +438,7 @@ public: protected: Base::Vector3f _vCenter; /**< Center of the sphere. */ - float _fRadius; /**< Radius of the cylinder. */ + float _fRadius{0}; /**< Radius of the cylinder. */ }; // ------------------------------------------------------------------------------- diff --git a/src/Mod/Mesh/App/Core/Builder.cpp b/src/Mod/Mesh/App/Core/Builder.cpp index c1c9b9d04f..4f7cc42165 100644 --- a/src/Mod/Mesh/App/Core/Builder.cpp +++ b/src/Mod/Mesh/App/Core/Builder.cpp @@ -38,9 +38,10 @@ using namespace MeshCore; -MeshBuilder::MeshBuilder (MeshKernel& kernel) : _meshKernel(kernel), _seq(nullptr), _ptIdx(0) +MeshBuilder::MeshBuilder (MeshKernel& kernel) + : _meshKernel(kernel) + , _fSaveTolerance{MeshDefinitions::_fMinPointDistanceD1} { - _fSaveTolerance = MeshDefinitions::_fMinPointDistanceD1; } MeshBuilder::~MeshBuilder () diff --git a/src/Mod/Mesh/App/Core/Builder.h b/src/Mod/Mesh/App/Core/Builder.h index a525772f8e..61669ae59b 100644 --- a/src/Mod/Mesh/App/Core/Builder.h +++ b/src/Mod/Mesh/App/Core/Builder.h @@ -102,12 +102,12 @@ private: MeshKernel& _meshKernel; std::set _points; - Base::SequencerLauncher* _seq; + Base::SequencerLauncher* _seq{nullptr}; // keep an array of iterators pointing to the vertex inside the set to save memory using MeshPointIterator = std::pair::iterator, bool>; std::vector _pointsIterator; - size_t _ptIdx; + size_t _ptIdx{0}; void SetNeighbourhood (); // As it's forbidden to insert a degenerated facet but insert its vertices anyway we must remove them diff --git a/src/Mod/Mesh/App/Core/CylinderFit.cpp b/src/Mod/Mesh/App/Core/CylinderFit.cpp index 0468637c7f..3ccdbec122 100644 --- a/src/Mod/Mesh/App/Core/CylinderFit.cpp +++ b/src/Mod/Mesh/App/Core/CylinderFit.cpp @@ -72,12 +72,6 @@ using namespace MeshCoreFit; CylinderFit::CylinderFit() : _vBase(0,0,0) , _vAxis(0,0,1) - , _dRadius(0) - , _numIter(0) - , _posConvLimit(0.0001) - , _dirConvLimit(0.000001) - , _vConvLimit(0.001) - , _maxIter(50) { } diff --git a/src/Mod/Mesh/App/Core/CylinderFit.h b/src/Mod/Mesh/App/Core/CylinderFit.h index bcba1d1155..72d3ad0bda 100644 --- a/src/Mod/Mesh/App/Core/CylinderFit.h +++ b/src/Mod/Mesh/App/Core/CylinderFit.h @@ -146,15 +146,15 @@ protected: */ bool updateParameters(SolutionD solDir, const Eigen::VectorXd &x); -protected: +private: Base::Vector3d _vBase; /**< Base vector of the cylinder (point on axis). */ Base::Vector3d _vAxis; /**< Axis of the cylinder. */ - double _dRadius; /**< Radius of the cylinder. */ - int _numIter; /**< Number of iterations for solution to converge. */ - double _posConvLimit; /**< Position and radius parameter convergence threshold. */ - double _dirConvLimit; /**< Direction parameter convergence threshold. */ - double _vConvLimit; /**< Residual convergence threshold. */ - int _maxIter; /**< Maximum number of iterations. */ + double _dRadius{0}; /**< Radius of the cylinder. */ + int _numIter{0}; /**< Number of iterations for solution to converge. */ + double _posConvLimit{0.0001}; /**< Position and radius parameter convergence threshold. */ + double _dirConvLimit{0.000001}; /**< Direction parameter convergence threshold. */ + double _vConvLimit{0.001}; /**< Residual convergence threshold. */ + int _maxIter{50}; /**< Maximum number of iterations. */ }; diff --git a/src/Mod/Mesh/App/Core/Elements.h b/src/Mod/Mesh/App/Core/Elements.h index 57757a4d45..cf2a073715 100644 --- a/src/Mod/Mesh/App/Core/Elements.h +++ b/src/Mod/Mesh/App/Core/Elements.h @@ -157,7 +157,7 @@ public: class MeshExport MeshGeomEdge { public: - MeshGeomEdge () : _bBorder(false) {} + MeshGeomEdge () = default; /** Checks if the edge is inside the bounding box or intersects with it. */ bool ContainedByOrIntersectBoundingBox (const Base::BoundBox3f &rclBB ) const; @@ -212,7 +212,7 @@ public: public: Base::Vector3f _aclPoints[2]; /**< Corner points */ - bool _bBorder; /**< Set to true if border edge */ + bool _bBorder{false}; /**< Set to true if border edge */ }; /** diff --git a/src/Mod/Mesh/App/Core/Evaluation.cpp b/src/Mod/Mesh/App/Core/Evaluation.cpp index 366936b301..66307a66ab 100644 --- a/src/Mod/Mesh/App/Core/Evaluation.cpp +++ b/src/Mod/Mesh/App/Core/Evaluation.cpp @@ -42,9 +42,7 @@ using namespace MeshCore; -MeshOrientationVisitor::MeshOrientationVisitor() : _nonuniformOrientation(false) -{ -} +MeshOrientationVisitor::MeshOrientationVisitor() = default; bool MeshOrientationVisitor::Visit (const MeshFacet &rclFacet, const MeshFacet &rclFrom, FacetIndex ulFInd, unsigned long ulLevel) diff --git a/src/Mod/Mesh/App/Core/Evaluation.h b/src/Mod/Mesh/App/Core/Evaluation.h index a937af67d8..4d0bc52400 100644 --- a/src/Mod/Mesh/App/Core/Evaluation.h +++ b/src/Mod/Mesh/App/Core/Evaluation.h @@ -99,7 +99,7 @@ public: bool HasNonUnifomOrientedFacets() const; private: - bool _nonuniformOrientation; + bool _nonuniformOrientation{false}; }; /** diff --git a/src/Mod/Mesh/App/Core/Grid.cpp b/src/Mod/Mesh/App/Core/Grid.cpp index 481b7e5783..1a4dc27db0 100644 --- a/src/Mod/Mesh/App/Core/Grid.cpp +++ b/src/Mod/Mesh/App/Core/Grid.cpp @@ -1142,12 +1142,9 @@ unsigned long MeshPointGrid::FindElements (const Base::Vector3f &rclPoint, std:: // ---------------------------------------------------------------- MeshGridIterator::MeshGridIterator (const MeshGrid &rclG) -: _rclGrid(rclG), - _ulX(0), _ulY(0), _ulZ(0), - _clPt(0.0f, 0.0f, 0.0f), _clDir(0.0f, 0.0f, 0.0f), - _bValidRay(false), - _fMaxSearchArea (FLOAT_MAX) - + : _rclGrid(rclG) + , _clPt(0.0f, 0.0f, 0.0f) + , _clDir(0.0f, 0.0f, 0.0f) { } diff --git a/src/Mod/Mesh/App/Core/Grid.h b/src/Mod/Mesh/App/Core/Grid.h index 38dd6f3967..3873ec3177 100644 --- a/src/Mod/Mesh/App/Core/Grid.h +++ b/src/Mod/Mesh/App/Core/Grid.h @@ -333,13 +333,13 @@ public: protected: const MeshGrid& _rclGrid; /**< The mesh kernel. */ - unsigned long _ulX; /**< Number of grids in x. */ - unsigned long _ulY; /**< Number of grids in y. */ - unsigned long _ulZ; /**< Number of grids in z. */ + unsigned long _ulX{0}; /**< Number of grids in x. */ + unsigned long _ulY{0}; /**< Number of grids in y. */ + unsigned long _ulZ{0}; /**< Number of grids in z. */ Base::Vector3f _clPt; /**< Base point of search ray. */ Base::Vector3f _clDir; /**< Direction of search ray. */ - bool _bValidRay; /**< Search ray ok? */ - float _fMaxSearchArea; + bool _bValidRay{false}; /**< Search ray ok? */ + float _fMaxSearchArea{FLOAT_MAX}; /** Checks if a grid position is already visited by NextOnRay(). */ struct GridElement { diff --git a/src/Mod/Mesh/App/Core/IO/WriterInventor.cpp b/src/Mod/Mesh/App/Core/IO/WriterInventor.cpp index c40f890b66..f19487ed66 100644 --- a/src/Mod/Mesh/App/Core/IO/WriterInventor.cpp +++ b/src/Mod/Mesh/App/Core/IO/WriterInventor.cpp @@ -185,7 +185,6 @@ public: WriterInventor::WriterInventor(const MeshKernel& kernel, const Material* material) : _kernel(kernel) , _material(material) - , apply_transform(false) { } diff --git a/src/Mod/Mesh/App/Core/IO/WriterInventor.h b/src/Mod/Mesh/App/Core/IO/WriterInventor.h index 66cb3c63df..5d25c188e1 100644 --- a/src/Mod/Mesh/App/Core/IO/WriterInventor.h +++ b/src/Mod/Mesh/App/Core/IO/WriterInventor.h @@ -52,7 +52,7 @@ private: const MeshKernel& _kernel; const Material* _material; Base::Matrix4D _transform; - bool apply_transform; + bool apply_transform{false}; }; } // namespace MeshCore diff --git a/src/Mod/Mesh/App/Core/IO/WriterOBJ.cpp b/src/Mod/Mesh/App/Core/IO/WriterOBJ.cpp index 85d206ea86..534bed80a7 100644 --- a/src/Mod/Mesh/App/Core/IO/WriterOBJ.cpp +++ b/src/Mod/Mesh/App/Core/IO/WriterOBJ.cpp @@ -50,7 +50,6 @@ struct WriterOBJ::Color_Less WriterOBJ::WriterOBJ(const MeshKernel& kernel, const Material* material) : _kernel(kernel) , _material(material) - , apply_transform(false) { } diff --git a/src/Mod/Mesh/App/Core/IO/WriterOBJ.h b/src/Mod/Mesh/App/Core/IO/WriterOBJ.h index 6e189e42a0..171d4eccad 100644 --- a/src/Mod/Mesh/App/Core/IO/WriterOBJ.h +++ b/src/Mod/Mesh/App/Core/IO/WriterOBJ.h @@ -66,7 +66,7 @@ private: const MeshKernel& _kernel; const Material* _material; Base::Matrix4D _transform; - bool apply_transform; + bool apply_transform{false}; std::vector _groups; }; diff --git a/src/Mod/Mesh/App/Core/MeshIO.cpp b/src/Mod/Mesh/App/Core/MeshIO.cpp index ecb5420918..fc090c0c1a 100644 --- a/src/Mod/Mesh/App/Core/MeshIO.cpp +++ b/src/Mod/Mesh/App/Core/MeshIO.cpp @@ -3094,7 +3094,6 @@ bool MeshOutput::SaveVRML (std::ostream &rstrOut) const MeshCleanup::MeshCleanup(MeshPointArray& p, MeshFacetArray& f) : pointArray(p) , facetArray(f) - , materialArray(nullptr) { } diff --git a/src/Mod/Mesh/App/Core/MeshIO.h b/src/Mod/Mesh/App/Core/MeshIO.h index 3703be7129..7f3e38a5e6 100644 --- a/src/Mod/Mesh/App/Core/MeshIO.h +++ b/src/Mod/Mesh/App/Core/MeshIO.h @@ -289,7 +289,7 @@ private: private: MeshPointArray& pointArray; MeshFacetArray& facetArray; - Material* materialArray; + Material* materialArray{nullptr}; }; /*! diff --git a/src/Mod/Mesh/App/Core/MeshKernel.cpp b/src/Mod/Mesh/App/Core/MeshKernel.cpp index 430a436b49..45063ddf86 100644 --- a/src/Mod/Mesh/App/Core/MeshKernel.cpp +++ b/src/Mod/Mesh/App/Core/MeshKernel.cpp @@ -44,8 +44,7 @@ using namespace MeshCore; -MeshKernel::MeshKernel () -: _bValid(true) +MeshKernel::MeshKernel() { _clBoundBox.SetVoid(); } diff --git a/src/Mod/Mesh/App/Core/MeshKernel.h b/src/Mod/Mesh/App/Core/MeshKernel.h index 45b6c58bda..d2b1322856 100644 --- a/src/Mod/Mesh/App/Core/MeshKernel.h +++ b/src/Mod/Mesh/App/Core/MeshKernel.h @@ -448,7 +448,7 @@ protected: MeshPointArray _aclPointArray; /**< Holds the array of geometric points. */ MeshFacetArray _aclFacetArray; /**< Holds the array of facets. */ mutable Base::BoundBox3f _clBoundBox; /**< The current calculated bounding box. */ - bool _bValid; /**< Current state of validality. */ + bool _bValid{true}; /**< Current state of validality. */ // friends friend class MeshPointIterator; diff --git a/src/Mod/Mesh/App/Core/SetOperations.cpp b/src/Mod/Mesh/App/Core/SetOperations.cpp index 4cbffe336d..2c8671864e 100644 --- a/src/Mod/Mesh/App/Core/SetOperations.cpp +++ b/src/Mod/Mesh/App/Core/SetOperations.cpp @@ -491,8 +491,7 @@ SetOperations::CollectFacetVisitor::CollectFacetVisitor (const MeshKernel& mesh, , _edges(edges) , _side(side) , _mult(mult) - , _addFacets(-1) - ,_builder(builder) + , _builder(builder) { } diff --git a/src/Mod/Mesh/App/Core/SetOperations.h b/src/Mod/Mesh/App/Core/SetOperations.h index 08fe917b39..24593a44b4 100644 --- a/src/Mod/Mesh/App/Core/SetOperations.h +++ b/src/Mod/Mesh/App/Core/SetOperations.h @@ -146,7 +146,7 @@ private: std::map &_edges; int _side; float _mult; - int _addFacets; // 0: add facets to the result 1: do not add facets to the result + int _addFacets{-1}; // 0: add facets to the result 1: do not add facets to the result Base::Builder3D& _builder; CollectFacetVisitor (const MeshKernel& mesh, std::vector& facets, std::map& edges, int side, float mult, Base::Builder3D& builder); diff --git a/src/Mod/Mesh/App/Core/Smoothing.cpp b/src/Mod/Mesh/App/Core/Smoothing.cpp index 115f0d1e50..3226032c2a 100644 --- a/src/Mod/Mesh/App/Core/Smoothing.cpp +++ b/src/Mod/Mesh/App/Core/Smoothing.cpp @@ -36,8 +36,6 @@ using namespace MeshCore; AbstractSmoothing::AbstractSmoothing(MeshKernel& m) : kernel(m) - , component(Normal) - , continuity(C0) { } @@ -51,7 +49,6 @@ void AbstractSmoothing::initialize(Component comp, Continuity cont) PlaneFitSmoothing::PlaneFitSmoothing(MeshKernel& m) : AbstractSmoothing(m) - , maximum(FLT_MAX) { } @@ -163,7 +160,7 @@ void PlaneFitSmoothing::SmoothPoints(unsigned int iterations, const std::vector< } LaplaceSmoothing::LaplaceSmoothing(MeshKernel& m) - : AbstractSmoothing(m), lambda(0.6307) + : AbstractSmoothing(m) { } @@ -259,7 +256,7 @@ void LaplaceSmoothing::SmoothPoints(unsigned int iterations, const std::vector

&container) } MedianFilterSmoothing::MedianFilterSmoothing(MeshKernel& m) - : AbstractSmoothing(m), weights(1) + : AbstractSmoothing(m) { } diff --git a/src/Mod/Mesh/App/Core/Smoothing.h b/src/Mod/Mesh/App/Core/Smoothing.h index ea0cc31b91..be2b0164c9 100644 --- a/src/Mod/Mesh/App/Core/Smoothing.h +++ b/src/Mod/Mesh/App/Core/Smoothing.h @@ -23,6 +23,7 @@ #ifndef MESH_SMOOTHING_H #define MESH_SMOOTHING_H +#include #include #include "Definitions.h" @@ -62,8 +63,8 @@ public: protected: MeshKernel& kernel; - Component component; - Continuity continuity; + Component component{Normal}; + Continuity continuity{C0}; }; class MeshExport PlaneFitSmoothing : public AbstractSmoothing @@ -77,7 +78,7 @@ public: void SmoothPoints(unsigned int, const std::vector&) override; private: - float maximum; + float maximum{FLT_MAX}; }; class MeshExport LaplaceSmoothing : public AbstractSmoothing @@ -96,7 +97,7 @@ protected: const std::vector&); protected: - double lambda; + double lambda{0.6307}; }; class MeshExport TaubinSmoothing : public LaplaceSmoothing @@ -108,7 +109,7 @@ public: void SetMicro(double m) { micro = m;} protected: - double micro; + double micro{0.0424}; }; /*! @@ -132,7 +133,7 @@ private: const std::vector&); private: - int weights; + int weights{1}; }; } // namespace MeshCore diff --git a/src/Mod/Mesh/App/Core/SphereFit.cpp b/src/Mod/Mesh/App/Core/SphereFit.cpp index 4d0572de05..f87a8c72c9 100644 --- a/src/Mod/Mesh/App/Core/SphereFit.cpp +++ b/src/Mod/Mesh/App/Core/SphereFit.cpp @@ -34,12 +34,7 @@ using namespace MeshCoreFit; SphereFit::SphereFit() - : _vCenter(0, 0, 0), - _dRadius(0), - _numIter(0), - _posConvLimit(0.0001), - _vConvLimit(0.001), - _maxIter(50) + : _vCenter(0, 0, 0) {} // Set approximations before calling the fitting diff --git a/src/Mod/Mesh/App/Core/SphereFit.h b/src/Mod/Mesh/App/Core/SphereFit.h index 7acf87d1cb..64c2e80a25 100644 --- a/src/Mod/Mesh/App/Core/SphereFit.h +++ b/src/Mod/Mesh/App/Core/SphereFit.h @@ -112,11 +112,11 @@ protected: protected: Base::Vector3d _vCenter;/**< Center of sphere. */ - double _dRadius; /**< Radius of the sphere. */ - int _numIter; /**< Number of iterations for solution to converge. */ - double _posConvLimit; /**< Position and radius parameter convergence threshold. */ - double _vConvLimit; /**< Residual convergence threshold. */ - int _maxIter; /**< Maximum number of iterations. */ + double _dRadius{0}; /**< Radius of the sphere. */ + int _numIter{0}; /**< Number of iterations for solution to converge. */ + double _posConvLimit{0.0001}; /**< Position and radius parameter convergence threshold. */ + double _vConvLimit{0.001}; /**< Residual convergence threshold. */ + int _maxIter{50}; /**< Maximum number of iterations. */ }; diff --git a/src/Mod/Mesh/App/Core/Tools.cpp b/src/Mod/Mesh/App/Core/Tools.cpp index c9d6aae109..b9547649bf 100644 --- a/src/Mod/Mesh/App/Core/Tools.cpp +++ b/src/Mod/Mesh/App/Core/Tools.cpp @@ -36,9 +36,7 @@ MeshSearchNeighbours::MeshSearchNeighbours (const MeshKernel &rclM, float fSampl , _rclFAry(rclM.GetFacets()) , _rclPAry(rclM.GetPoints()) , _clPt2Fa(rclM) - , _fMaxDistanceP2(0) , _fSampleDistance(fSampleDistance) - , _bTooFewPoints(false) { MeshAlgorithm(_rclMesh).ResetFacetFlag(MeshFacet::MARKED); MeshAlgorithm(_rclMesh).ResetPointFlag(MeshPoint::MARKED); diff --git a/src/Mod/Mesh/App/Core/Tools.h b/src/Mod/Mesh/App/Core/Tools.h index d3dd60dcfa..9920e1d7ee 100644 --- a/src/Mod/Mesh/App/Core/Tools.h +++ b/src/Mod/Mesh/App/Core/Tools.h @@ -78,7 +78,7 @@ protected: const MeshFacetArray &_rclFAry; const MeshPointArray &_rclPAry; MeshRefPointToFacets _clPt2Fa; - float _fMaxDistanceP2; // square distance + float _fMaxDistanceP2{0}; // square distance Base::Vector3f _clCenter; // center points of start facet std::set _aclResult; // result container (point indices) std::set _aclOuter; // next searching points @@ -86,7 +86,7 @@ protected: std::vector > _aclSampledFacets; // sample points from each facet float _fSampleDistance; // distance between two sampled points Wm4::Sphere3 _akSphere; - bool _bTooFewPoints; + bool _bTooFewPoints{false}; public: MeshSearchNeighbours (const MeshSearchNeighbours&) = delete; @@ -175,7 +175,7 @@ class MeshNearestIndexToPlane public: using Index = typename T::Index; MeshNearestIndexToPlane(const MeshKernel& mesh, const Base::Vector3f& b, const Base::Vector3f& n) - : nearest_index(-1),nearest_dist(FLOAT_MAX), it(mesh), base(b), normal(n) {} + : nearest_index(-1), it(mesh), base(b), normal(n) {} void operator() (Index index) { float dist = (float)fabs(it(index).DistanceToPlane(base, normal)); @@ -186,7 +186,7 @@ public: } Index nearest_index; - float nearest_dist; + float nearest_dist{FLOAT_MAX}; private: T it; diff --git a/src/Mod/Mesh/App/Core/TopoAlgorithm.cpp b/src/Mod/Mesh/App/Core/TopoAlgorithm.cpp index 0329dc18f2..e33d338304 100644 --- a/src/Mod/Mesh/App/Core/TopoAlgorithm.cpp +++ b/src/Mod/Mesh/App/Core/TopoAlgorithm.cpp @@ -42,7 +42,7 @@ using namespace MeshCore; MeshTopoAlgorithm::MeshTopoAlgorithm (MeshKernel &rclM) -: _rclMesh(rclM), _needsCleanup(false), _cache(nullptr) +: _rclMesh(rclM) { } diff --git a/src/Mod/Mesh/App/Core/TopoAlgorithm.h b/src/Mod/Mesh/App/Core/TopoAlgorithm.h index bc008fb75a..9813067db2 100644 --- a/src/Mod/Mesh/App/Core/TopoAlgorithm.h +++ b/src/Mod/Mesh/App/Core/TopoAlgorithm.h @@ -307,7 +307,7 @@ private: private: MeshKernel& _rclMesh; - bool _needsCleanup; + bool _needsCleanup{false}; struct Vertex_Less { @@ -316,7 +316,7 @@ private: // cache using tCache = std::map; - tCache* _cache; + tCache* _cache{nullptr}; }; /** diff --git a/src/Mod/Mesh/App/Core/Trim.cpp b/src/Mod/Mesh/App/Core/Trim.cpp index b7971a6eef..5359c591b3 100644 --- a/src/Mod/Mesh/App/Core/Trim.cpp +++ b/src/Mod/Mesh/App/Core/Trim.cpp @@ -36,7 +36,7 @@ using namespace MeshCore; MeshTrimming::MeshTrimming(MeshKernel &rclM, const Base::ViewProjMethod* pclProj, const Base::Polygon2d& rclPoly) - : myMesh(rclM), myInner(true), myProj(pclProj), myPoly(rclPoly) + : myMesh(rclM), myProj(pclProj), myPoly(rclPoly) { } @@ -448,7 +448,6 @@ bool MeshTrimming::CreateFacets(FacetIndex ulFacetPos, int iSide, const std::vec MeshFacet& facet = myMesh._aclFacetArray[ulFacetPos]; AdjustFacet(facet, iSide); - MeshFacet clOrg(myMesh._aclFacetArray[ulFacetPos]); clFac = myMesh.GetFacet(ulFacetPos); // intersection points Base::Vector3f clP1(raclPoints[0]), clP2(raclPoints[1]), clP3(raclPoints[2]), clP4(raclPoints[3]); diff --git a/src/Mod/Mesh/App/Core/Trim.h b/src/Mod/Mesh/App/Core/Trim.h index 9515bdff1f..5360567a21 100644 --- a/src/Mod/Mesh/App/Core/Trim.h +++ b/src/Mod/Mesh/App/Core/Trim.h @@ -96,7 +96,7 @@ private: private: MeshKernel& myMesh; - bool myInner; + bool myInner{true}; std::vector myTriangles; const Base::ViewProjMethod* myProj; const Base::Polygon2d& myPoly; diff --git a/src/Mod/Mesh/App/Core/Visitor.cpp b/src/Mod/Mesh/App/Core/Visitor.cpp index 4c0695e221..fce056f419 100644 --- a/src/Mod/Mesh/App/Core/Visitor.cpp +++ b/src/Mod/Mesh/App/Core/Visitor.cpp @@ -163,9 +163,7 @@ MeshSearchNeighbourFacetsVisitor::MeshSearchNeighbourFacetsVisitor (const MeshKe FacetIndex ulStartFacetIdx) : _rclMeshBase(rclMesh), _clCenter(rclMesh.GetFacet(ulStartFacetIdx).GetGravityPoint()), - _fRadius(fRadius), - _ulCurrentLevel(0), - _bFacetsFoundInCurrentLevel(false) + _fRadius(fRadius) { } diff --git a/src/Mod/Mesh/App/Core/Visitor.h b/src/Mod/Mesh/App/Core/Visitor.h index 637a34b6ac..bf991f7799 100644 --- a/src/Mod/Mesh/App/Core/Visitor.h +++ b/src/Mod/Mesh/App/Core/Visitor.h @@ -89,8 +89,8 @@ protected: const MeshKernel& _rclMeshBase; /**< The mesh kernel. */ Base::Vector3f _clCenter; /**< Center. */ float _fRadius; /**< Search radius. */ - unsigned long _ulCurrentLevel; - bool _bFacetsFoundInCurrentLevel; + unsigned long _ulCurrentLevel{0}; + bool _bFacetsFoundInCurrentLevel{false}; std::vector _vecFacets; /**< Found facets. */ }; diff --git a/src/Mod/Mesh/App/Edge.cpp b/src/Mod/Mesh/App/Edge.cpp index 7fd0ffb847..787cf8cf82 100644 --- a/src/Mod/Mesh/App/Edge.cpp +++ b/src/Mod/Mesh/App/Edge.cpp @@ -31,9 +31,8 @@ using namespace Mesh; -Edge::Edge() - : Index(-1) - , Mesh(nullptr) +Edge::Edge() //NOLINT + : Mesh(nullptr) { for (int i=0; i<2; i++) { PIndex[i] = MeshCore::POINT_INDEX_MAX; diff --git a/src/Mod/Mesh/App/Edge.h b/src/Mod/Mesh/App/Edge.h index fd55122b54..4da2c74cbc 100644 --- a/src/Mod/Mesh/App/Edge.h +++ b/src/Mod/Mesh/App/Edge.h @@ -49,7 +49,7 @@ public: void unbound(); void operator = (const Edge& f); - int Index; + int Index{-1}; MeshCore::PointIndex PIndex[2]; MeshCore::FacetIndex NIndex[2]; Base::Reference Mesh; diff --git a/src/Mod/Mesh/App/Exporter.cpp b/src/Mod/Mesh/App/Exporter.cpp index 9a7d337845..86c3da6628 100644 --- a/src/Mod/Mesh/App/Exporter.cpp +++ b/src/Mod/Mesh/App/Exporter.cpp @@ -309,8 +309,7 @@ void Exporter3MF::write() ExporterAMF::ExporterAMF( std::string fileName, const std::map &meta, - bool compress ) : - outputStreamPtr(nullptr), nextObjectIndex(0) + bool compress ) { // ask for write permission throwIfNoPermission(fileName); diff --git a/src/Mod/Mesh/App/Exporter.h b/src/Mod/Mesh/App/Exporter.h index 0d45dbf179..64d817c266 100644 --- a/src/Mod/Mesh/App/Exporter.h +++ b/src/Mod/Mesh/App/Exporter.h @@ -223,8 +223,8 @@ private: void write(); private: - std::ostream *outputStreamPtr; - int nextObjectIndex; + std::ostream *outputStreamPtr{nullptr}; + int nextObjectIndex{0}; /// Helper for putting Base::Vector3f objects into a std::map in addMesh() class VertLess; diff --git a/src/Mod/Mesh/App/MeshProperties.cpp b/src/Mod/Mesh/App/MeshProperties.cpp index fa85cb94b9..c353ed558c 100644 --- a/src/Mod/Mesh/App/MeshProperties.cpp +++ b/src/Mod/Mesh/App/MeshProperties.cpp @@ -725,7 +725,7 @@ bool PropertyMaterial::isSame(const App::Property& other) const // ---------------------------------------------------------------------------- PropertyMeshKernel::PropertyMeshKernel() - : _meshObject(new MeshObject()), meshPyObject(nullptr) + : _meshObject(new MeshObject()) { // Note: Normally this property is a member of a document object, i.e. the setValue() // method gets called in the constructor of a subclass of DocumentObject, e.g. Mesh::Feature. diff --git a/src/Mod/Mesh/App/MeshProperties.h b/src/Mod/Mesh/App/MeshProperties.h index 4d209a02ec..47c14c185a 100644 --- a/src/Mod/Mesh/App/MeshProperties.h +++ b/src/Mod/Mesh/App/MeshProperties.h @@ -298,7 +298,7 @@ public: private: Base::Reference _meshObject; - MeshPy* meshPyObject; + MeshPy* meshPyObject{nullptr}; }; } // namespace Mesh diff --git a/src/Mod/Mesh/Gui/DlgEvaluateMeshImp.cpp b/src/Mod/Mesh/Gui/DlgEvaluateMeshImp.cpp index 4bf72f00e6..a99c344605 100644 --- a/src/Mod/Mesh/Gui/DlgEvaluateMeshImp.cpp +++ b/src/Mod/Mesh/Gui/DlgEvaluateMeshImp.cpp @@ -69,13 +69,7 @@ void CleanupHandler::cleanup() class DlgEvaluateMeshImp::Private { public: - Private() - : meshFeature(nullptr) - , view(nullptr) - , enableFoldsCheck(false) - , checkNonManfoldPoints(false) - , strictlyDegenerated(true) - , epsilonDegenerated(0.0f) + Private() : view(nullptr) { } @@ -88,15 +82,15 @@ public: ui.repairFoldsButton->setVisible(on); } - Ui_DlgEvaluateMesh ui; + Ui_DlgEvaluateMesh ui{}; std::map vp; - Mesh::Feature* meshFeature; + Mesh::Feature* meshFeature{nullptr}; QPointer view; std::vector self_intersections; - bool enableFoldsCheck; - bool checkNonManfoldPoints; - bool strictlyDegenerated; - float epsilonDegenerated; + bool enableFoldsCheck{false}; + bool checkNonManfoldPoints{false}; + bool strictlyDegenerated{true}; + float epsilonDegenerated{0.0f}; }; /* TRANSLATOR MeshGui::DlgEvaluateMeshImp */ diff --git a/src/Mod/Mesh/Gui/MeshSelection.cpp b/src/Mod/Mesh/Gui/MeshSelection.cpp index 6798db53f6..eb464ffe2b 100644 --- a/src/Mod/Mesh/Gui/MeshSelection.cpp +++ b/src/Mod/Mesh/Gui/MeshSelection.cpp @@ -75,14 +75,6 @@ unsigned char MeshSelection::cross_mask_bitmap[] = { }; MeshSelection::MeshSelection() - : onlyPointToUserTriangles(false) - , onlyVisibleTriangles(false) - , addToSelection(false) - , addComponent(false) - , removeComponent(false) - , activeCB(nullptr) - , selectionCB(nullptr) - , ivViewer(nullptr) { setCallback(selectGLCallback); } @@ -464,7 +456,6 @@ void MeshSelection::selectGLCallback(void * ud, SoEventCallback * n) SbVec3f pnt, dir; view->getNearPlane(pnt, dir); - Base::Vector3f point (pnt[0],pnt[1],pnt[2]); Base::Vector3f normal(dir[0],dir[1],dir[2]); std::list views = self->getViewProviders(); diff --git a/src/Mod/Mesh/Gui/MeshSelection.h b/src/Mod/Mesh/Gui/MeshSelection.h index 630e29aac0..f4323fa4a9 100644 --- a/src/Mod/Mesh/Gui/MeshSelection.h +++ b/src/Mod/Mesh/Gui/MeshSelection.h @@ -86,11 +86,14 @@ private: static void pickFaceCallback(void * ud, SoEventCallback * n); private: - bool onlyPointToUserTriangles, onlyVisibleTriangles; - bool addToSelection, addComponent, removeComponent; - SoEventCallbackCB *activeCB; - SoEventCallbackCB *selectionCB; - Gui::View3DInventorViewer* ivViewer; + bool onlyPointToUserTriangles{false}; + bool onlyVisibleTriangles{false}; + bool addToSelection{false}; + bool addComponent{false}; + bool removeComponent{false}; + SoEventCallbackCB *activeCB{nullptr}; + SoEventCallbackCB *selectionCB{nullptr}; + Gui::View3DInventorViewer* ivViewer{nullptr}; mutable std::vector meshObjects; static unsigned char cross_bitmap[]; diff --git a/src/Mod/Mesh/Gui/SoFCIndexedFaceSet.cpp b/src/Mod/Mesh/Gui/SoFCIndexedFaceSet.cpp index 9928bfe26b..9667e1e6c4 100644 --- a/src/Mod/Mesh/Gui/SoFCIndexedFaceSet.cpp +++ b/src/Mod/Mesh/Gui/SoFCIndexedFaceSet.cpp @@ -74,12 +74,11 @@ class MeshRenderer::Private { public: Gui::OpenGLMultiBuffer vertices; Gui::OpenGLMultiBuffer indices; - const SbColor * pcolors; - SoMaterialBindingElement::Binding matbinding; - bool initialized; + const SbColor * pcolors{nullptr}; + SoMaterialBindingElement::Binding matbinding{SoMaterialBindingElement::OVERALL}; + bool initialized{false}; Private(); - ~Private(); bool canRenderGLArray(SoGLRenderAction *) const; void generateGLArrays(SoGLRenderAction* action, SoMaterialBindingElement::Binding matbind, @@ -96,14 +95,9 @@ private: MeshRenderer::Private::Private() : vertices(GL_ARRAY_BUFFER) , indices(GL_ELEMENT_ARRAY_BUFFER) - , pcolors(nullptr) - , matbinding(SoMaterialBindingElement::OVERALL) - , initialized(false) { } -MeshRenderer::Private::~Private() = default; - bool MeshRenderer::Private::canRenderGLArray(SoGLRenderAction *action) const { static bool init = false; @@ -461,7 +455,6 @@ void SoFCIndexedFaceSet::initClass() SoFCIndexedFaceSet::SoFCIndexedFaceSet() : renderTriangleLimit(UINT_MAX) - , selectBuf(nullptr) { SO_NODE_CONSTRUCTOR(SoFCIndexedFaceSet); SO_NODE_ADD_FIELD(updateGLArray, (false)); diff --git a/src/Mod/Mesh/Gui/SoFCIndexedFaceSet.h b/src/Mod/Mesh/Gui/SoFCIndexedFaceSet.h index e4533d2c86..9edb77aa69 100644 --- a/src/Mod/Mesh/Gui/SoFCIndexedFaceSet.h +++ b/src/Mod/Mesh/Gui/SoFCIndexedFaceSet.h @@ -136,7 +136,7 @@ private: private: MeshRenderer render; - GLuint *selectBuf; + GLuint *selectBuf{nullptr}; }; } // namespace MeshGui diff --git a/src/Mod/Mesh/Gui/SoFCMeshObject.cpp b/src/Mod/Mesh/Gui/SoFCMeshObject.cpp index 7d54a029a8..8cbdc0205e 100644 --- a/src/Mod/Mesh/Gui/SoFCMeshObject.cpp +++ b/src/Mod/Mesh/Gui/SoFCMeshObject.cpp @@ -331,7 +331,7 @@ SO_NODE_SOURCE(SoFCMeshPickNode) /*! Constructor. */ -SoFCMeshPickNode::SoFCMeshPickNode() : meshGrid(nullptr) +SoFCMeshPickNode::SoFCMeshPickNode() { SO_NODE_CONSTRUCTOR(SoFCMeshPickNode); @@ -585,8 +585,6 @@ void SoFCMeshObjectShape::initClass() SoFCMeshObjectShape::SoFCMeshObjectShape() : renderTriangleLimit(UINT_MAX) - , selectBuf(nullptr) - , updateGLArray(false) { SO_NODE_CONSTRUCTOR(SoFCMeshObjectShape); setName(SoFCMeshObjectShape::getClassTypeId().getName()); diff --git a/src/Mod/Mesh/Gui/SoFCMeshObject.h b/src/Mod/Mesh/Gui/SoFCMeshObject.h index ca2559e26b..ac0adf5199 100644 --- a/src/Mod/Mesh/Gui/SoFCMeshObject.h +++ b/src/Mod/Mesh/Gui/SoFCMeshObject.h @@ -93,7 +93,7 @@ protected: ~SoFCMeshPickNode() override; private: - MeshCore::MeshFacetGrid* meshGrid; + MeshCore::MeshFacetGrid* meshGrid{nullptr}; }; // ------------------------------------------------------- @@ -212,13 +212,13 @@ private: void renderCoordsGLArray(SoGLRenderAction *action); private: - GLuint *selectBuf; - GLfloat modelview[16]; - GLfloat projection[16]; + GLuint *selectBuf{nullptr}; + GLfloat modelview[16]{}; + GLfloat projection[16]{}; // Vertex array handling std::vector index_array; std::vector vertex_array; - SbBool updateGLArray; + SbBool updateGLArray{false}; }; class MeshGuiExport SoFCMeshSegmentShape : public SoShape { diff --git a/src/Mod/Mesh/Gui/ViewProvider.cpp b/src/Mod/Mesh/Gui/ViewProvider.cpp index df5d9fae0c..d16a0e468e 100644 --- a/src/Mod/Mesh/Gui/ViewProvider.cpp +++ b/src/Mod/Mesh/Gui/ViewProvider.cpp @@ -221,7 +221,7 @@ const char* ViewProviderMesh::LightingEnums[]= {"One side", "Two side", nullptr} PROPERTY_SOURCE(MeshGui::ViewProviderMesh, Gui::ViewProviderGeometryObject) -ViewProviderMesh::ViewProviderMesh() : pcOpenEdge(nullptr) +ViewProviderMesh::ViewProviderMesh() : highlightMode{HighlighMode::None} { static const char *osgroup = "Object Style"; diff --git a/src/Mod/Mesh/Gui/ViewProvider.h b/src/Mod/Mesh/Gui/ViewProvider.h index 12e6a34f00..ad03b2ce66 100644 --- a/src/Mod/Mesh/Gui/ViewProvider.h +++ b/src/Mod/Mesh/Gui/ViewProvider.h @@ -236,16 +236,18 @@ protected: Segment, Color }; + //NOLINTBEGIN HighlighMode highlightMode; - Gui::SoFCSelection * pcHighlight; - SoGroup * pcShapeGroup; - SoDrawStyle * pcLineStyle; - SoDrawStyle * pcPointStyle; - SoSeparator * pcOpenEdge; - SoBaseColor * pOpenColor; - SoMaterial * pLineColor; - SoShapeHints * pShapeHints; - SoMaterialBinding * pcMatBinding; + Gui::SoFCSelection * pcHighlight{nullptr}; + SoGroup * pcShapeGroup{nullptr}; + SoDrawStyle * pcLineStyle{nullptr}; + SoDrawStyle * pcPointStyle{nullptr}; + SoSeparator * pcOpenEdge{nullptr}; + SoBaseColor * pOpenColor{nullptr}; + SoMaterial * pLineColor{nullptr}; + SoShapeHints * pShapeHints{nullptr}; + SoMaterialBinding * pcMatBinding{nullptr}; + //NOLINTEND private: static App::PropertyFloatConstraint::Constraints floatRange;