All: Reformat according to new standard
This commit is contained in:
committed by
Kacper Donat
parent
eafd18dac0
commit
25c3ba7338
@@ -35,9 +35,9 @@
|
||||
#include <Mod/Part/App/BSplineSurfacePy.h>
|
||||
#include <Mod/Points/App/PointsPy.h>
|
||||
#if defined(HAVE_PCL_FILTERS)
|
||||
#include <pcl/filters/passthrough.h>
|
||||
#include <pcl/filters/voxel_grid.h>
|
||||
#include <pcl/point_types.h>
|
||||
# include <pcl/filters/passthrough.h>
|
||||
# include <pcl/filters/voxel_grid.h>
|
||||
# include <pcl/point_types.h>
|
||||
#endif
|
||||
|
||||
#include "ApproxSurface.h"
|
||||
|
||||
@@ -48,10 +48,12 @@ SplineBasisfunction::SplineBasisfunction(int iSize)
|
||||
, _iOrder(1)
|
||||
{}
|
||||
|
||||
SplineBasisfunction::SplineBasisfunction(TColStd_Array1OfReal& vKnots,
|
||||
TColStd_Array1OfInteger& vMults,
|
||||
int iSize,
|
||||
int iOrder)
|
||||
SplineBasisfunction::SplineBasisfunction(
|
||||
TColStd_Array1OfReal& vKnots,
|
||||
TColStd_Array1OfInteger& vMults,
|
||||
int iSize,
|
||||
int iOrder
|
||||
)
|
||||
: _vKnotVector(0, iSize - 1)
|
||||
{
|
||||
int sum = 0;
|
||||
@@ -94,9 +96,7 @@ void SplineBasisfunction::SetKnots(TColStd_Array1OfReal& vKnots, int iOrder)
|
||||
_iOrder = iOrder;
|
||||
}
|
||||
|
||||
void SplineBasisfunction::SetKnots(TColStd_Array1OfReal& vKnots,
|
||||
TColStd_Array1OfInteger& vMults,
|
||||
int iOrder)
|
||||
void SplineBasisfunction::SetKnots(TColStd_Array1OfReal& vKnots, TColStd_Array1OfInteger& vMults, int iOrder)
|
||||
{
|
||||
int sum = 0;
|
||||
for (int h = vMults.Lower(); h <= vMults.Upper(); h++) {
|
||||
@@ -124,10 +124,12 @@ BSplineBasis::BSplineBasis(int iSize)
|
||||
: SplineBasisfunction(iSize)
|
||||
{}
|
||||
|
||||
BSplineBasis::BSplineBasis(TColStd_Array1OfReal& vKnots,
|
||||
TColStd_Array1OfInteger& vMults,
|
||||
int iSize,
|
||||
int iOrder)
|
||||
BSplineBasis::BSplineBasis(
|
||||
TColStd_Array1OfReal& vKnots,
|
||||
TColStd_Array1OfInteger& vMults,
|
||||
int iSize,
|
||||
int iOrder
|
||||
)
|
||||
: SplineBasisfunction(vKnots, vMults, iSize, iOrder)
|
||||
{}
|
||||
|
||||
@@ -257,10 +259,12 @@ double BSplineBasis::BasisFunction(int iIndex, double fParam)
|
||||
return N(0);
|
||||
}
|
||||
|
||||
void BSplineBasis::DerivativesOfBasisFunction(int iIndex,
|
||||
int iMaxDer,
|
||||
double fParam,
|
||||
TColStd_Array1OfReal& Derivat)
|
||||
void BSplineBasis::DerivativesOfBasisFunction(
|
||||
int iIndex,
|
||||
int iMaxDer,
|
||||
double fParam,
|
||||
TColStd_Array1OfReal& Derivat
|
||||
)
|
||||
{
|
||||
int iMax = iMaxDer;
|
||||
if (Derivat.Length() != iMax + 1) {
|
||||
@@ -482,8 +486,7 @@ double BSplineBasis::GetIntegralOfProductOfBSplines(int iIdx1, int iIdx2, int iO
|
||||
return dIntegral;
|
||||
}
|
||||
|
||||
void BSplineBasis::GenerateRootsAndWeights(TColStd_Array1OfReal& vRoots,
|
||||
TColStd_Array1OfReal& vWeights)
|
||||
void BSplineBasis::GenerateRootsAndWeights(TColStd_Array1OfReal& vRoots, TColStd_Array1OfReal& vWeights)
|
||||
{
|
||||
int iSize = vRoots.Length();
|
||||
|
||||
@@ -635,10 +638,12 @@ int BSplineBasis::CalcSize(int r, int s)
|
||||
|
||||
/////////////////// ParameterCorrection
|
||||
|
||||
ParameterCorrection::ParameterCorrection(unsigned usUOrder,
|
||||
unsigned usVOrder,
|
||||
unsigned usUCtrlpoints,
|
||||
unsigned usVCtrlpoints)
|
||||
ParameterCorrection::ParameterCorrection(
|
||||
unsigned usUOrder,
|
||||
unsigned usVOrder,
|
||||
unsigned usUCtrlpoints,
|
||||
unsigned usVCtrlpoints
|
||||
)
|
||||
: _usUOrder(usUOrder)
|
||||
, _usVOrder(usVOrder)
|
||||
, _usUCtrlpoints(usUCtrlpoints)
|
||||
@@ -768,9 +773,7 @@ void ParameterCorrection::SetUV(const Base::Vector3d& clU, const Base::Vector3d&
|
||||
}
|
||||
}
|
||||
|
||||
void ParameterCorrection::GetUVW(Base::Vector3d& clU,
|
||||
Base::Vector3d& clV,
|
||||
Base::Vector3d& clW) const
|
||||
void ParameterCorrection::GetUVW(Base::Vector3d& clU, Base::Vector3d& clV, Base::Vector3d& clW) const
|
||||
{
|
||||
clU = _clU;
|
||||
clV = _clV;
|
||||
@@ -807,10 +810,12 @@ void ParameterCorrection::ProjectControlPointsOnPlane()
|
||||
}
|
||||
}
|
||||
|
||||
Handle(Geom_BSplineSurface) ParameterCorrection::CreateSurface(const TColgp_Array1OfPnt& points,
|
||||
int iIter,
|
||||
bool bParaCor,
|
||||
double fSizeFactor)
|
||||
Handle(Geom_BSplineSurface) ParameterCorrection::CreateSurface(
|
||||
const TColgp_Array1OfPnt& points,
|
||||
int iIter,
|
||||
bool bParaCor,
|
||||
double fSizeFactor
|
||||
)
|
||||
{
|
||||
if (_pvcPoints) {
|
||||
delete _pvcPoints;
|
||||
@@ -844,13 +849,15 @@ Handle(Geom_BSplineSurface) ParameterCorrection::CreateSurface(const TColgp_Arra
|
||||
DoParameterCorrection(iIter);
|
||||
}
|
||||
|
||||
return new Geom_BSplineSurface(_vCtrlPntsOfSurf,
|
||||
_vUKnots,
|
||||
_vVKnots,
|
||||
_vUMults,
|
||||
_vVMults,
|
||||
_usUOrder - 1,
|
||||
_usVOrder - 1);
|
||||
return new Geom_BSplineSurface(
|
||||
_vCtrlPntsOfSurf,
|
||||
_vUKnots,
|
||||
_vVKnots,
|
||||
_vUMults,
|
||||
_vVMults,
|
||||
_usUOrder - 1,
|
||||
_usVOrder - 1
|
||||
);
|
||||
}
|
||||
|
||||
void ParameterCorrection::EnableSmoothing(bool bSmooth, double fSmoothInfl)
|
||||
@@ -862,10 +869,12 @@ void ParameterCorrection::EnableSmoothing(bool bSmooth, double fSmoothInfl)
|
||||
/////////////////// BSplineParameterCorrection
|
||||
|
||||
|
||||
BSplineParameterCorrection::BSplineParameterCorrection(unsigned usUOrder,
|
||||
unsigned usVOrder,
|
||||
unsigned usUCtrlpoints,
|
||||
unsigned usVCtrlpoints)
|
||||
BSplineParameterCorrection::BSplineParameterCorrection(
|
||||
unsigned usUOrder,
|
||||
unsigned usVOrder,
|
||||
unsigned usUCtrlpoints,
|
||||
unsigned usVCtrlpoints
|
||||
)
|
||||
: ParameterCorrection(usUOrder, usVOrder, usUCtrlpoints, usVCtrlpoints)
|
||||
, _clUSpline(usUCtrlpoints + usUOrder)
|
||||
, _clVSpline(usVCtrlpoints + usVOrder)
|
||||
@@ -963,21 +972,24 @@ void BSplineParameterCorrection::DoParameterCorrection(int iIter)
|
||||
double fMaxDiff = 0.0, fMaxScalar = 1.0;
|
||||
double fWeight = _fSmoothInfluence;
|
||||
|
||||
Base::SequencerLauncher seq("Calc surface...",
|
||||
static_cast<size_t>(iIter)
|
||||
* static_cast<size_t>(_pvcPoints->Length()));
|
||||
Base::SequencerLauncher seq(
|
||||
"Calc surface...",
|
||||
static_cast<size_t>(iIter) * static_cast<size_t>(_pvcPoints->Length())
|
||||
);
|
||||
|
||||
do {
|
||||
fMaxScalar = 1.0;
|
||||
fMaxDiff = 0.0;
|
||||
|
||||
Handle(Geom_BSplineSurface) pclBSplineSurf = new Geom_BSplineSurface(_vCtrlPntsOfSurf,
|
||||
_vUKnots,
|
||||
_vVKnots,
|
||||
_vUMults,
|
||||
_vVMults,
|
||||
_usUOrder - 1,
|
||||
_usVOrder - 1);
|
||||
Handle(Geom_BSplineSurface) pclBSplineSurf = new Geom_BSplineSurface(
|
||||
_vCtrlPntsOfSurf,
|
||||
_vUKnots,
|
||||
_vVKnots,
|
||||
_vUMults,
|
||||
_vVMults,
|
||||
_usUOrder - 1,
|
||||
_usVOrder - 1
|
||||
);
|
||||
|
||||
for (int ii = _pvcPoints->Lower(); ii <= _pvcPoints->Upper(); ii++) {
|
||||
double fDeltaU, fDeltaV, fU, fV;
|
||||
@@ -1203,8 +1215,8 @@ bool BSplineParameterCorrection::SolveWithSmoothing(double fWeight)
|
||||
std::generate(columns.begin(), columns.end(), Base::iotaGen<int>(0));
|
||||
ScalarProduct scalar(M);
|
||||
// NOLINTBEGIN
|
||||
QFuture<std::vector<double>> future =
|
||||
QtConcurrent::mapped(columns, std::bind(&ScalarProduct::multiply, &scalar, sp::_1));
|
||||
QFuture<std::vector<double>> future
|
||||
= QtConcurrent::mapped(columns, std::bind(&ScalarProduct::multiply, &scalar, sp::_1));
|
||||
// NOLINTEND
|
||||
QFutureWatcher<std::vector<double>> watcher;
|
||||
watcher.setFuture(future);
|
||||
@@ -1214,8 +1226,7 @@ bool BSplineParameterCorrection::SolveWithSmoothing(double fWeight)
|
||||
int rowIndex = 0;
|
||||
for (const auto& it : future) {
|
||||
int colIndex = 0;
|
||||
for (std::vector<double>::const_iterator jt = it.begin(); jt != it.end();
|
||||
++jt, colIndex++) {
|
||||
for (std::vector<double>::const_iterator jt = it.begin(); jt != it.end(); ++jt, colIndex++) {
|
||||
MTM(rowIndex, colIndex) = *jt;
|
||||
}
|
||||
rowIndex++;
|
||||
@@ -1267,17 +1278,15 @@ bool BSplineParameterCorrection::SolveWithSmoothing(double fWeight)
|
||||
return true;
|
||||
}
|
||||
|
||||
void BSplineParameterCorrection::CalcSmoothingTerms(bool bRecalc,
|
||||
double fFirst,
|
||||
double fSecond,
|
||||
double fThird)
|
||||
void BSplineParameterCorrection::CalcSmoothingTerms(bool bRecalc, double fFirst, double fSecond, double fThird)
|
||||
{
|
||||
if (bRecalc) {
|
||||
Base::SequencerLauncher seq("Initializing...",
|
||||
static_cast<size_t>(3) * static_cast<size_t>(_usUCtrlpoints)
|
||||
* static_cast<size_t>(_usUCtrlpoints)
|
||||
* static_cast<size_t>(_usVCtrlpoints)
|
||||
* static_cast<size_t>(_usVCtrlpoints));
|
||||
Base::SequencerLauncher seq(
|
||||
"Initializing...",
|
||||
static_cast<size_t>(3) * static_cast<size_t>(_usUCtrlpoints)
|
||||
* static_cast<size_t>(_usUCtrlpoints) * static_cast<size_t>(_usVCtrlpoints)
|
||||
* static_cast<size_t>(_usVCtrlpoints)
|
||||
);
|
||||
CalcFirstSmoothMatrix(seq);
|
||||
CalcSecondSmoothMatrix(seq);
|
||||
CalcThirdSmoothMatrix(seq);
|
||||
@@ -1371,11 +1380,13 @@ void BSplineParameterCorrection::EnableSmoothing(bool bSmooth, double fSmoothInf
|
||||
EnableSmoothing(bSmooth, fSmoothInfl, 1.0, 0.0, 0.0);
|
||||
}
|
||||
|
||||
void BSplineParameterCorrection::EnableSmoothing(bool bSmooth,
|
||||
double fSmoothInfl,
|
||||
double fFirst,
|
||||
double fSec,
|
||||
double fThird)
|
||||
void BSplineParameterCorrection::EnableSmoothing(
|
||||
bool bSmooth,
|
||||
double fSmoothInfl,
|
||||
double fFirst,
|
||||
double fSec,
|
||||
double fThird
|
||||
)
|
||||
{
|
||||
if (_bSmoothing && bSmooth) {
|
||||
CalcSmoothingTerms(false, fFirst, fSec, fThird);
|
||||
|
||||
@@ -78,10 +78,12 @@ public:
|
||||
* and the sum of the values in @a vMults has to be identical to @a iSize.
|
||||
* @param iOrder Order (degree + 1) of the basic polynomial
|
||||
*/
|
||||
SplineBasisfunction(TColStd_Array1OfReal& vKnots,
|
||||
TColStd_Array1OfInteger& vMults,
|
||||
int iSize,
|
||||
int iOrder = 1);
|
||||
SplineBasisfunction(
|
||||
TColStd_Array1OfReal& vKnots,
|
||||
TColStd_Array1OfInteger& vMults,
|
||||
int iSize,
|
||||
int iOrder = 1
|
||||
);
|
||||
|
||||
virtual ~SplineBasisfunction();
|
||||
|
||||
@@ -115,10 +117,12 @@ public:
|
||||
*
|
||||
* The list must be sufficiently long for iMaxDer+1 elements.
|
||||
*/
|
||||
virtual void DerivativesOfBasisFunction(int iIndex,
|
||||
int iMaxDer,
|
||||
double fParam,
|
||||
TColStd_Array1OfReal& Derivat) = 0;
|
||||
virtual void DerivativesOfBasisFunction(
|
||||
int iIndex,
|
||||
int iMaxDer,
|
||||
double fParam,
|
||||
TColStd_Array1OfReal& Derivat
|
||||
) = 0;
|
||||
|
||||
/**
|
||||
* Calculates the kth derivative at the point fParam
|
||||
@@ -136,8 +140,7 @@ public:
|
||||
* is passed on. Internally, this is converted into a knot vector in the form of (value, 1).
|
||||
* The size of this new vector has to be exactly as big as specified in the constructor.
|
||||
*/
|
||||
virtual void
|
||||
SetKnots(TColStd_Array1OfReal& vKnots, TColStd_Array1OfInteger& vMults, int iOrder = 1);
|
||||
virtual void SetKnots(TColStd_Array1OfReal& vKnots, TColStd_Array1OfInteger& vMults, int iOrder = 1);
|
||||
|
||||
protected: // Member
|
||||
// Knot vector
|
||||
@@ -172,10 +175,7 @@ public:
|
||||
* sum of the values in @a vMults has to be identical to @a iSize.
|
||||
* @param iOrder Order (degree + 1) of the basic polynomial
|
||||
*/
|
||||
BSplineBasis(TColStd_Array1OfReal& vKnots,
|
||||
TColStd_Array1OfInteger& vMults,
|
||||
int iSize,
|
||||
int iOrder = 1);
|
||||
BSplineBasis(TColStd_Array1OfReal& vKnots, TColStd_Array1OfInteger& vMults, int iSize, int iOrder = 1);
|
||||
|
||||
/**
|
||||
* Specifies the knot index for the parameter value (from: Piegl/Tiller 96 The NURBS-Book)
|
||||
@@ -224,10 +224,12 @@ public:
|
||||
* The list must be sufficiently long for iMaxDer+1 elements.
|
||||
* @return List of function values
|
||||
*/
|
||||
void DerivativesOfBasisFunction(int iIndex,
|
||||
int iMaxDer,
|
||||
double fParam,
|
||||
TColStd_Array1OfReal& Derivat) override;
|
||||
void DerivativesOfBasisFunction(
|
||||
int iIndex,
|
||||
int iMaxDer,
|
||||
double fParam,
|
||||
TColStd_Array1OfReal& Derivat
|
||||
) override;
|
||||
|
||||
/**
|
||||
* Calculates the kth derivative at the point fParam
|
||||
@@ -250,8 +252,10 @@ protected:
|
||||
/**
|
||||
* Calculates the roots of the Legendre-Polynomials and the corresponding weights
|
||||
*/
|
||||
virtual void GenerateRootsAndWeights(TColStd_Array1OfReal& vAbscissas,
|
||||
TColStd_Array1OfReal& vWeights);
|
||||
virtual void GenerateRootsAndWeights(
|
||||
TColStd_Array1OfReal& vAbscissas,
|
||||
TColStd_Array1OfReal& vWeights
|
||||
);
|
||||
|
||||
/**
|
||||
* Calculates the limits of integration (Indexes of the knots)
|
||||
@@ -271,10 +275,11 @@ class ReenExport ParameterCorrection
|
||||
public:
|
||||
// Constructor
|
||||
explicit ParameterCorrection(
|
||||
unsigned usUOrder = 4, // Order in u-direction (order = degree + 1)
|
||||
unsigned usVOrder = 4, // Order in v-direction
|
||||
unsigned usUCtrlpoints = 6, // Qty. of the control points in the u-direction
|
||||
unsigned usVCtrlpoints = 6); // Qty. of the control points in the v-direction
|
||||
unsigned usUOrder = 4, // Order in u-direction (order = degree + 1)
|
||||
unsigned usVOrder = 4, // Order in v-direction
|
||||
unsigned usUCtrlpoints = 6, // Qty. of the control points in the u-direction
|
||||
unsigned usVCtrlpoints = 6
|
||||
); // Qty. of the control points in the v-direction
|
||||
|
||||
virtual ~ParameterCorrection()
|
||||
{
|
||||
@@ -327,10 +332,12 @@ public:
|
||||
/**
|
||||
* Calculates a B-spline surface from the given points
|
||||
*/
|
||||
virtual Handle(Geom_BSplineSurface) CreateSurface(const TColgp_Array1OfPnt& points,
|
||||
int iIter,
|
||||
bool bParaCor,
|
||||
double fSizeFactor = 0.0f);
|
||||
virtual Handle(Geom_BSplineSurface) CreateSurface(
|
||||
const TColgp_Array1OfPnt& points,
|
||||
int iIter,
|
||||
bool bParaCor,
|
||||
double fSizeFactor = 0.0f
|
||||
);
|
||||
/**
|
||||
* Setting the u/v directions
|
||||
* The third parameter specifies whether the directions should actually be used.
|
||||
@@ -387,10 +394,11 @@ class ReenExport BSplineParameterCorrection: public ParameterCorrection
|
||||
public:
|
||||
// Constructor
|
||||
explicit BSplineParameterCorrection(
|
||||
unsigned usUOrder = 4, // Order in u-direction (order = degree + 1)
|
||||
unsigned usVOrder = 4, // Order in the v-direction
|
||||
unsigned usUCtrlpoints = 6, // Qty. of the control points in u-direction
|
||||
unsigned usVCtrlpoints = 6); // Qty. of the control points in v-direction
|
||||
unsigned usUOrder = 4, // Order in u-direction (order = degree + 1)
|
||||
unsigned usVOrder = 4, // Order in the v-direction
|
||||
unsigned usUCtrlpoints = 6, // Qty. of the control points in u-direction
|
||||
unsigned usVCtrlpoints = 6
|
||||
); // Qty. of the control points in v-direction
|
||||
|
||||
~BSplineParameterCorrection() override = default;
|
||||
|
||||
@@ -465,8 +473,7 @@ public:
|
||||
/**
|
||||
* Use smoothing-terms
|
||||
*/
|
||||
virtual void
|
||||
EnableSmoothing(bool bSmooth, double fSmoothInfl, double fFirst, double fSec, double fThird);
|
||||
virtual void EnableSmoothing(bool bSmooth, double fSmoothInfl, double fFirst, double fSec, double fThird);
|
||||
|
||||
protected:
|
||||
/**
|
||||
|
||||
@@ -23,24 +23,24 @@
|
||||
***************************************************************************/
|
||||
|
||||
#if defined(HAVE_PCL_OPENNURBS)
|
||||
#include <map>
|
||||
# include <map>
|
||||
|
||||
#include <Geom_BSplineSurface.hxx>
|
||||
#include <TColStd_Array1OfInteger.hxx>
|
||||
#include <TColStd_Array1OfReal.hxx>
|
||||
#include <TColStd_Array2OfReal.hxx>
|
||||
#include <TColgp_Array2OfPnt.hxx>
|
||||
# include <Geom_BSplineSurface.hxx>
|
||||
# include <TColStd_Array1OfInteger.hxx>
|
||||
# include <TColStd_Array1OfReal.hxx>
|
||||
# include <TColStd_Array2OfReal.hxx>
|
||||
# include <TColgp_Array2OfPnt.hxx>
|
||||
|
||||
#include <Mod/Points/App/PointsPy.h>
|
||||
# include <Mod/Points/App/PointsPy.h>
|
||||
|
||||
#include "BSplineFitting.h"
|
||||
# include "BSplineFitting.h"
|
||||
|
||||
#include <pcl/pcl_config.h>
|
||||
#include <pcl/io/pcd_io.h>
|
||||
#include <pcl/point_cloud.h>
|
||||
#include <pcl/point_types.h>
|
||||
#include <pcl/surface/on_nurbs/fitting_curve_2d_asdm.h>
|
||||
#include <pcl/surface/on_nurbs/fitting_surface_tdm.h>
|
||||
# include <pcl/pcl_config.h>
|
||||
# include <pcl/io/pcd_io.h>
|
||||
# include <pcl/point_cloud.h>
|
||||
# include <pcl/point_types.h>
|
||||
# include <pcl/surface/on_nurbs/fitting_curve_2d_asdm.h>
|
||||
# include <pcl/surface/on_nurbs/fitting_surface_tdm.h>
|
||||
|
||||
using namespace Reen;
|
||||
|
||||
@@ -201,16 +201,18 @@ Handle(Geom_BSplineSurface) BSplineFitting::perform()
|
||||
vMultArray.SetValue(index, it->second);
|
||||
}
|
||||
|
||||
Handle(Geom_BSplineSurface) spline = new Geom_BSplineSurface(poles,
|
||||
weights,
|
||||
uKnotArray,
|
||||
vKnotArray,
|
||||
uMultArray,
|
||||
vMultArray,
|
||||
uDegree,
|
||||
vDegree,
|
||||
uPeriodic,
|
||||
vPeriodic);
|
||||
Handle(Geom_BSplineSurface) spline = new Geom_BSplineSurface(
|
||||
poles,
|
||||
weights,
|
||||
uKnotArray,
|
||||
vKnotArray,
|
||||
uMultArray,
|
||||
vMultArray,
|
||||
uDegree,
|
||||
vDegree,
|
||||
uPeriodic,
|
||||
vPeriodic
|
||||
);
|
||||
return spline;
|
||||
}
|
||||
#endif // HAVE_PCL_OPENNURBS
|
||||
|
||||
@@ -26,10 +26,10 @@
|
||||
#define REEN_BSPLINEFITTING_H
|
||||
|
||||
#if defined(HAVE_PCL_OPENNURBS)
|
||||
#include <vector>
|
||||
# include <vector>
|
||||
|
||||
#include <Base/Vector3D.h>
|
||||
#include <Geom_BSplineSurface.hxx>
|
||||
# include <Base/Vector3D.h>
|
||||
# include <Geom_BSplineSurface.hxx>
|
||||
|
||||
|
||||
namespace Reen
|
||||
|
||||
@@ -29,7 +29,7 @@
|
||||
|
||||
// pcl headers include <boost/bind.hpp> instead of <boost/bind/bind.hpp>
|
||||
#ifndef BOOST_BIND_GLOBAL_PLACEHOLDERS
|
||||
#define BOOST_BIND_GLOBAL_PLACEHOLDERS
|
||||
# define BOOST_BIND_GLOBAL_PLACEHOLDERS
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
@@ -32,15 +32,15 @@
|
||||
|
||||
|
||||
#if defined(HAVE_PCL_FILTERS)
|
||||
#include <pcl/filters/passthrough.h>
|
||||
#include <pcl/point_types.h>
|
||||
# include <pcl/filters/passthrough.h>
|
||||
# include <pcl/point_types.h>
|
||||
#endif
|
||||
#if defined(HAVE_PCL_SEGMENTATION)
|
||||
#include <pcl/features/normal_3d.h>
|
||||
#include <pcl/filters/extract_indices.h>
|
||||
#include <pcl/search/kdtree.h>
|
||||
#include <pcl/search/search.h>
|
||||
#include <pcl/segmentation/region_growing.h>
|
||||
# include <pcl/features/normal_3d.h>
|
||||
# include <pcl/filters/extract_indices.h>
|
||||
# include <pcl/search/kdtree.h>
|
||||
# include <pcl/search/search.h>
|
||||
# include <pcl/segmentation/region_growing.h>
|
||||
|
||||
using namespace std;
|
||||
using namespace Reen;
|
||||
@@ -58,8 +58,7 @@ void RegionGrowing::perform(int ksearch)
|
||||
pcl::PointCloud<pcl::PointXYZ>::Ptr cloud(new pcl::PointCloud<pcl::PointXYZ>);
|
||||
cloud->reserve(myPoints.size());
|
||||
for (Points::PointKernel::const_iterator it = myPoints.begin(); it != myPoints.end(); ++it) {
|
||||
if (!boost::math::isnan(it->x) && !boost::math::isnan(it->y)
|
||||
&& !boost::math::isnan(it->z)) {
|
||||
if (!boost::math::isnan(it->x) && !boost::math::isnan(it->y) && !boost::math::isnan(it->z)) {
|
||||
cloud->push_back(pcl::PointXYZ(it->x, it->y, it->z));
|
||||
}
|
||||
}
|
||||
@@ -95,8 +94,7 @@ void RegionGrowing::perform(int ksearch)
|
||||
std::vector<pcl::PointIndices> clusters;
|
||||
reg.extract(clusters);
|
||||
|
||||
for (std::vector<pcl::PointIndices>::iterator it = clusters.begin(); it != clusters.end();
|
||||
++it) {
|
||||
for (std::vector<pcl::PointIndices>::iterator it = clusters.begin(); it != clusters.end(); ++it) {
|
||||
myClusters.push_back(std::vector<int>());
|
||||
myClusters.back().swap(it->indices);
|
||||
}
|
||||
@@ -149,8 +147,7 @@ void RegionGrowing::perform(const std::vector<Base::Vector3f>& myNormals)
|
||||
std::vector<pcl::PointIndices> clusters;
|
||||
reg.extract(clusters);
|
||||
|
||||
for (std::vector<pcl::PointIndices>::iterator it = clusters.begin(); it != clusters.end();
|
||||
++it) {
|
||||
for (std::vector<pcl::PointIndices>::iterator it = clusters.begin(); it != clusters.end(); ++it) {
|
||||
myClusters.push_back(std::vector<int>());
|
||||
myClusters.back().swap(it->indices);
|
||||
}
|
||||
|
||||
@@ -32,13 +32,13 @@
|
||||
|
||||
|
||||
#if defined(HAVE_PCL_SAMPLE_CONSENSUS)
|
||||
#include <pcl/features/normal_3d.h>
|
||||
#include <pcl/point_types.h>
|
||||
#include <pcl/sample_consensus/ransac.h>
|
||||
#include <pcl/sample_consensus/sac_model_cone.h>
|
||||
#include <pcl/sample_consensus/sac_model_cylinder.h>
|
||||
#include <pcl/sample_consensus/sac_model_plane.h>
|
||||
#include <pcl/sample_consensus/sac_model_sphere.h>
|
||||
# include <pcl/features/normal_3d.h>
|
||||
# include <pcl/point_types.h>
|
||||
# include <pcl/sample_consensus/ransac.h>
|
||||
# include <pcl/sample_consensus/sac_model_cone.h>
|
||||
# include <pcl/sample_consensus/sac_model_cylinder.h>
|
||||
# include <pcl/sample_consensus/sac_model_plane.h>
|
||||
# include <pcl/sample_consensus/sac_model_sphere.h>
|
||||
|
||||
using namespace std;
|
||||
using namespace Reen;
|
||||
@@ -46,9 +46,11 @@ using pcl::PointCloud;
|
||||
using pcl::PointNormal;
|
||||
using pcl::PointXYZ;
|
||||
|
||||
SampleConsensus::SampleConsensus(SacModel sac,
|
||||
const Points::PointKernel& pts,
|
||||
const std::vector<Base::Vector3d>& nor)
|
||||
SampleConsensus::SampleConsensus(
|
||||
SacModel sac,
|
||||
const Points::PointKernel& pts,
|
||||
const std::vector<Base::Vector3d>& nor
|
||||
)
|
||||
: mySac(sac)
|
||||
, myPoints(pts)
|
||||
, myNormals(nor)
|
||||
@@ -59,8 +61,7 @@ double SampleConsensus::perform(std::vector<float>& parameters, std::vector<int>
|
||||
pcl::PointCloud<pcl::PointXYZ>::Ptr cloud(new pcl::PointCloud<pcl::PointXYZ>);
|
||||
cloud->reserve(myPoints.size());
|
||||
for (Points::PointKernel::const_iterator it = myPoints.begin(); it != myPoints.end(); ++it) {
|
||||
if (!boost::math::isnan(it->x) && !boost::math::isnan(it->y)
|
||||
&& !boost::math::isnan(it->z)) {
|
||||
if (!boost::math::isnan(it->x) && !boost::math::isnan(it->y) && !boost::math::isnan(it->z)) {
|
||||
cloud->push_back(pcl::PointXYZ(it->x, it->y, it->z));
|
||||
}
|
||||
}
|
||||
@@ -71,7 +72,7 @@ double SampleConsensus::perform(std::vector<float>& parameters, std::vector<int>
|
||||
|
||||
pcl::PointCloud<pcl::Normal>::Ptr normals(new pcl::PointCloud<pcl::Normal>());
|
||||
if (mySac == SACMODEL_CONE || mySac == SACMODEL_CYLINDER) {
|
||||
#if 0
|
||||
# if 0
|
||||
// Create search tree
|
||||
pcl::search::KdTree<pcl::PointXYZ>::Ptr tree;
|
||||
tree.reset (new pcl::search::KdTree<PointXYZ> (false));
|
||||
@@ -84,7 +85,7 @@ double SampleConsensus::perform(std::vector<float>& parameters, std::vector<int>
|
||||
n.setSearchMethod (tree);
|
||||
n.setKSearch (ksearch);
|
||||
n.compute (*normals);
|
||||
#else
|
||||
# else
|
||||
normals->reserve(myNormals.size());
|
||||
for (std::vector<Base::Vector3d>::const_iterator it = myNormals.begin();
|
||||
it != myNormals.end();
|
||||
@@ -94,7 +95,7 @@ double SampleConsensus::perform(std::vector<float>& parameters, std::vector<int>
|
||||
normals->push_back(pcl::Normal(it->x, it->y, it->z));
|
||||
}
|
||||
}
|
||||
#endif
|
||||
# endif
|
||||
}
|
||||
|
||||
// created RandomSampleConsensus object and compute the appropriated model
|
||||
@@ -110,14 +111,16 @@ double SampleConsensus::perform(std::vector<float>& parameters, std::vector<int>
|
||||
}
|
||||
case SACMODEL_CONE: {
|
||||
pcl::SampleConsensusModelCone<pcl::PointXYZ, pcl::Normal>::Ptr model_c(
|
||||
new pcl::SampleConsensusModelCone<pcl::PointXYZ, pcl::Normal>(cloud));
|
||||
new pcl::SampleConsensusModelCone<pcl::PointXYZ, pcl::Normal>(cloud)
|
||||
);
|
||||
model_c->setInputNormals(normals);
|
||||
model_p = model_c;
|
||||
break;
|
||||
}
|
||||
case SACMODEL_CYLINDER: {
|
||||
pcl::SampleConsensusModelCylinder<pcl::PointXYZ, pcl::Normal>::Ptr model_c(
|
||||
new pcl::SampleConsensusModelCylinder<pcl::PointXYZ, pcl::Normal>(cloud));
|
||||
new pcl::SampleConsensusModelCylinder<pcl::PointXYZ, pcl::Normal>(cloud)
|
||||
);
|
||||
model_c->setInputNormals(normals);
|
||||
model_p = model_c;
|
||||
break;
|
||||
|
||||
@@ -29,21 +29,21 @@
|
||||
|
||||
|
||||
#if defined(HAVE_PCL_FILTERS)
|
||||
#include <pcl/features/normal_3d.h>
|
||||
#include <pcl/filters/extract_indices.h>
|
||||
#include <pcl/filters/passthrough.h>
|
||||
# include <pcl/features/normal_3d.h>
|
||||
# include <pcl/filters/extract_indices.h>
|
||||
# include <pcl/filters/passthrough.h>
|
||||
#endif
|
||||
|
||||
#if defined(HAVE_PCL_SAMPLE_CONSENSUS)
|
||||
#include <pcl/sample_consensus/method_types.h>
|
||||
#include <pcl/sample_consensus/model_types.h>
|
||||
# include <pcl/sample_consensus/method_types.h>
|
||||
# include <pcl/sample_consensus/model_types.h>
|
||||
#endif
|
||||
|
||||
#if defined(HAVE_PCL_SEGMENTATION)
|
||||
#include <pcl/ModelCoefficients.h>
|
||||
#include <pcl/io/pcd_io.h>
|
||||
#include <pcl/point_types.h>
|
||||
#include <pcl/segmentation/sac_segmentation.h>
|
||||
# include <pcl/ModelCoefficients.h>
|
||||
# include <pcl/io/pcd_io.h>
|
||||
# include <pcl/point_types.h>
|
||||
# include <pcl/segmentation/sac_segmentation.h>
|
||||
#endif
|
||||
|
||||
using namespace std;
|
||||
@@ -180,7 +180,7 @@ void NormalEstimation::perform(std::vector<Base::Vector3d>& normals)
|
||||
cloud->width = int(cloud->points.size());
|
||||
cloud->height = 1;
|
||||
|
||||
#if 0
|
||||
# if 0
|
||||
// Build a passthrough filter to remove spurious NaNs
|
||||
pcl::PointCloud<PointXYZ>::Ptr cloud_filtered (new pcl::PointCloud<PointXYZ>);
|
||||
pcl::PassThrough<PointXYZ> pass;
|
||||
@@ -188,7 +188,7 @@ void NormalEstimation::perform(std::vector<Base::Vector3d>& normals)
|
||||
pass.setFilterFieldName ("z");
|
||||
pass.setFilterLimits (0, 1.5);
|
||||
pass.filter (*cloud_filtered);
|
||||
#endif
|
||||
# endif
|
||||
|
||||
// Estimate point normals
|
||||
pcl::PointCloud<pcl::Normal>::Ptr cloud_normals(new pcl::PointCloud<pcl::Normal>);
|
||||
|
||||
@@ -35,26 +35,26 @@
|
||||
|
||||
// http://svn.pointclouds.org/pcl/tags/pcl-1.5.1/test/
|
||||
#if defined(HAVE_PCL_SURFACE)
|
||||
#include <boost/math/special_functions/fpclassify.hpp>
|
||||
#include <boost/random.hpp>
|
||||
#include <pcl/common/common.h>
|
||||
#include <pcl/common/io.h>
|
||||
#include <pcl/features/normal_3d.h>
|
||||
#include <pcl/pcl_config.h>
|
||||
#include <pcl/type_traits.h>
|
||||
#include <pcl/point_types.h>
|
||||
#include <pcl/surface/ear_clipping.h>
|
||||
#include <pcl/surface/gp3.h>
|
||||
#include <pcl/surface/grid_projection.h>
|
||||
#include <pcl/surface/marching_cubes_hoppe.h>
|
||||
#include <pcl/surface/marching_cubes_rbf.h>
|
||||
#include <pcl/surface/mls.h>
|
||||
#include <pcl/surface/organized_fast_mesh.h>
|
||||
#include <pcl/surface/poisson.h>
|
||||
# include <boost/math/special_functions/fpclassify.hpp>
|
||||
# include <boost/random.hpp>
|
||||
# include <pcl/common/common.h>
|
||||
# include <pcl/common/io.h>
|
||||
# include <pcl/features/normal_3d.h>
|
||||
# include <pcl/pcl_config.h>
|
||||
# include <pcl/type_traits.h>
|
||||
# include <pcl/point_types.h>
|
||||
# include <pcl/surface/ear_clipping.h>
|
||||
# include <pcl/surface/gp3.h>
|
||||
# include <pcl/surface/grid_projection.h>
|
||||
# include <pcl/surface/marching_cubes_hoppe.h>
|
||||
# include <pcl/surface/marching_cubes_rbf.h>
|
||||
# include <pcl/surface/mls.h>
|
||||
# include <pcl/surface/organized_fast_mesh.h>
|
||||
# include <pcl/surface/poisson.h>
|
||||
|
||||
#ifndef PCL_REVISION_VERSION
|
||||
#define PCL_REVISION_VERSION 0
|
||||
#endif
|
||||
# ifndef PCL_REVISION_VERSION
|
||||
# define PCL_REVISION_VERSION 0
|
||||
# endif
|
||||
|
||||
using namespace pcl;
|
||||
using namespace pcl::io;
|
||||
@@ -80,8 +80,7 @@ void SurfaceTriangulation::perform(int ksearch)
|
||||
|
||||
cloud->reserve(myPoints.size());
|
||||
for (Points::PointKernel::const_iterator it = myPoints.begin(); it != myPoints.end(); ++it) {
|
||||
if (!boost::math::isnan(it->x) && !boost::math::isnan(it->y)
|
||||
&& !boost::math::isnan(it->z)) {
|
||||
if (!boost::math::isnan(it->x) && !boost::math::isnan(it->y) && !boost::math::isnan(it->z)) {
|
||||
cloud->push_back(PointXYZ(it->x, it->y, it->z));
|
||||
}
|
||||
}
|
||||
@@ -206,8 +205,7 @@ void PoissonReconstruction::perform(int ksearch)
|
||||
|
||||
cloud->reserve(myPoints.size());
|
||||
for (Points::PointKernel::const_iterator it = myPoints.begin(); it != myPoints.end(); ++it) {
|
||||
if (!boost::math::isnan(it->x) && !boost::math::isnan(it->y)
|
||||
&& !boost::math::isnan(it->z)) {
|
||||
if (!boost::math::isnan(it->x) && !boost::math::isnan(it->y) && !boost::math::isnan(it->z)) {
|
||||
cloud->push_back(PointXYZ(it->x, it->y, it->z));
|
||||
}
|
||||
}
|
||||
@@ -325,8 +323,7 @@ void GridReconstruction::perform(int ksearch)
|
||||
|
||||
cloud->reserve(myPoints.size());
|
||||
for (Points::PointKernel::const_iterator it = myPoints.begin(); it != myPoints.end(); ++it) {
|
||||
if (!boost::math::isnan(it->x) && !boost::math::isnan(it->y)
|
||||
&& !boost::math::isnan(it->z)) {
|
||||
if (!boost::math::isnan(it->x) && !boost::math::isnan(it->y) && !boost::math::isnan(it->z)) {
|
||||
cloud->push_back(PointXYZ(it->x, it->y, it->z));
|
||||
}
|
||||
}
|
||||
@@ -420,10 +417,12 @@ void GridReconstruction::perform(const std::vector<Base::Vector3f>& normals)
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
ImageTriangulation::ImageTriangulation(int width,
|
||||
int height,
|
||||
const Points::PointKernel& pts,
|
||||
Mesh::MeshObject& mesh)
|
||||
ImageTriangulation::ImageTriangulation(
|
||||
int width,
|
||||
int height,
|
||||
const Points::PointKernel& pts,
|
||||
Mesh::MeshObject& mesh
|
||||
)
|
||||
: width(width)
|
||||
, height(height)
|
||||
, myPoints(pts)
|
||||
@@ -516,8 +515,7 @@ void Reen::MarchingCubesRBF::perform(int ksearch)
|
||||
|
||||
cloud->reserve(myPoints.size());
|
||||
for (Points::PointKernel::const_iterator it = myPoints.begin(); it != myPoints.end(); ++it) {
|
||||
if (!boost::math::isnan(it->x) && !boost::math::isnan(it->y)
|
||||
&& !boost::math::isnan(it->z)) {
|
||||
if (!boost::math::isnan(it->x) && !boost::math::isnan(it->y) && !boost::math::isnan(it->z)) {
|
||||
cloud->push_back(PointXYZ(it->x, it->y, it->z));
|
||||
}
|
||||
}
|
||||
@@ -628,8 +626,7 @@ void Reen::MarchingCubesHoppe::perform(int ksearch)
|
||||
|
||||
cloud->reserve(myPoints.size());
|
||||
for (Points::PointKernel::const_iterator it = myPoints.begin(); it != myPoints.end(); ++it) {
|
||||
if (!boost::math::isnan(it->x) && !boost::math::isnan(it->y)
|
||||
&& !boost::math::isnan(it->z)) {
|
||||
if (!boost::math::isnan(it->x) && !boost::math::isnan(it->y) && !boost::math::isnan(it->z)) {
|
||||
cloud->push_back(PointXYZ(it->x, it->y, it->z));
|
||||
}
|
||||
}
|
||||
@@ -747,10 +744,12 @@ void MeshConversion::convert(const pcl::PolygonMesh& pclMesh, Mesh::MeshObject&
|
||||
&& (pclMesh.cloud.fields[d].name == "x" || pclMesh.cloud.fields[d].name == "y"
|
||||
|| pclMesh.cloud.fields[d].name == "z")) {
|
||||
float value;
|
||||
memcpy(&value,
|
||||
&pclMesh.cloud.data[i * point_size + pclMesh.cloud.fields[d].offset
|
||||
+ c * sizeof(float)],
|
||||
sizeof(float));
|
||||
memcpy(
|
||||
&value,
|
||||
&pclMesh.cloud
|
||||
.data[i * point_size + pclMesh.cloud.fields[d].offset + c * sizeof(float)],
|
||||
sizeof(float)
|
||||
);
|
||||
vertex[xyz] = value;
|
||||
if (++xyz == 3) {
|
||||
points.push_back(vertex);
|
||||
|
||||
@@ -76,9 +76,11 @@ void CmdApproxCurve::activated(int)
|
||||
App::DocumentObjectT objT;
|
||||
auto obj = Gui::Selection().getObjectsOfType(App::GeoFeature::getClassTypeId());
|
||||
if (obj.size() != 1 || !(obj.at(0)->isDerivedFrom<Points::Feature>())) {
|
||||
QMessageBox::warning(Gui::getMainWindow(),
|
||||
qApp->translate("Reen_ApproxSurface", "Wrong selection"),
|
||||
qApp->translate("Reen_ApproxSurface", "Select a point cloud."));
|
||||
QMessageBox::warning(
|
||||
Gui::getMainWindow(),
|
||||
qApp->translate("Reen_ApproxSurface", "Wrong selection"),
|
||||
qApp->translate("Reen_ApproxSurface", "Select a point cloud.")
|
||||
);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -108,15 +110,16 @@ CmdApproxSurface::CmdApproxSurface()
|
||||
void CmdApproxSurface::activated(int)
|
||||
{
|
||||
App::DocumentObjectT objT;
|
||||
std::vector<App::DocumentObject*> obj =
|
||||
Gui::Selection().getObjectsOfType(App::GeoFeature::getClassTypeId());
|
||||
std::vector<App::DocumentObject*> obj = Gui::Selection().getObjectsOfType(
|
||||
App::GeoFeature::getClassTypeId()
|
||||
);
|
||||
if (obj.size() != 1
|
||||
|| !(obj.at(0)->isDerivedFrom<Points::Feature>()
|
||||
|| obj.at(0)->isDerivedFrom<Mesh::Feature>())) {
|
||||
|| !(obj.at(0)->isDerivedFrom<Points::Feature>() || obj.at(0)->isDerivedFrom<Mesh::Feature>())) {
|
||||
QMessageBox::warning(
|
||||
Gui::getMainWindow(),
|
||||
qApp->translate("Reen_ApproxSurface", "Wrong selection"),
|
||||
qApp->translate("Reen_ApproxSurface", "Select a point cloud or mesh."));
|
||||
qApp->translate("Reen_ApproxSurface", "Select a point cloud or mesh.")
|
||||
);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -153,8 +156,8 @@ void CmdApproxPlane::activated(int)
|
||||
it->getPropertyList(List);
|
||||
for (const auto& jt : List) {
|
||||
if (jt->isDerivedFrom<App::PropertyComplexGeoData>()) {
|
||||
const Data::ComplexGeoData* data =
|
||||
static_cast<App::PropertyComplexGeoData*>(jt)->getComplexData();
|
||||
const Data::ComplexGeoData* data
|
||||
= static_cast<App::PropertyComplexGeoData*>(jt)->getComplexData();
|
||||
if (data) {
|
||||
data->getPoints(aPoints, aNormals, 0.01f);
|
||||
if (!aPoints.empty()) {
|
||||
@@ -199,15 +202,12 @@ void CmdApproxPlane::activated(int)
|
||||
|
||||
Base::CoordinateSystem cs;
|
||||
cs.setPosition(Base::convertTo<Base::Vector3d>(base));
|
||||
cs.setAxes(Base::convertTo<Base::Vector3d>(norm),
|
||||
Base::convertTo<Base::Vector3d>(dirU));
|
||||
cs.setAxes(Base::convertTo<Base::Vector3d>(norm), Base::convertTo<Base::Vector3d>(dirU));
|
||||
Base::Placement pm = Base::CoordinateSystem().displacement(cs);
|
||||
double q0, q1, q2, q3;
|
||||
pm.getRotation().getValue(q0, q1, q2, q3);
|
||||
|
||||
Base::Console().log("RMS value for plane fit with %lu points: %.4f\n",
|
||||
aData.size(),
|
||||
sigma);
|
||||
Base::Console().log("RMS value for plane fit with %lu points: %.4f\n", aData.size(), sigma);
|
||||
Base::Console().log(" Plane base(%.4f, %.4f, %.4f)\n", base.x, base.y, base.z);
|
||||
Base::Console().log(" Plane normal(%.4f, %.4f, %.4f)\n", norm.x, norm.y, norm.z);
|
||||
|
||||
@@ -378,8 +378,8 @@ void CmdApproxPolynomial::activated(int)
|
||||
fit.AddPoints(kernel.GetPoints());
|
||||
if (fit.Fit() < std::numeric_limits<float>::max()) {
|
||||
Base::BoundBox3f bbox = fit.GetBoundings();
|
||||
std::vector<Base::Vector3d> poles =
|
||||
fit.toBezier(bbox.MinX, bbox.MaxX, bbox.MinY, bbox.MaxY);
|
||||
std::vector<Base::Vector3d> poles
|
||||
= fit.toBezier(bbox.MinX, bbox.MaxX, bbox.MinY, bbox.MaxY);
|
||||
fit.Transform(poles);
|
||||
|
||||
TColgp_Array2OfPnt grid(1, 3, 1, 3);
|
||||
@@ -394,8 +394,7 @@ void CmdApproxPolynomial::activated(int)
|
||||
grid.SetValue(3, 3, Base::convertTo<gp_Pnt>(poles.at(8)));
|
||||
|
||||
Handle(Geom_BezierSurface) bezier(new Geom_BezierSurface(grid));
|
||||
Part::Feature* part =
|
||||
static_cast<Part::Feature*>(doc->addObject("Part::Spline", "Bezier"));
|
||||
Part::Feature* part = static_cast<Part::Feature*>(doc->addObject("Part::Spline", "Bezier"));
|
||||
part->Shape.setValue(Part::GeomBezierSurface(bezier).toShape());
|
||||
}
|
||||
}
|
||||
@@ -604,12 +603,15 @@ CmdPoissonReconstruction::CmdPoissonReconstruction()
|
||||
void CmdPoissonReconstruction::activated(int)
|
||||
{
|
||||
App::DocumentObjectT objT;
|
||||
std::vector<App::DocumentObject*> obj =
|
||||
Gui::Selection().getObjectsOfType(Points::Feature::getClassTypeId());
|
||||
std::vector<App::DocumentObject*> obj = Gui::Selection().getObjectsOfType(
|
||||
Points::Feature::getClassTypeId()
|
||||
);
|
||||
if (obj.size() != 1) {
|
||||
QMessageBox::warning(Gui::getMainWindow(),
|
||||
qApp->translate("Reen_ApproxSurface", "Wrong selection"),
|
||||
qApp->translate("Reen_ApproxSurface", "Select a single point cloud."));
|
||||
QMessageBox::warning(
|
||||
Gui::getMainWindow(),
|
||||
qApp->translate("Reen_ApproxSurface", "Wrong selection"),
|
||||
qApp->translate("Reen_ApproxSurface", "Select a single point cloud.")
|
||||
);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -637,8 +639,9 @@ CmdViewTriangulation::CmdViewTriangulation()
|
||||
|
||||
void CmdViewTriangulation::activated(int)
|
||||
{
|
||||
std::vector<App::DocumentObject*> obj =
|
||||
Gui::Selection().getObjectsOfType(Points::Structured::getClassTypeId());
|
||||
std::vector<App::DocumentObject*> obj = Gui::Selection().getObjectsOfType(
|
||||
Points::Structured::getClassTypeId()
|
||||
);
|
||||
addModule(App, "ReverseEngineering");
|
||||
openCommand(QT_TRANSLATE_NOOP("Command", "View triangulation"));
|
||||
try {
|
||||
@@ -647,11 +650,13 @@ void CmdViewTriangulation::activated(int)
|
||||
QString document = QString::fromStdString(objT.getDocumentPython());
|
||||
QString object = QString::fromStdString(objT.getObjectPython());
|
||||
|
||||
QString command = QStringLiteral("%1.addObject('Mesh::Feature', 'View mesh').Mesh "
|
||||
"= ReverseEngineering.viewTriangulation("
|
||||
"Points=%2.Points,"
|
||||
"Width=%2.Width,"
|
||||
"Height=%2.Height)")
|
||||
QString command = QStringLiteral(
|
||||
"%1.addObject('Mesh::Feature', 'View mesh').Mesh "
|
||||
"= ReverseEngineering.viewTriangulation("
|
||||
"Points=%2.Points,"
|
||||
"Width=%2.Width,"
|
||||
"Height=%2.Height)"
|
||||
)
|
||||
.arg(document, object);
|
||||
runCommand(Doc, command.toLatin1());
|
||||
}
|
||||
@@ -661,9 +666,11 @@ void CmdViewTriangulation::activated(int)
|
||||
}
|
||||
catch (const Base::Exception& e) {
|
||||
abortCommand();
|
||||
QMessageBox::warning(Gui::getMainWindow(),
|
||||
qApp->translate("Reen_ViewTriangulation", "View triangulation failed"),
|
||||
QString::fromLatin1(e.what()));
|
||||
QMessageBox::warning(
|
||||
Gui::getMainWindow(),
|
||||
qApp->translate("Reen_ViewTriangulation", "View triangulation failed"),
|
||||
QString::fromLatin1(e.what())
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -99,8 +99,7 @@ void FitBSplineCurveWidget::tryAccept()
|
||||
QString object = QString::fromStdString(d->obj.getObjectPython());
|
||||
|
||||
QStringList arguments;
|
||||
arguments.append(
|
||||
QStringLiteral("Points=getattr(%1, %1.getPropertyNameOfGeometry())").arg(object));
|
||||
arguments.append(QStringLiteral("Points=getattr(%1, %1.getPropertyNameOfGeometry())").arg(object));
|
||||
if (!d->ui.groupBoxSmooth->isChecked()) {
|
||||
arguments.append(QStringLiteral("MinDegree = %1").arg(d->ui.degreeMin->value()));
|
||||
}
|
||||
@@ -123,8 +122,10 @@ void FitBSplineCurveWidget::tryAccept()
|
||||
}
|
||||
|
||||
QString argument = arguments.join(QLatin1String(", "));
|
||||
QString command = QStringLiteral("%1.addObject(\"Part::Spline\", \"Spline\").Shape = "
|
||||
"ReverseEngineering.approxCurve(%2).toShape()")
|
||||
QString command = QStringLiteral(
|
||||
"%1.addObject(\"Part::Spline\", \"Spline\").Shape = "
|
||||
"ReverseEngineering.approxCurve(%2).toShape()"
|
||||
)
|
||||
.arg(document, argument);
|
||||
|
||||
tryCommand(command);
|
||||
|
||||
@@ -59,10 +59,12 @@ FitBSplineSurfaceWidget::FitBSplineSurfaceWidget(const App::DocumentObjectT& obj
|
||||
{
|
||||
Q_UNUSED(parent);
|
||||
d->ui.setupUi(this);
|
||||
connect(d->ui.makePlacement,
|
||||
&QPushButton::clicked,
|
||||
this,
|
||||
&FitBSplineSurfaceWidget::onMakePlacementClicked);
|
||||
connect(
|
||||
d->ui.makePlacement,
|
||||
&QPushButton::clicked,
|
||||
this,
|
||||
&FitBSplineSurfaceWidget::onMakePlacementClicked
|
||||
);
|
||||
d->obj = obj;
|
||||
restoreSettings();
|
||||
}
|
||||
@@ -114,12 +116,12 @@ void FitBSplineSurfaceWidget::onMakePlacementClicked()
|
||||
geom->getComplexData()->getPoints(points, normals, 0.001);
|
||||
|
||||
std::vector<Base::Vector3f> data;
|
||||
std::transform(points.begin(),
|
||||
points.end(),
|
||||
std::back_inserter(data),
|
||||
[](const Base::Vector3d& v) {
|
||||
return Base::convertTo<Base::Vector3f>(v);
|
||||
});
|
||||
std::transform(
|
||||
points.begin(),
|
||||
points.end(),
|
||||
std::back_inserter(data),
|
||||
[](const Base::Vector3d& v) { return Base::convertTo<Base::Vector3f>(v); }
|
||||
);
|
||||
MeshCore::PlaneFit fit;
|
||||
fit.AddPoints(data);
|
||||
if (fit.Fit() < std::numeric_limits<float>::max()) {
|
||||
@@ -129,14 +131,18 @@ void FitBSplineSurfaceWidget::onMakePlacementClicked()
|
||||
|
||||
Base::CoordinateSystem cs;
|
||||
cs.setPosition(Base::convertTo<Base::Vector3d>(base));
|
||||
cs.setAxes(Base::convertTo<Base::Vector3d>(norm),
|
||||
Base::convertTo<Base::Vector3d>(dirU));
|
||||
cs.setAxes(
|
||||
Base::convertTo<Base::Vector3d>(norm),
|
||||
Base::convertTo<Base::Vector3d>(dirU)
|
||||
);
|
||||
Base::Placement pm = Base::CoordinateSystem().displacement(cs);
|
||||
double q0, q1, q2, q3;
|
||||
pm.getRotation().getValue(q0, q1, q2, q3);
|
||||
|
||||
QString argument = QStringLiteral("Base.Placement(Base.Vector(%1, %2, "
|
||||
"%3), Base.Rotation(%4, %5, %6, %7))")
|
||||
QString argument = QStringLiteral(
|
||||
"Base.Placement(Base.Vector(%1, %2, "
|
||||
"%3), Base.Rotation(%4, %5, %6, %7))"
|
||||
)
|
||||
.arg(base.x)
|
||||
.arg(base.y)
|
||||
.arg(base.z)
|
||||
@@ -146,10 +152,10 @@ void FitBSplineSurfaceWidget::onMakePlacementClicked()
|
||||
.arg(q3);
|
||||
|
||||
QString document = QString::fromStdString(d->obj.getDocumentPython());
|
||||
QString command =
|
||||
QStringLiteral(
|
||||
R"(%1.addObject("App::Placement", "Placement").Placement = %2)")
|
||||
.arg(document, argument);
|
||||
QString command = QStringLiteral(
|
||||
R"(%1.addObject("App::Placement", "Placement").Placement = %2)"
|
||||
)
|
||||
.arg(document, argument);
|
||||
|
||||
Gui::Command::openCommand(QT_TRANSLATE_NOOP("Command", "Placement"));
|
||||
Gui::Command::runCommand(Gui::Command::Doc, "from FreeCAD import Base");
|
||||
@@ -172,24 +178,28 @@ bool FitBSplineSurfaceWidget::accept()
|
||||
QString document = QString::fromStdString(d->obj.getDocumentPython());
|
||||
QString object = QString::fromStdString(d->obj.getObjectPython());
|
||||
|
||||
QString argument = QStringLiteral("Points=getattr(%1, %1.getPropertyNameOfGeometry()), "
|
||||
"UDegree=%2, VDegree=%3, "
|
||||
"NbUPoles=%4, NbVPoles=%5, "
|
||||
"Smooth=%6, "
|
||||
"Weight=%7, "
|
||||
"Grad=%8, "
|
||||
"Bend=%9, "
|
||||
"Curv=%10, "
|
||||
"Iterations=%11, "
|
||||
"PatchFactor=%12, "
|
||||
"Correction=True")
|
||||
QString argument = QStringLiteral(
|
||||
"Points=getattr(%1, %1.getPropertyNameOfGeometry()), "
|
||||
"UDegree=%2, VDegree=%3, "
|
||||
"NbUPoles=%4, NbVPoles=%5, "
|
||||
"Smooth=%6, "
|
||||
"Weight=%7, "
|
||||
"Grad=%8, "
|
||||
"Bend=%9, "
|
||||
"Curv=%10, "
|
||||
"Iterations=%11, "
|
||||
"PatchFactor=%12, "
|
||||
"Correction=True"
|
||||
)
|
||||
.arg(object)
|
||||
.arg(d->ui.degreeU->value())
|
||||
.arg(d->ui.degreeV->value())
|
||||
.arg(d->ui.polesU->value())
|
||||
.arg(d->ui.polesV->value())
|
||||
.arg(d->ui.groupBoxSmooth->isChecked() ? QLatin1String("True")
|
||||
: QLatin1String("False"))
|
||||
.arg(
|
||||
d->ui.groupBoxSmooth->isChecked() ? QLatin1String("True")
|
||||
: QLatin1String("False")
|
||||
)
|
||||
.arg(d->ui.totalWeight->value())
|
||||
.arg(d->ui.gradient->value())
|
||||
.arg(d->ui.bending->value())
|
||||
@@ -197,13 +207,14 @@ bool FitBSplineSurfaceWidget::accept()
|
||||
.arg(d->ui.iterations->value())
|
||||
.arg(d->ui.sizeFactor->value());
|
||||
if (d->ui.uvdir->isChecked()) {
|
||||
std::vector<App::Placement*> selection =
|
||||
Gui::Selection().getObjectsOfType<App::Placement>();
|
||||
std::vector<App::Placement*> selection
|
||||
= Gui::Selection().getObjectsOfType<App::Placement>();
|
||||
if (selection.size() != 1) {
|
||||
QMessageBox::warning(
|
||||
this,
|
||||
tr("Wrong selection"),
|
||||
tr("Select a single placement object to get the local orientation."));
|
||||
tr("Select a single placement object to get the local orientation.")
|
||||
);
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -212,17 +223,18 @@ bool FitBSplineSurfaceWidget::accept()
|
||||
Base::Vector3d v(0, 1, 0);
|
||||
rot.multVec(u, u);
|
||||
rot.multVec(v, v);
|
||||
argument +=
|
||||
QStringLiteral(", UVDirs=(FreeCAD.Vector(%1,%2,%3), FreeCAD.Vector(%4,%5,%6))")
|
||||
.arg(u.x)
|
||||
.arg(u.y)
|
||||
.arg(u.z)
|
||||
.arg(v.x)
|
||||
.arg(v.y)
|
||||
.arg(v.z);
|
||||
argument += QStringLiteral(", UVDirs=(FreeCAD.Vector(%1,%2,%3), FreeCAD.Vector(%4,%5,%6))")
|
||||
.arg(u.x)
|
||||
.arg(u.y)
|
||||
.arg(u.z)
|
||||
.arg(v.x)
|
||||
.arg(v.y)
|
||||
.arg(v.z);
|
||||
}
|
||||
QString command = QStringLiteral("%1.addObject(\"Part::Spline\", \"Spline\").Shape = "
|
||||
"ReverseEngineering.approxSurface(%2).toShape()")
|
||||
QString command = QStringLiteral(
|
||||
"%1.addObject(\"Part::Spline\", \"Spline\").Shape = "
|
||||
"ReverseEngineering.approxSurface(%2).toShape()"
|
||||
)
|
||||
.arg(document, argument);
|
||||
|
||||
Gui::WaitCursor wc;
|
||||
|
||||
@@ -66,16 +66,20 @@ bool PoissonWidget::accept()
|
||||
QString document = QString::fromStdString(d->obj.getDocumentPython());
|
||||
QString object = QString::fromStdString(d->obj.getObjectPython());
|
||||
|
||||
QString argument = QStringLiteral("Points=%1.Points, "
|
||||
"OctreeDepth=%2, "
|
||||
"SolverDivide=%3, "
|
||||
"SamplesPerNode=%4")
|
||||
QString argument = QStringLiteral(
|
||||
"Points=%1.Points, "
|
||||
"OctreeDepth=%2, "
|
||||
"SolverDivide=%3, "
|
||||
"SamplesPerNode=%4"
|
||||
)
|
||||
.arg(object)
|
||||
.arg(d->ui.octreeDepth->value())
|
||||
.arg(d->ui.solverDivide->value())
|
||||
.arg(d->ui.samplesPerNode->value());
|
||||
QString command = QStringLiteral("%1.addObject(\"Mesh::Feature\", \"Poisson\").Mesh = "
|
||||
"ReverseEngineering.poissonReconstruction(%2)")
|
||||
QString command = QStringLiteral(
|
||||
"%1.addObject(\"Mesh::Feature\", \"Poisson\").Mesh = "
|
||||
"ReverseEngineering.poissonReconstruction(%2)"
|
||||
)
|
||||
.arg(document, argument);
|
||||
|
||||
Gui::WaitCursor wc;
|
||||
|
||||
@@ -97,9 +97,12 @@ void Segmentation::accept()
|
||||
std::vector<MeshCore::MeshSurfaceSegmentPtr> segm;
|
||||
if (ui->groupBoxPln->isChecked()) {
|
||||
segm.emplace_back(
|
||||
std::make_shared<MeshCore::MeshCurvaturePlanarSegment>(meshCurv.GetCurvature(),
|
||||
ui->numPln->value(),
|
||||
ui->curvTolPln->value()));
|
||||
std::make_shared<MeshCore::MeshCurvaturePlanarSegment>(
|
||||
meshCurv.GetCurvature(),
|
||||
ui->numPln->value(),
|
||||
ui->curvTolPln->value()
|
||||
)
|
||||
);
|
||||
}
|
||||
finder.FindSegments(segm);
|
||||
|
||||
@@ -117,14 +120,15 @@ void Segmentation::accept()
|
||||
if (fit.Fit() < std::numeric_limits<float>::max()) {
|
||||
Base::Vector3f base = fit.GetBase();
|
||||
Base::Vector3f axis = fit.GetNormal();
|
||||
MeshCore::AbstractSurfaceFit* fitter =
|
||||
new MeshCore::PlaneSurfaceFit(base, axis);
|
||||
MeshCore::AbstractSurfaceFit* fitter = new MeshCore::PlaneSurfaceFit(base, axis);
|
||||
segmSurf.emplace_back(
|
||||
std::make_shared<MeshCore::MeshDistanceGenericSurfaceFitSegment>(
|
||||
fitter,
|
||||
kernel,
|
||||
ui->numPln->value(),
|
||||
ui->distToPln->value()));
|
||||
ui->distToPln->value()
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -147,8 +151,8 @@ void Segmentation::accept()
|
||||
|
||||
for (const auto& it : segmSurf) {
|
||||
const std::vector<MeshCore::MeshSegment>& data = it->GetSegments();
|
||||
std::shared_ptr<MeshCore::MeshDistanceGenericSurfaceFitSegment> genSegm =
|
||||
std::dynamic_pointer_cast<MeshCore::MeshDistanceGenericSurfaceFitSegment>(it);
|
||||
std::shared_ptr<MeshCore::MeshDistanceGenericSurfaceFitSegment> genSegm
|
||||
= std::dynamic_pointer_cast<MeshCore::MeshDistanceGenericSurfaceFitSegment>(it);
|
||||
|
||||
bool isPlanar = (strcmp(genSegm->GetType(), "Plane") == 0);
|
||||
for (const auto& jt : data) {
|
||||
@@ -156,8 +160,9 @@ void Segmentation::accept()
|
||||
algo.ResetFacetsFlag(jt, MeshCore::MeshFacet::TMP0);
|
||||
|
||||
Mesh::MeshObject* segment = mesh->meshFromSegment(jt);
|
||||
Mesh::Feature* feaSegm =
|
||||
static_cast<Mesh::Feature*>(group->addObject("Mesh::Feature", "Segment"));
|
||||
Mesh::Feature* feaSegm = static_cast<Mesh::Feature*>(
|
||||
group->addObject("Mesh::Feature", "Segment")
|
||||
);
|
||||
Mesh::MeshObject* feaMesh = feaSegm->Mesh.startEditing();
|
||||
feaMesh->swap(*segment);
|
||||
feaSegm->Mesh.finishEditing();
|
||||
@@ -190,7 +195,8 @@ void Segmentation::accept()
|
||||
[&hPlane](const Base::Vector3f& v) {
|
||||
gp_Pnt p(v.x, v.y, v.z);
|
||||
return GeomAPI_ProjectPointOnSurf(p, hPlane).NearestPoint();
|
||||
});
|
||||
}
|
||||
);
|
||||
|
||||
BRepBuilderAPI_MakePolygon mkPoly;
|
||||
for (std::vector<gp_Pnt>::reverse_iterator it = polygon.rbegin();
|
||||
@@ -210,14 +216,18 @@ void Segmentation::accept()
|
||||
}
|
||||
else {
|
||||
failures.push_back(feaSegm);
|
||||
Base::Console().warning("Failed to create face from %s\n",
|
||||
feaSegm->Label.getValue());
|
||||
Base::Console().warning(
|
||||
"Failed to create face from %s\n",
|
||||
feaSegm->Label.getValue()
|
||||
);
|
||||
}
|
||||
}
|
||||
catch (Standard_Failure&) {
|
||||
failures.push_back(feaSegm);
|
||||
Base::Console().error("Fatal failure to create face from %s\n",
|
||||
feaSegm->Label.getValue());
|
||||
Base::Console().error(
|
||||
"Fatal failure to create face from %s\n",
|
||||
feaSegm->Label.getValue()
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -231,22 +241,25 @@ void Segmentation::accept()
|
||||
|
||||
if (!unusedFacets.empty()) {
|
||||
std::unique_ptr<Mesh::MeshObject> segment(mesh->meshFromSegment(unusedFacets));
|
||||
Mesh::Feature* feaSegm =
|
||||
static_cast<Mesh::Feature*>(group->addObject("Mesh::Feature", "Unused"));
|
||||
Mesh::Feature* feaSegm = static_cast<Mesh::Feature*>(
|
||||
group->addObject("Mesh::Feature", "Unused")
|
||||
);
|
||||
Mesh::MeshObject* feaMesh = feaSegm->Mesh.startEditing();
|
||||
feaMesh->swap(*segment);
|
||||
feaSegm->Mesh.finishEditing();
|
||||
}
|
||||
}
|
||||
if (createCompound) {
|
||||
Part::Feature* shapeFea =
|
||||
static_cast<Part::Feature*>(group->addObject("Part::Feature", "Compound"));
|
||||
Part::Feature* shapeFea = static_cast<Part::Feature*>(
|
||||
group->addObject("Part::Feature", "Compound")
|
||||
);
|
||||
shapeFea->Shape.setValue(compound);
|
||||
|
||||
// create a sub-group where to move the problematic segments
|
||||
if (!failures.empty()) {
|
||||
App::DocumentObjectGroup* subgroup = static_cast<App::DocumentObjectGroup*>(
|
||||
group->addObject("App::DocumentObjectGroup", "Failed"));
|
||||
group->addObject("App::DocumentObjectGroup", "Failed")
|
||||
);
|
||||
failures = group->removeObjects(failures);
|
||||
subgroup->Group.setValues(failures);
|
||||
}
|
||||
|
||||
@@ -48,9 +48,11 @@ class Segmentation: public QWidget
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit Segmentation(Mesh::Feature* mesh,
|
||||
QWidget* parent = nullptr,
|
||||
Qt::WindowFlags fl = Qt::WindowFlags());
|
||||
explicit Segmentation(
|
||||
Mesh::Feature* mesh,
|
||||
QWidget* parent = nullptr,
|
||||
Qt::WindowFlags fl = Qt::WindowFlags()
|
||||
);
|
||||
~Segmentation() override;
|
||||
void accept();
|
||||
|
||||
|
||||
@@ -60,44 +60,22 @@ SegmentationManual::~SegmentationManual() = default;
|
||||
|
||||
void SegmentationManual::setupConnections()
|
||||
{
|
||||
connect(ui->selectRegion,
|
||||
&QPushButton::clicked,
|
||||
this,
|
||||
&SegmentationManual::onSelectRegionClicked);
|
||||
connect(ui->selectRegion, &QPushButton::clicked, this, &SegmentationManual::onSelectRegionClicked);
|
||||
connect(ui->selectAll, &QPushButton::clicked, this, &SegmentationManual::onSelectAllClicked);
|
||||
connect(ui->selectComponents,
|
||||
&QPushButton::clicked,
|
||||
this,
|
||||
&SegmentationManual::onSelectComponentsClicked);
|
||||
connect(ui->selectTriangle,
|
||||
&QPushButton::clicked,
|
||||
this,
|
||||
&SegmentationManual::onSelectTriangleClicked);
|
||||
connect(ui->deselectAll,
|
||||
&QPushButton::clicked,
|
||||
this,
|
||||
&SegmentationManual::onDeselectAllClicked);
|
||||
connect(ui->visibleTriangles,
|
||||
&QCheckBox::toggled,
|
||||
this,
|
||||
&SegmentationManual::onVisibleTrianglesToggled);
|
||||
connect(ui->screenTriangles,
|
||||
&QCheckBox::toggled,
|
||||
this,
|
||||
&SegmentationManual::onScreenTrianglesToggled);
|
||||
connect(
|
||||
ui->selectComponents,
|
||||
&QPushButton::clicked,
|
||||
this,
|
||||
&SegmentationManual::onSelectComponentsClicked
|
||||
);
|
||||
connect(ui->selectTriangle, &QPushButton::clicked, this, &SegmentationManual::onSelectTriangleClicked);
|
||||
connect(ui->deselectAll, &QPushButton::clicked, this, &SegmentationManual::onDeselectAllClicked);
|
||||
connect(ui->visibleTriangles, &QCheckBox::toggled, this, &SegmentationManual::onVisibleTrianglesToggled);
|
||||
connect(ui->screenTriangles, &QCheckBox::toggled, this, &SegmentationManual::onScreenTrianglesToggled);
|
||||
connect(ui->cbSelectComp, &QCheckBox::toggled, this, &SegmentationManual::onSelectCompToggled);
|
||||
connect(ui->planeDetect,
|
||||
&QPushButton::clicked,
|
||||
this,
|
||||
&SegmentationManual::onPlaneDetectClicked);
|
||||
connect(ui->cylinderDetect,
|
||||
&QPushButton::clicked,
|
||||
this,
|
||||
&SegmentationManual::onCylinderDetectClicked);
|
||||
connect(ui->sphereDetect,
|
||||
&QPushButton::clicked,
|
||||
this,
|
||||
&SegmentationManual::onSphereDetectClicked);
|
||||
connect(ui->planeDetect, &QPushButton::clicked, this, &SegmentationManual::onPlaneDetectClicked);
|
||||
connect(ui->cylinderDetect, &QPushButton::clicked, this, &SegmentationManual::onCylinderDetectClicked);
|
||||
connect(ui->sphereDetect, &QPushButton::clicked, this, &SegmentationManual::onSphereDetectClicked);
|
||||
}
|
||||
|
||||
void SegmentationManual::changeEvent(QEvent* e)
|
||||
@@ -153,8 +131,11 @@ public:
|
||||
static void findGeometry(
|
||||
int minFaces,
|
||||
double tolerance,
|
||||
std::function<MeshCore::AbstractSurfaceFit*(const std::vector<Base::Vector3f>&,
|
||||
const std::vector<Base::Vector3f>&)> fitFunc)
|
||||
std::function<MeshCore::AbstractSurfaceFit*(
|
||||
const std::vector<Base::Vector3f>&,
|
||||
const std::vector<Base::Vector3f>&
|
||||
)> fitFunc
|
||||
)
|
||||
{
|
||||
Gui::Document* gdoc = Gui::Application::Instance->activeDocument();
|
||||
if (!gdoc) {
|
||||
@@ -164,8 +145,9 @@ public:
|
||||
App::Document* adoc = gdoc->getDocument();
|
||||
std::vector<Mesh::Feature*> meshes = adoc->getObjectsOfType<Mesh::Feature>();
|
||||
for (auto it : meshes) {
|
||||
MeshGui::ViewProviderMesh* vpm =
|
||||
static_cast<MeshGui::ViewProviderMesh*>(gdoc->getViewProvider(it));
|
||||
MeshGui::ViewProviderMesh* vpm = static_cast<MeshGui::ViewProviderMesh*>(
|
||||
gdoc->getViewProvider(it)
|
||||
);
|
||||
const Mesh::MeshObject& mesh = it->Mesh.getValue();
|
||||
|
||||
if (mesh.hasSelectedFacets()) {
|
||||
@@ -192,7 +174,9 @@ public:
|
||||
surfFit,
|
||||
kernel,
|
||||
minFaces,
|
||||
tolerance));
|
||||
tolerance
|
||||
)
|
||||
);
|
||||
finder.FindSegments(segm);
|
||||
|
||||
for (const auto& segmIt : segm) {
|
||||
|
||||
@@ -25,25 +25,25 @@
|
||||
#include <FCGlobal.h>
|
||||
|
||||
#ifndef REEN_GLOBAL_H
|
||||
#define REEN_GLOBAL_H
|
||||
# define REEN_GLOBAL_H
|
||||
|
||||
|
||||
// Reen
|
||||
#ifndef ReenExport
|
||||
#ifdef ReverseEngineering_EXPORTS
|
||||
#define ReenExport FREECAD_DECL_EXPORT
|
||||
#else
|
||||
#define ReenExport FREECAD_DECL_IMPORT
|
||||
#endif
|
||||
#endif
|
||||
# ifndef ReenExport
|
||||
# ifdef ReverseEngineering_EXPORTS
|
||||
# define ReenExport FREECAD_DECL_EXPORT
|
||||
# else
|
||||
# define ReenExport FREECAD_DECL_IMPORT
|
||||
# endif
|
||||
# endif
|
||||
|
||||
// ReenGui
|
||||
#ifndef ReenGuiExport
|
||||
#ifdef ReverseEngineeringGui_EXPORTS
|
||||
#define ReenGuiExport FREECAD_DECL_EXPORT
|
||||
#else
|
||||
#define ReenGuiExport FREECAD_DECL_IMPORT
|
||||
#endif
|
||||
#endif
|
||||
# ifndef ReenGuiExport
|
||||
# ifdef ReverseEngineeringGui_EXPORTS
|
||||
# define ReenGuiExport FREECAD_DECL_EXPORT
|
||||
# else
|
||||
# define ReenGuiExport FREECAD_DECL_IMPORT
|
||||
# endif
|
||||
# endif
|
||||
|
||||
#endif // REEN_GLOBAL_H
|
||||
|
||||
Reference in New Issue
Block a user