The Cuik KD-Tree Library


vector.c File Reference

Implementation of the basic operations between points. More...

#include "vector.h"
#include "definitions.h"
#include <assert.h>
+ Include dependency graph for vector.c:

Go to the source code of this file.

Functions

double VectorSquaredDistanceTopologyMin (double t2, unsigned int s, unsigned int *tp, double *v1, double *v2)
 Computes the squared distance of two points. More...
 
double VectorNorm (unsigned int s, double *v)
 Norm of a vector. More...
 
void VectorNormalize (unsigned int s, double *v)
 Normalizes a vector. More...
 

Detailed Description

Implementation of the basic operations between points.

See Also
point.h.

Definition in file vector.c.

Function Documentation

double VectorSquaredDistanceTopologyMin ( double  t2,
unsigned int  s,
unsigned int *  tp,
double *  v1,
double *  v2 
)

Computes the squared distance between two points given as a vector with a given size and considering the topology for each dimension.

The squared distance is only fully computed for points closer than a given threshold. This accelerates the distance computations.

Parameters
t2The threshold (a square distance!).
sNumber of elements in the vectors.
tpThe topology for each dimension.
v1The first point.
v2The second point.
Returns
The squared distance between the points.

Definition at line 17 of file vector.c.

References M_PI, PI2PI, and TOPOLOGY_S.

Referenced by AddPoint2KDtree(), main(), SearchInBallKDtree(), and SearchKDtree().

+ Here is the caller graph for this function:

double VectorNorm ( unsigned int  s,
double *  v 
)

Computes the norm of a vector.

Parameters
sSize of the vector.
vThe vector.
Returns
The norm of the vector.

Definition at line 45 of file vector.c.

Referenced by VectorNormalize().

+ Here is the caller graph for this function:

void VectorNormalize ( unsigned int  s,
double *  v 
)

Defines a vector with norm 1.

Parameters
sSize of the vector.
vThe vector.

Definition at line 58 of file vector.c.

References VectorNorm().

Referenced by main().

+ Here is the call graph for this function:

+ Here is the caller graph for this function: