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

Linux Cross Reference
Tina6/tina-libs/tina/vision/visModel_error.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/vision/visModel_error.c,v $
 27  * Date    :  $Date: 2003/10/06 12:29:48 $
 28  * Version :  $Revision: 1.3 $
 29  * CVS Id  :  $Id: visModel_error.c,v 1.3 2003/10/06 12:29:48 neil Exp $
 30  *
 31  * Author  : Legacy TINA
 32  *
 33  * Notes :
 34  * 
 35  * simple isotropic error model for geometric data
 36  * 
 37  *
 38  *********
 39 */
 40 
 41 #include "visModel_error.h"
 42 
 43 #if HAVE_CONFIG_H
 44   #include <config.h>
 45 #endif
 46 
 47 
 48 #include <math.h>
 49 #include <tina/sys/sysDef.h>
 50 #include <tina/sys/sysPro.h>
 51 #include <tina/math/mathDef.h>
 52 #include <tina/math/mathPro.h>
 53 #include <tina/geometry/geomDef.h>
 54 #include <tina/geometry/geomPro.h>
 55 #include <tina/vision/vis_ModelDef.h>
 56 #include <tina/vision/vis_ModelPro.h>
 57 
 58 static float pos_error = (float) 2.0;   /* position error in mm */
 59 static float rot_error = (float) 0.05;  /* rotation error in radians */
 60 
 61 void    iso_set_defaults(double p, double r)
 62 {
 63     pos_error = (float) p;
 64     rot_error = (float) r;
 65 }
 66 
 67 Iso_error *iso_alloc(void)
 68 {
 69     Iso_error *iso = ts_ralloc(Iso_error);
 70 
 71     iso->dot = (float) 1.0;
 72     iso->pos = iso->rot = (float) 0.0;
 73     return (iso);
 74 }
 75 
 76 void    geom_add_iso_prop(void *geom, int type)
 77 {
 78     Iso_error *lerror;
 79 
 80     if (geom == NULL)
 81         return;
 82 
 83     lerror = iso_alloc();
 84     geom_prop_add(geom, type, (void *) lerror, ISO_ERROR, rfree);
 85 }
 86 
 87 void    geom_addifnp_iso_prop(void *geom, int type)
 88 {
 89     Iso_error *lerror;
 90 
 91     if (geom == NULL)
 92         return;
 93 
 94     lerror = iso_alloc();
 95     geom_prop_addifnp(geom, type, (void *) lerror, ISO_ERROR, rfree, true);
 96 }
 97 
 98 void    geom_set_iso_default_error(void *geom, int type)
 99 {
100     Iso_error *lerror;
101 
102     if (geom == NULL)
103         return;
104 
105     lerror = (Iso_error *) geom_prop_get(geom, type, ISO_ERROR);
106     if (lerror == NULL)
107     {
108         lerror = iso_alloc();
109         geom_prop_add(geom, type, (void *) lerror, ISO_ERROR, rfree);
110     }
111     lerror->pos = pos_error;
112     lerror->rot = (type == CONIC3) ? 3 * rot_error : rot_error;
113     lerror->dot = (float) cos(lerror->rot);
114 }
115 
116 void    geom_set_iso_zero_error(void *geom, int type)
117 {
118     Iso_error *lerror;
119 
120     if (geom == NULL)
121         return;
122 
123     lerror = (Iso_error *) geom_prop_get(geom, type, ISO_ERROR);
124     if (lerror == NULL)
125     {
126         lerror = iso_alloc();
127         geom_prop_add(geom, type, (void *) lerror, ISO_ERROR, rfree);
128     }
129     lerror->pos = (float) 0.0;
130     lerror->rot = (float) 0.0;
131     lerror->dot = (float) 1.0;
132 }
133 

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