1 #include "ExtractControlPoints2D.h"
4 ExtractControlPoints2D::ExtractControlPoints2D()
10 ExtractControlPoints2D::~ExtractControlPoints2D()
13 //-----------------------------------------------------------------------------------------
14 void ExtractControlPoints2D::ResetControlPoints()
18 //-----------------------------------------------------------------------------------------
19 void ExtractControlPoints2D::SetContour(std::vector<double>*InX, std::vector<double>*InY,std::vector<double>*InZ)
24 int sizeX = InX->size();
25 int sizeY = InY->size();
26 int sizeZ = InZ->size();
27 if( (sizeX == sizeY) && (sizeY==sizeZ) )
29 for(int i=0; i<sizeX; i++)
31 _InX.push_back( (*InX)[i] );
32 _InY.push_back( (*InY)[i] );
33 _InZ.push_back( (*InZ)[i] );
38 printf("\n The lists Of vectors have diferents sizes");
41 //-----------------------------------------------------------------------------------------
42 //AUTOMATIC METHOD (INITIAL AND ADDING)
43 void ExtractControlPoints2D::GetInitialControlPoints(std::vector<double>*pOutX, std::vector<double>*pOutY, std::vector<double>*pOutZ)
45 AutoControlPoints *autoc = new AutoControlPoints();
52 autoc->SetNumSplineInterpolation((int)_numinterspline);
53 autoc->CalculeInitialControlPoints(&_InX,&_InY,&_InZ);
54 autoc->GetInitialControlPoints(pOutX,pOutY,pOutZ);
58 //-----------------------------------------------------------------------------------------
59 //AUTOMATIC METHOD (INITIAL, ADDING AND SAMPLING)
60 void ExtractControlPoints2D::GetControlPoints(std::vector<double>*pOutX, std::vector<double>*pOutY, std::vector<double>*pOutZ)
62 AutoControlPoints *autoc = new AutoControlPoints();
69 autoc->SetNumSplineInterpolation((int)_numinterspline);
70 autoc->CalculeControlPoints(&_InX,&_InY,&_InZ);
71 autoc->GetControlPoints(pOutX,pOutY,pOutZ);
75 //-----------------------------------------------------------------------------------------
76 //SET THE SAMPLING (PERCENT) FOR THE REGULAR SAMPLING METHOD
77 void ExtractControlPoints2D::SetSamplingControlPoints(double val)
81 _numsampling = _InX.size()* (val/100);
84 //-----------------------------------------------------------------------------------------
85 //REGULAR SAMPLING METHOD
86 void ExtractControlPoints2D::GetSamplingControlPoints(std::vector<double>*pOutX, std::vector<double>*pOutY, std::vector<double>*pOutZ)
95 int points = (int)(_InX.size()/_numsampling);
96 for (int i=0; i<(int)(_InX.size()); i++, h++)
100 pOutX->push_back( _InX[i] );
101 pOutY->push_back( _InY[i] );
102 pOutZ->push_back( _InZ[i] );
108 //-----------------------------------------------------------------------------------------
109 void ExtractControlPoints2D::SetNumberOfSplineInterpolation(double val)
111 _numinterspline = val;
113 //------------------------------------------------------------------------------