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.
double VectorNorm (unsigned int s, double *v)
 Norm of a vector.
void VectorNormalize (unsigned int s, double *v)
 Normalizes a vector.

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:
t2 The threshold (a square distance!).
s Number of elements in the vectors.
tp The topology for each dimension.
v1 The first point.
v2 The 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 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:
s Size of the vector.
v The 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:
s Size of the vector.
v The 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: