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

Linux Cross Reference
TINA5/tina-libs/tina/geometry/geomCurve_con_stat.c

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

  1 /**********
  2  * 
  3  * This file is part of the TINA Open Source Image Analysis Environment
  4  * henceforth known as TINA
  5  *
  6  * TINA is free software; you can redistribute it and/or modify
  7  * it under the terms of the GNU Lesser General Public License as 
  8  * published by the Free Software Foundation.
  9  *
 10  * TINA is distributed in the hope that it will be useful,
 11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
 12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 13  * GNU Lesser General Public License for more details.
 14  *
 15  * You should have received a copy of the GNU Lesser General Public License
 16  * along with TINA; if not, write to the Free Software Foundation, Inc., 
 17  * 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 18  *
 19  **********
 20  * 
 21  * Program :    TINA
 22  * File    :  $Source: /home/tina/cvs/tina-libs/tina/geometry/geomCurve_con_stat.c,v $
 23  * Date    :  $Date: 2005/01/09 17:49:25 $
 24  * Version :  $Revision: 1.2 $
 25  * CVS Id  :  $Id: geomCurve_con_stat.c,v 1.2 2005/01/09 17:49:25 paul Exp $
 26  *
 27  * Author  : Legacy TINA
 28  *
 29  * Notes :
 30  *
 31  *********
 32 */
 33 
 34 #include "geomCurve_con_stat.h"
 35 
 36 #if HAVE_CONFIG_H
 37   #include <config.h>
 38 #endif
 39 
 40 #include <math.h>
 41 #include <string.h>
 42 #include <tina/sys/sysDef.h>
 43 #include <tina/sys/sysPro.h>
 44 #include <tina/math/mathDef.h>
 45 #include <tina/math/mathPro.h>
 46 #include <tina/geometry/geom_CurveDef.h>
 47 #include <tina/geometry/geomCurve_conic.h>
 48 #include <tina/geometry/geomCurve_conicprox.h>
 49 #include <tina/geometry/geomCurve_con_fltr.h>
 50 #ifdef _PCC
 51 #include <memory.h>
 52 #endif
 53 
 54 Conic_stat *conic_stat_alloc(void)
 55 {
 56     Conic_stat *stats = ts_ralloc(Conic_stat);
 57 
 58     return (stats);
 59 }
 60 
 61 Conic_stat *conic_stat_copy(Conic_stat * stats)
 62 {
 63     Conic_stat *new = ts_ralloc(Conic_stat);
 64 
 65     (void) memcpy((char *) new, (char *) stats, sizeof(Conic_stat));
 66     return (new);
 67 }
 68 
 69 void    conic_stat_free(Conic_stat * stats)
 70 {
 71     rfree((void *) stats);
 72 }
 73 
 74 /**
 75 initialise covariance to complete uncertainty
 76 **/
 77 void    conic_stat_init(Conic_stat * stats, double lscale, double big)
 78 {
 79     int     i, j;
 80 
 81     if (stats == NULL)
 82         return;
 83 
 84     for (i = 0; i < 5; i++)
 85     {
 86         stats->x[i] = 0.0;
 87         stats->u[i][i] = 1.0;
 88         for (j = 0; j < i; j++)
 89             stats->u[i][j] = stats->u[j][i] = 0.0;
 90     }
 91 
 92     stats->d[0] = big;
 93     stats->d[1] = big;
 94     stats->d[2] = lscale * big;
 95     stats->d[3] = lscale * big;
 96     stats->d[4] = lscale * lscale * big;
 97 }
 98 
 99 /**
100 make correction  x  to conic in place
101 **/
102 
103 void    conic_correct(Conic * conic, double *x)
104 {
105     if (conic == NULL)
106         return;
107 
108     conic->a += x[0];
109     conic->b += x[1];
110     conic->c = 1.0 - conic->a;  /**preserve normalisation**/
111     conic->d += x[2];
112     conic->e += x[3];
113     conic->f += x[4];
114 
115     x[0] = x[1] = x[2] = x[3] = x[4] = x[5] = 0.0;
116 }
117 
118 /**
119 make correction  x to conic in copy
120 **/
121 
122 Conic  *conic_correct_copy(Conic * conic, double *x)
123 {
124     conic = conic_copy(conic);
125     conic_correct(conic, x);
126     return (conic);
127 }
128 

~ [ 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.