vectorFunctions Class Reference

#include <vectorFunctions.h>

List of all members.

Public Member Functions

 vectorFunctions ()
 ~vectorFunctions ()
void copyVector (std::vector< double > *Vector1, std::vector< double > *Vector2)
void copyintVector (std::vector< int > *Vector1, std::vector< int > *Vector2)
void printVector (std::vector< double > *Vector1, std::vector< double > *Vector2)
double promVector (std::vector< double > *Vector1, bool OnNormal)
int maxVector (std::vector< double > *Vector1, double *val)
int minVector (std::vector< double > *Vector1, double *val)
int nearPoint (std::vector< double > *VectorX, std::vector< double > *VectorY, double px, double py)
int findPointInLst (std::vector< double > *vecX, std::vector< double > *vecY, std::vector< double > *vecZ, double x, double y, double z)


Detailed Description

Definition at line 6 of file vectorFunctions.h.


Constructor & Destructor Documentation

vectorFunctions::vectorFunctions (  ) 

Definition at line 5 of file vectorFunctions.cxx.

00006 {
00007 }

vectorFunctions::~vectorFunctions (  ) 

Definition at line 9 of file vectorFunctions.cxx.

00010 {
00011 }


Member Function Documentation

void vectorFunctions::copyVector ( std::vector< double > *  Vector1,
std::vector< double > *  Vector2 
)

Definition at line 15 of file vectorFunctions.cxx.

Referenced by AutoControlPoints::AddControlPoint(), AutoControlPoints::fixBetweenPoints(), AutoControlPoints::GetControlPoints(), AutoControlPoints::GetErrorBetweenContours(), AutoControlPoints::GetInitialControlPoints(), AutoControlPoints::GetInitialNewPoints(), AutoControlPoints::GetNewPoints(), AutoControlPoints::InterCircle(), AutoControlPoints::maxminLocal(), AutoControlPoints::MoveAndAverage(), AutoControlPoints::MoveControlPointInContour(), ContourPropagation::orderAppend(), and promVector().

00016 {
00017         int size = Vector1->size();
00018         Vector2->clear();
00019         int i;
00020         if(size != 0)
00021         {
00022                 for(i=0; i<size; i++)
00023                 {
00024                         Vector2->push_back( (*Vector1)[i] );
00025                 }
00026         }
00027 }

Here is the caller graph for this function:

void vectorFunctions::copyintVector ( std::vector< int > *  Vector1,
std::vector< int > *  Vector2 
)

Definition at line 30 of file vectorFunctions.cxx.

00031 {
00032         int size = Vector1->size();
00033         Vector2->clear();
00034         int i;
00035         if( size != 0)
00036         {
00037                 for(i=0; i<size; i++)
00038                 {
00039                         Vector2->push_back( (*Vector1)[i] );
00040                 }
00041         }
00042 }

void vectorFunctions::printVector ( std::vector< double > *  Vector1,
std::vector< double > *  Vector2 
)

Definition at line 45 of file vectorFunctions.cxx.

00046 {
00047         int i;
00048         if( Vector1->size() == Vector2->size() )
00049         {
00050                 for(i=0; i<Vector1->size(); i++)
00051                 {
00052                         printf("\n v1(%d) = %f, v2(%d) = %f",i,(*Vector1)[i],i,(*Vector2)[i]);
00053                 }
00054         }
00055 }

double vectorFunctions::promVector ( std::vector< double > *  Vector1,
bool  OnNormal 
)

Definition at line 58 of file vectorFunctions.cxx.

References copyVector(), and maxVector().

Referenced by AutoControlPoints::GetInitialNewPoints(), AutoControlPoints::GetNewPoints(), AutoControlPoints::MoveAndAverage(), and AutoControlPoints::MoveControlPointInContour().

00059 {
00060         int i;
00061         double suma = 0,prom;
00062         std::vector<double> tempv;
00063         int size = Vector1->size();
00064         if(size != 0)
00065         {
00066                 if(OnNormal == false)
00067                 {
00068                         for(i=0; i<size; i++)
00069                         {
00070                                 suma = suma + (*Vector1)[i];
00071                         }
00072                         return prom = suma/Vector1->size();
00073                 }
00074                 int pos;
00075                 double maxval;
00076                 copyVector(Vector1,&tempv);
00077                 if(OnNormal == true)
00078                 {
00079                         pos = maxVector(Vector1,&maxval);
00080                         for(i=0; i<size; i++)
00081                         {
00082                                 tempv.push_back((*Vector1)[i]/maxval);
00083                         }
00084                         suma = 0;
00085                         for(i=0; i<tempv.size(); i++)
00086                         {
00087                                 suma = suma + tempv[i];
00088                         }
00089                         return prom = suma/tempv.size();
00090                 }
00091         }
00092         return -1;
00093 }

Here is the call graph for this function:

Here is the caller graph for this function:

int vectorFunctions::maxVector ( std::vector< double > *  Vector1,
double *  val 
)

Definition at line 96 of file vectorFunctions.cxx.

Referenced by AutoControlPoints::GetInitialNewPoints(), ContourPropagation::getMaxMinZ(), AutoControlPoints::GetNewPoints(), and promVector().

00097 {
00098         int i, pos;
00099         double max = -1;
00100         if(Vector1->size() != 0)
00101         {
00102                 for(i=0; i<Vector1->size(); i++)
00103                 {
00104                         if( (*Vector1)[i]>max )
00105                         {
00106                                 max = (*Vector1)[i];
00107                                 pos = i;
00108                         }
00109                 }
00110                 *val = max;
00111                 return pos;
00112         }
00113         return -1;
00114 }

Here is the caller graph for this function:

int vectorFunctions::minVector ( std::vector< double > *  Vector1,
double *  val 
)

Definition at line 117 of file vectorFunctions.cxx.

References min.

Referenced by ContourPropagation::getMaxMinZ().

00118 {
00119         int i, pos;
00120         double min = 99999;
00121         if(Vector1->size() != 0)
00122         {
00123                 for(i=0; i<Vector1->size(); i++)
00124                 {
00125                         if( (*Vector1)[i]<min )
00126                         {
00127                                 min = (*Vector1)[i];
00128                                 pos = i;
00129                         }
00130                 }
00131                 *val = min;
00132                 return pos;
00133         }
00134         return -1;
00135 }

Here is the caller graph for this function:

int vectorFunctions::nearPoint ( std::vector< double > *  VectorX,
std::vector< double > *  VectorY,
double  px,
double  py 
)

Definition at line 138 of file vectorFunctions.cxx.

References min.

00139 {
00140         int i, pos = -1;
00141         double min = 10000, dist;
00142         if(VectorX->size() != 0)
00143         {
00144                 for(i=0; i<VectorX->size(); i++)
00145                 {
00146                         dist = sqrt(pow(px-(*VectorX)[i],2) + pow(py-(*VectorY)[i],2));
00147                         if(dist<min)
00148                         {
00149                                 min = dist;
00150                                 pos = i;
00151                         }
00152                 }
00153                 return pos;
00154         }
00155         return -1;
00156 }

int vectorFunctions::findPointInLst ( std::vector< double > *  vecX,
std::vector< double > *  vecY,
std::vector< double > *  vecZ,
double  x,
double  y,
double  z 
)

Definition at line 159 of file vectorFunctions.cxx.

00161 {
00162         int i,flag = -1;
00163         double apr = 1.5;
00164         if(vecX->size() != 0)
00165         {
00166                 for(i=0; i<vecX->size(); i++)
00167                 {
00168                         if( ((*vecX)[i]-apr <= x)&&(x <=(*vecX)[i]+apr)&&((*vecY)[i]-apr <= y)&&(y <=(*vecY)[i]+apr)&&((*vecZ)[i]-apr <= z)&&(z <=(*vecZ)[i]+apr) )
00169                         {
00170                                 flag = i;
00171                                 return i; 
00172                         }
00173                 }
00174                 return flag;
00175         }
00176         return -1;
00177 }


The documentation for this class was generated from the following files:
Generated on Wed Jul 29 16:36:09 2009 for creaMaracasVisu_lib by  doxygen 1.5.3