Main Page | Namespace List | Class List | Directories | File List | Class Members | File Members

polyMatchClass.h

Go to the documentation of this file.
00001 #ifndef __polyMatchClass_H
00002 #define __polyMatchClass_H
00003 
00004 
00005 /*
00006  * Largest polygon to be handled.
00007  */
00008 #define MAX_PTS 4
00009 
00010 
00011 /* Typedefs */
00012 
00013 //typedef double COORD;       /* Cartesian coordinate */
00014 
00015 typedef struct leg {        /* single leg of a turning rep polygon */
00016     double theta;           /* heading of the leg */
00017     double len;             /* length in original coordinates */
00018     double s;               /* cumulative arc length in [0,1] of start */
00019 } LEG;
00020 
00021 typedef struct turnrep {    /* polygon in turning rep */
00022     int n;
00023     double total_len;
00024     LEG leg[MAX_PTS];
00025 } TURN_REP_REC, *TURN_REP;
00026 
00027 typedef struct event {      /* critical event */
00028     double t;               /* "f shift" parameter of the event */
00029     int fi, gi;             /* pointers into turn reps f and g */
00030 }   EVENT_REC, *EVENT,
00031     HEAP[MAX_PTS+1];
00032 
00033 /*
00034  * These are to make a turning rep look infinite.
00035  * Given the rep and the "index" of a discontinuity,
00036  * 0,1,..., these return s and theta adjusted by
00037  * the correct number of turns around the polygon.
00038  */
00039 /*#define tr_n(tr)        tr->n */
00040 #define tr_n(tr)        4
00041 #define tr_i(tr, i)     ((i) % tr->n)
00042 #define tr_len(tr, i)   tr->leg[tr_i(tr, (i))].len
00043 #define tr_s(tr,i)      (tr->leg[(i) % tr->n].s + (i)/ tr->n)
00044 #define tr_theta(tr,i)  (tr->leg[(i) % tr->n].theta + (i)/tr->n*2*M_PI)
00045 #define sqr(x)          ((x) * (x))
00046 #define tr_smt(tr,i, t) ((tr->leg[(i) % tr->n].s -(t)) + (i)/tr->n)
00047 #define pmin(x,y)       (x < y ? x : y)
00048 
00049 
00050 class polyMatchClass 
00051 {
00052 
00053 public:
00054 
00055         polyMatchClass();
00056         double matchPoly(TURN_REP f, TURN_REP g, int cnt=4); 
00057         double getScore() const{return(_score);}
00058         void poly_to_turn_rep(pointLocation *vertices,  int polySideCount,TURN_REP t);
00059 
00060 private:
00061 
00062         double  tr_s_old(TURN_REP tr, int i); 
00063         double  tr_smt_old(TURN_REP tr, int i, double t); 
00064         double  tr_theta_old(TURN_REP tr, int i); 
00065         double  sqr_old(double x); 
00066         int             pmin_old(int x, int y); 
00067         int             ilog2(int x);
00068         double  turn(double a, double base);
00069         void    rotate_turn_rep(TURN_REP t, int to, TURN_REP r);
00070         void    init_vals(TURN_REP f, TURN_REP g,
00071                                                 double *ht0_rtn, double *slope_rtn, double *a_rtn);
00072         void    reinit_vals(TURN_REP f, TURN_REP g, 
00073                                                 int fi, int gi, double *ht0_rtn, double *slope_rtn);
00074         int             reinit_interval(TURN_REP f, TURN_REP g);
00075         void    add_event(TURN_REP f, TURN_REP g, int fi, int gi);
00076         EVENT_REC next_event(void);
00077         void    init_events(TURN_REP f, TURN_REP g);
00078         double  h_t0min(TURN_REP f, TURN_REP g,
00079                                         double hc0, double slope, double alpha, int d_update,
00080                                         double *theta_star_rtn, EVENT e_rtn,
00081                                         double *hc0_err_rtn, double *slope_err_rtn);
00082 
00083 private:
00084         double _score;
00085 
00086 };
00087 
00088 #endif
00089 

Generated on Tue Aug 29 11:42:40 2006 for PageLayoutDOCLIB by  doxygen 1.4.2