~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~ [ freetext search ] ~ [ file search ] ~

Linux Cross Reference
Tina4/src/vision/conic/con_stat.c

Version: ~
Architecture: ~ [ i386 ] ~ [ alpha ] ~ [ m68k ] ~ [ mips ] ~ [ ppc ] ~ [ sparc ] ~ [ sparc64 ] ~

  1 /**@(#)
  2 **/
  3 #include <math.h>
  4 #include <tina/sys.h>
  5 #include <tina/sysfuncs.h>
  6 #include <tina/math.h>
  7 #include <tina/mathfuncs.h>
  8 #include <tina/vision.h>
  9 #include <tina/visionfuncs.h>
 10 #ifdef _PCC
 11 #include <memory.h>
 12 #endif
 13 
 14 Conic_stat *conic_stat_alloc(void)
 15 {
 16     Conic_stat *stats = ts_ralloc(Conic_stat);
 17 
 18     return (stats);
 19 }
 20 
 21 Conic_stat *conic_stat_copy(Conic_stat * stats)
 22 {
 23     Conic_stat *new = ts_ralloc(Conic_stat);
 24 
 25     (void) memcpy((char *) new, (char *) stats, sizeof(Conic_stat));
 26     return (new);
 27 }
 28 
 29 void    conic_stat_free(Conic_stat * stats)
 30 {
 31     rfree((void *) stats);
 32 }
 33 
 34 /**
 35 initialise covariance to complete uncertainty
 36 **/
 37 void    conic_stat_init(Conic_stat * stats, double lscale, double big)
 38 {
 39     int     i, j;
 40 
 41     if (stats == NULL)
 42         return;
 43 
 44     for (i = 0; i < 5; i++)
 45     {
 46         stats->x[i] = 0.0;
 47         stats->u[i][i] = 1.0;
 48         for (j = 0; j < i; j++)
 49             stats->u[i][j] = stats->u[j][i] = 0.0;
 50     }
 51 
 52     stats->d[0] = big;
 53     stats->d[1] = big;
 54     stats->d[2] = lscale * big;
 55     stats->d[3] = lscale * big;
 56     stats->d[4] = lscale * lscale * big;
 57 }
 58 
 59 /**
 60 make correction  x  to conic in place
 61 **/
 62 
 63 void    conic_correct(Conic * conic, double *x)
 64 {
 65     if (conic == NULL)
 66         return;
 67 
 68     conic->a += x[0];
 69     conic->b += x[1];
 70     conic->c = 1.0 - conic->a;  /**preserve normalisation**/
 71     conic->d += x[2];
 72     conic->e += x[3];
 73     conic->f += x[4];
 74 
 75     x[0] = x[1] = x[2] = x[3] = x[4] = x[5] = 0.0;
 76 }
 77 
 78 /**
 79 make correction  x to conic in copy
 80 **/
 81 
 82 Conic  *conic_correct_copy(Conic * conic, double *x)
 83 {
 84     conic = conic_copy(conic);
 85     conic_correct(conic, x);
 86     return (conic);
 87 }
 88 

~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~ [ freetext search ] ~ [ file search ] ~

This page was automatically generated by the LXR engine.
Visit the LXR main site for more information.