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

Linux Cross Reference
Tina6/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 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 General Public License for more details.
 14  *
 15  * You should have received a copy of the GNU 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  * ANY users of TINA who require exemption from the existing licence must
 20  * negotiate a new licence with Dr. Neil.A.Thacker, the sole agent for
 21  * the University of Manchester.
 22  *
 23  **********
 24  * 
 25  * Program :    TINA
 26  * File    :  $Source: /home/tina/cvs/tina-libs/tina/geometry/geomCurve_con_stat.c,v $
 27  * Date    :  $Date: 2005/01/09 17:49:25 $
 28  * Version :  $Revision: 1.2 $
 29  * CVS Id  :  $Id: geomCurve_con_stat.c,v 1.2 2005/01/09 17:49:25 paul Exp $
 30  *
 31  * Author  : Legacy TINA
 32  *
 33  * Notes :
 34  *
 35  *********
 36 */
 37 
 38 #include "geomCurve_con_stat.h"
 39 
 40 #if HAVE_CONFIG_H
 41   #include <config.h>
 42 #endif
 43 
 44 #include <math.h>
 45 #include <string.h>
 46 #include <tina/sys/sysDef.h>
 47 #include <tina/sys/sysPro.h>
 48 #include <tina/math/mathDef.h>
 49 #include <tina/math/mathPro.h>
 50 #include <tina/geometry/geom_CurveDef.h>
 51 #include <tina/geometry/geomCurve_conic.h>
 52 #include <tina/geometry/geomCurve_conicprox.h>
 53 #include <tina/geometry/geomCurve_con_fltr.h>
 54 #ifdef _PCC
 55 #include <memory.h>
 56 #endif
 57 
 58 Conic_stat *conic_stat_alloc(void)
 59 {
 60     Conic_stat *stats = ts_ralloc(Conic_stat);
 61 
 62     return (stats);
 63 }
 64 
 65 Conic_stat *conic_stat_copy(Conic_stat * stats)
 66 {
 67     Conic_stat *new = ts_ralloc(Conic_stat);
 68 
 69     (void) memcpy((char *) new, (char *) stats, sizeof(Conic_stat));
 70     return (new);
 71 }
 72 
 73 void    conic_stat_free(Conic_stat * stats)
 74 {
 75     rfree((void *) stats);
 76 }
 77 
 78 /**
 79 initialise covariance to complete uncertainty
 80 **/
 81 void    conic_stat_init(Conic_stat * stats, double lscale, double big)
 82 {
 83     int     i, j;
 84 
 85     if (stats == NULL)
 86         return;
 87 
 88     for (i = 0; i < 5; i++)
 89     {
 90         stats->x[i] = 0.0;
 91         stats->u[i][i] = 1.0;
 92         for (j = 0; j < i; j++)
 93             stats->u[i][j] = stats->u[j][i] = 0.0;
 94     }
 95 
 96     stats->d[0] = big;
 97     stats->d[1] = big;
 98     stats->d[2] = lscale * big;
 99     stats->d[3] = lscale * big;
100     stats->d[4] = lscale * lscale * big;
101 }
102 
103 /**
104 make correction  x  to conic in place
105 **/
106 
107 void    conic_correct(Conic * conic, double *x)
108 {
109     if (conic == NULL)
110         return;
111 
112     conic->a += x[0];
113     conic->b += x[1];
114     conic->c = 1.0 - conic->a;  /**preserve normalisation**/
115     conic->d += x[2];
116     conic->e += x[3];
117     conic->f += x[4];
118 
119     x[0] = x[1] = x[2] = x[3] = x[4] = x[5] = 0.0;
120 }
121 
122 /**
123 make correction  x to conic in copy
124 **/
125 
126 Conic  *conic_correct_copy(Conic * conic, double *x)
127 {
128     conic = conic_copy(conic);
129     conic_correct(conic, x);
130     return (conic);
131 }
132 

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