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

Linux Cross Reference
Tina4/src/vision/matcher/iso_error.c

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

  1 /**@(#)
  2 **/
  3 /* iso_error.c
  4  * 
  5  * simple isotropic error model for geometric data
  6  * 
  7  */
  8 
  9 #include <math.h>
 10 #include <tina/sys.h>
 11 #include <tina/sysfuncs.h>
 12 #include <tina/math.h>
 13 #include <tina/mathfuncs.h>
 14 #include <tina/vision.h>
 15 #include <tina/visionfuncs.h>
 16 
 17 static float pos_error = (float) 2.0;   /* position error in mm */
 18 static float rot_error = (float) 0.05;  /* rotation error in radians */
 19 
 20 void    iso_set_defaults(double p, double r)
 21 {
 22     pos_error = (float) p;
 23     rot_error = (float) r;
 24 }
 25 
 26 Iso_error *iso_alloc(void)
 27 {
 28     Iso_error *iso = ts_ralloc(Iso_error);
 29 
 30     iso->dot = (float) 1.0;
 31     iso->pos = iso->rot = (float) 0.0;
 32     return (iso);
 33 }
 34 
 35 void    geom_add_iso_prop(void *geom, int type)
 36 {
 37     Iso_error *lerror;
 38 
 39     if (geom == NULL)
 40         return;
 41 
 42     lerror = iso_alloc();
 43     geom_prop_add(geom, type, (void *) lerror, ISO_ERROR, rfree);
 44 }
 45 
 46 void    geom_addifnp_iso_prop(void *geom, int type)
 47 {
 48     Iso_error *lerror;
 49 
 50     if (geom == NULL)
 51         return;
 52 
 53     lerror = iso_alloc();
 54     geom_prop_addifnp(geom, type, (void *) lerror, ISO_ERROR, rfree, true);
 55 }
 56 
 57 void    geom_set_iso_default_error(void *geom, int type)
 58 {
 59     Iso_error *lerror;
 60 
 61     if (geom == NULL)
 62         return;
 63 
 64     lerror = (Iso_error *) geom_prop_get(geom, type, ISO_ERROR);
 65     if (lerror == NULL)
 66     {
 67         lerror = iso_alloc();
 68         geom_prop_add(geom, type, (void *) lerror, ISO_ERROR, rfree);
 69     }
 70     lerror->pos = pos_error;
 71     lerror->rot = (type == CONIC3) ? 3 * rot_error : rot_error;
 72     lerror->dot = (float) cos(lerror->rot);
 73 }
 74 
 75 void    geom_set_iso_zero_error(void *geom, int type)
 76 {
 77     Iso_error *lerror;
 78 
 79     if (geom == NULL)
 80         return;
 81 
 82     lerror = (Iso_error *) geom_prop_get(geom, type, ISO_ERROR);
 83     if (lerror == NULL)
 84     {
 85         lerror = iso_alloc();
 86         geom_prop_add(geom, type, (void *) lerror, ISO_ERROR, rfree);
 87     }
 88     lerror->pos = (float) 0.0;
 89     lerror->rot = (float) 0.0;
 90     lerror->dot = (float) 1.0;
 91 }
 92 

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