ExtractControlPoints2D.cxx
Go to the documentation of this file.00001 #include "ExtractControlPoints2D.h"
00002
00003
00004 ExtractControlPoints2D::ExtractControlPoints2D()
00005 {
00006 _numinterspline = 100;
00007 _numsampling = 25;
00008 }
00009
00010 ExtractControlPoints2D::~ExtractControlPoints2D()
00011 {
00012 }
00013
00014 void ExtractControlPoints2D::ResetControlPoints()
00015 {
00016
00017 }
00018
00019 void ExtractControlPoints2D::SetContour(std::vector<double>*InX, std::vector<double>*InY,std::vector<double>*InZ)
00020 {
00021 _InX.clear();
00022 _InY.clear();
00023 _InZ.clear();
00024 int sizeX = InX->size();
00025 int sizeY = InY->size();
00026 int sizeZ = InZ->size();
00027 if( (sizeX == sizeY) && (sizeY==sizeZ) )
00028 {
00029 for(int i=0; i<sizeX; i++)
00030 {
00031 _InX.push_back( (*InX)[i] );
00032 _InY.push_back( (*InY)[i] );
00033 _InZ.push_back( (*InZ)[i] );
00034 }
00035 }
00036 else
00037 {
00038 printf("\n The lists Of vectors have diferents sizes");
00039 }
00040 }
00041
00042
00043 void ExtractControlPoints2D::GetInitialControlPoints(std::vector<double>*pOutX, std::vector<double>*pOutY, std::vector<double>*pOutZ)
00044 {
00045 AutoControlPoints *autoc = new AutoControlPoints();
00046 pOutX->clear();
00047 pOutY->clear();
00048 pOutZ->clear();
00049
00050 if(_InX.size() != 0)
00051 {
00052 autoc->SetNumSplineInterpolation((int)_numinterspline);
00053 autoc->CalculeInitialControlPoints(&_InX,&_InY,&_InZ);
00054 autoc->GetInitialControlPoints(pOutX,pOutY,pOutZ);
00055 }
00056 delete autoc;
00057 }
00058
00059
00060 void ExtractControlPoints2D::GetControlPoints(std::vector<double>*pOutX, std::vector<double>*pOutY, std::vector<double>*pOutZ)
00061 {
00062 AutoControlPoints *autoc = new AutoControlPoints();
00063 pOutX->clear();
00064 pOutY->clear();
00065 pOutZ->clear();
00066
00067 if(_InX.size() != 0)
00068 {
00069 autoc->SetNumSplineInterpolation((int)_numinterspline);
00070 autoc->CalculeControlPoints(&_InX,&_InY,&_InZ);
00071 autoc->GetControlPoints(pOutX,pOutY,pOutZ);
00072 }
00073 delete autoc;
00074 }
00075
00076
00077 void ExtractControlPoints2D::SetSamplingControlPoints(double val)
00078 {
00079 if(_InX.size() != 0)
00080 {
00081 _numsampling = _InX.size()* (val/100);
00082 }
00083 }
00084
00085
00086 void ExtractControlPoints2D::GetSamplingControlPoints(std::vector<double>*pOutX, std::vector<double>*pOutY, std::vector<double>*pOutZ)
00087 {
00088 pOutX->clear();
00089 pOutY->clear();
00090 pOutZ->clear();
00091 if(_InX.size() != 0)
00092 {
00093 int h = 1;
00094
00095 int points = (int)(_InX.size()/_numsampling);
00096 for (int i=0; i<(int)(_InX.size()); i++, h++)
00097 {
00098 if( h == points )
00099 {
00100 pOutX->push_back( _InX[i] );
00101 pOutY->push_back( _InY[i] );
00102 pOutZ->push_back( _InZ[i] );
00103 h = 0;
00104 }
00105 }
00106 }
00107 }
00108
00109 void ExtractControlPoints2D::SetNumberOfSplineInterpolation(double val)
00110 {
00111 _numinterspline = val;
00112 }
00113
00114
00115