The Cuik KD-Tree Library


rectangle.h

Go to the documentation of this file.
00001 #ifndef RECTANGLEH
00002 #define RECTANGLEH
00003 
00004 #include "definitions.h"
00005 
00006 #include <stdio.h>
00007 
00008 
00026 typedef struct {
00027   unsigned int n; 
00028   double *l;      
00029   double *u;      
00030 } Trectangle;
00031 
00042 void InitRectangle(unsigned int dim,double *l,double *u,Trectangle *b);
00043 
00053 void InitRectangleFromPoint(unsigned int dim,double *p,Trectangle *b);
00054 
00064 unsigned int GetRectangleDim(Trectangle *b);
00065 
00076 void ExpandRectangle(double *p,Trectangle *b);
00077 
00091 double EnlargeRectangleWithLimits(double r,Trectangle *limits,
00092                                   Trectangle *bIn,Trectangle *bOut);
00093 
00103 void CopyRectangle(Trectangle *b_out,Trectangle *b_in);
00104 
00115 inline double GetRectangleLowerLimit(unsigned int i,Trectangle *b);
00116 
00127 inline double GetRectangleUpperLimit(unsigned int i,Trectangle *b);
00128 
00139 inline void GetRectangleLimits(unsigned int i,double *l,double *u,Trectangle *b);
00140 
00150 inline void SetRectangleLowerLimit(unsigned int i,double l,Trectangle *b);
00151 
00161 inline void SetRectangleUpperLimit(unsigned int i,double u,Trectangle *b);
00162 
00173 inline void SetRectangleLimits(unsigned int i,double l,double u,Trectangle *b);
00174 
00184 void RandomPointInRectangle(double *c,Trectangle *b);
00185 
00199 double SquaredDistanceToRectangleDimension(unsigned int dim,double p,unsigned int *tp,Trectangle *b);
00200 
00217 double SquaredDistanceToRectangle(double t2,double *p,unsigned int *tp,Trectangle *b);
00218 
00231 unsigned int GetRectangleSplitDim(Trectangle *b);
00232 
00241 void DeleteRectangle(Trectangle *b);
00242 
00243 #endif