Functions | Variables

ANN.cpp File Reference

#include <ANN/ANNx.h>
#include <ANN/ANNperf.h>
#include <cstdlib>

Go to the source code of this file.

Functions

ANNdist annDist (int dim, ANNpoint p, ANNpoint q)
void annPrintPt (ANNpoint pt, int dim, std::ostream &out)
ANNpoint annAllocPt (int dim, ANNcoord c)
ANNpointArray annAllocPts (int n, int dim)
void annDeallocPt (ANNpoint &p)
void annDeallocPts (ANNpointArray &pa)
ANNpoint annCopyPt (int dim, ANNpoint source)
void annAssignRect (int dim, ANNorthRect &dest, const ANNorthRect &source)
void annError (const char *msg, ANNerr level)
void annMaxPtsVisit (int maxPts)

Variables

int ANNmaxPtsVisited = 0
int ANNptsVisited

Function Documentation

ANNpoint annAllocPt ( int  dim,
ANNcoord  c 
)

Definition at line 108 of file ANN.cpp.

Referenced by ANNorthRect::ANNorthRect(), annReadDump(), mitk::PointLocator::InitANN(), and ipMITKSegmentationGetCutPoints().

{
        ANNpoint p = new ANNcoord[dim];
        for (int i = 0; i < dim; i++) p[i] = c;
        return p;
}
ANNpointArray annAllocPts ( int  n,
int  dim 
)

Definition at line 115 of file ANN.cpp.

Referenced by annReadDump(), ipMITKSegmentationGetCutPoints(), and mitk::PointLocator::SetPoints().

{
        ANNpointArray pa = new ANNpoint[n];                     // allocate points
        ANNpoint          p  = new ANNcoord[n*dim];             // allocate space for coords
        for (int i = 0; i < n; i++) {
                pa[i] = &(p[i*dim]);
        }
        return pa;
}
void annAssignRect ( int  dim,
ANNorthRect dest,
const ANNorthRect source 
)

Definition at line 146 of file ANN.cpp.

References ANNorthRect::hi, and ANNorthRect::lo.

Referenced by annBnds2Box(), and tryCentroidShrink().

{
        for (int i = 0; i < dim; i++) {
                dest.lo[i] = source.lo[i];
                dest.hi[i] = source.hi[i];
        }
}
ANNpoint annCopyPt ( int  dim,
ANNpoint  source 
)

Definition at line 138 of file ANN.cpp.

Referenced by ANNbd_tree::ANNbd_tree(), ANNkd_tree::ANNkd_tree(), and ANNorthRect::ANNorthRect().

{
        ANNpoint p = new ANNcoord[dim];
        for (int i = 0; i < dim; i++) p[i] = source[i];
        return p;
}
void annDeallocPt ( ANNpoint p )

Definition at line 125 of file ANN.cpp.

Referenced by mitk::PointLocator::DestroyANN(), ipMITKSegmentationGetCutPoints(), ANNkd_tree::~ANNkd_tree(), and ANNorthRect::~ANNorthRect().

{
        delete [] p;
        p = NULL;
}
void annDeallocPts ( ANNpointArray pa )

Definition at line 131 of file ANN.cpp.

Referenced by mitk::PointLocator::DestroyANN(), and ipMITKSegmentationGetCutPoints().

{
        delete [] pa[0];                                                        // dealloc coordinate storage
        delete [] pa;                                                           // dealloc points
        pa = NULL;
}
ANNdist annDist ( int  dim,
ANNpoint  p,
ANNpoint  q 
)

Definition at line 44 of file ANN.cpp.

References ANN_COORD, ANN_FLOP, ANN_POW, ANN_PTS, ANN_SUM, and QuadProgPP::dist().

Referenced by ANNbruteForce::annkFRSearch(), and ANNbruteForce::annkSearch().

{
        register int d;
        register ANNcoord diff;
        register ANNcoord dist;

        dist = 0;
        for (d = 0; d < dim; d++) {
                diff = p[d] - q[d];
                dist = ANN_SUM(dist, ANN_POW(diff));
        }
        ANN_FLOP(3*dim)                                 // performance counts
        ANN_PTS(1)
        ANN_COORD(dim)
        return dist;
}
void annError ( const char *  msg,
ANNerr  level 
)

Definition at line 167 of file ANN.cpp.

References ANNabort.

Referenced by ANNbd_tree::ANNbd_tree(), ANNkd_tree::ANNkd_tree(), ANNkd_tree::annkSearch(), ANNbruteForce::annkSearch(), annReadDump(), annReadTree(), ANNpr_queue::insert(), and selectDecomp().

{
        if (level == ANNabort) {
                cerr << "ANN: ERROR------->" << msg << "<-------------ERROR\n";
                exit(1);
        }
        else {
                cerr << "ANN: WARNING----->" << msg << "<-------------WARNING\n";
        }
}
void annMaxPtsVisit ( int  maxPts )

Definition at line 195 of file ANN.cpp.

References ANNmaxPtsVisited.

{
        ANNmaxPtsVisited = maxPts;
}
void annPrintPt ( ANNpoint  pt,
int  dim,
std::ostream &  out 
)

Definition at line 68 of file ANN.cpp.

{
        for (int j = 0; j < dim; j++) {
                out << pt[j];
                if (j < dim-1) out << " ";
        }
}

Variable Documentation

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Defines