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

Linux Cross Reference
Tina4/src/tools/smartROI/sroi_view.c

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

  1 /*
  2  * sroi_view.c
  3  *
  4  * support functions for drawing model output
  5  * onto currrent tv
  6  *
  7  */
  8 
  9 #include <stdio.h>
 10 #include <string.h>
 11 #include <tina/sys.h>
 12 #include <tina/sysfuncs.h>
 13 #include <tina/math.h>
 14 #include <tina/mathfuncs.h>
 15 #include <tina/vision.h>
 16 #include <tina/visionfuncs.h>
 17 #include <tina/tv.h>
 18 #include <tina/tvfuncs.h>
 19 #include <tina/draw.h>
 20 #include <tina/drawfuncs.h>
 21 #include <tina/infrtoolfuncs.h>
 22 #include <tina/toolsfuncs.h>
 23 #include <tina/sroi_tool.h>
 24 
 25 Imrect *tv_get_imrect(Tv *tv)
 26 {
 27   if (tv == NULL)
 28     return(NULL);
 29 
 30   if (!strcmp(tv->label, "mono"))
 31     return(mono_image_get());
 32   if (!strcmp(tv->label, "right"))
 33     return(right_image_get());
 34   if (!strcmp(tv->label, "left"))
 35     return(left_image_get());
 36   if (!strcmp(tv->label, "sequence"))
 37     return((Imrect *)seq_image_get());
 38  
 39   return(NULL);
 40 }
 41 
 42 
 43 void draw_sample_outer(Tv *tv)
 44 {
 45   Model  *model;
 46   Vec2    v;
 47   double *a, **el, x, y;
 48   int     i, j;
 49 
 50   if ((tv == NULL) || ((model = get_model()) == NULL))
 51     return;
 52 
 53   el = model->m->el.double_v;
 54   a = (double *) model->alpha->data;
 55 
 56 /*
 57  * mark centre and endpoints in blue
 58  */
 59 
 60   tv_set_color(tv, blue);
 61   v = vec2(model->tx, model->ty);
 62   tv_cross(tv, tv_proj2(tv, v), 4);
 63 
 64   for (i = 0; i < model->o; i++)
 65   {
 66     if (i == 0)
 67       tv_set_color(tv, blue);
 68     else if (!(model->o%2) && (i == (model->o/2+1)))
 69       tv_set_color(tv, blue);
 70     else if ((model->o%2) && (i == model->o/2))
 71       tv_set_color(tv, blue);
 72     else
 73       tv_set_color(tv, red);
 74       
 75     v = vec2(el[0][i], el[1][i]);
 76     tv_cross(tv, tv_proj2(tv, v), 4);
 77 
 78     tv_set_color(tv, green);
 79     for (j = 1; j < model->vsize; j++)
 80     {
 81       x = cos(a[i]) * (double) j;
 82       y = sin(a[i]) * (double) j;
 83       tv_point2(tv, vec2(el[0][i] + x, el[1][i] + y));
 84       tv_point2(tv, vec2(el[0][i] - x, el[1][i] - y));
 85     }
 86   }
 87 
 88   tv_flush(tv);
 89 }
 90 
 91 
 92 void  draw_sample_inner(Tv *tv)
 93 {
 94   Model  *model;
 95   Vec2    v;
 96   double *a, **el, x, y;
 97   int     i, j;
 98 
 99   if ((tv == NULL) || ((model = get_model()) == NULL))
100     return;
101   
102   el = model->m->el.double_v;
103   a = (double *) model->alpha->data;
104   
105   for (i = model->o; i < model->c; i++)
106   {
107     tv_set_color(tv, yellow);
108       
109     v = vec2(el[0][i], el[1][i]);
110     tv_cross(tv, tv_proj2(tv, v), 4);
111 
112     tv_set_color(tv, green);
113     for (j = 1; j < model->vsize; j++)
114     {
115       x = cos(a[i]) * (double) j;
116       y = sin(a[i]) * (double) j;
117       tv_point2(tv, vec2(el[0][i] + x, el[1][i] + y));
118       tv_point2(tv, vec2(el[0][i] - x, el[1][i] - y));
119     }
120   }
121 
122   tv_flush(tv);
123 }
124 
125 
126 void  draw_parall_markup(Tv *tv)
127 {
128 }
129 
130 

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