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

Linux Cross Reference
Tina4/src/vision/geom/geom_props.c

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

  1 /**@(#)
  2 **/
  3 #include <tina/sys.h>
  4 #include <tina/sysfuncs.h>
  5 #include <tina/math.h>
  6 #include <tina/mathfuncs.h>
  7 #include <tina/vision.h>
  8 #include <tina/visionfuncs.h>
  9 
 10 void   *geom_prop_get(void *p, int type, int prop)
 11 {
 12     switch (type)
 13     {
 14         case SCALAR:
 15         return (prop_get(((Scalar *) p)->props, prop));
 16     case POINT2:
 17         return (prop_get(((Point2 *) p)->props, prop));
 18     case LINE2:
 19         return (prop_get(((Line2 *) p)->props, prop));
 20     case CONIC2:
 21         return (prop_get(((Conic *) p)->props, prop));
 22     case POINT3:
 23         return (prop_get(((Point3 *) p)->props, prop));
 24     case LINE3:
 25         return (prop_get(((Line3 *) p)->props, prop));
 26     case CONIC3:
 27         {
 28             Conic3 *con3 = p;
 29 
 30             if (con3->conic == NULL)
 31                 return (NULL);
 32             return (prop_get(con3->conic->props, prop));
 33         }
 34     case PLANE:
 35         return (prop_get(((Plane *) p)->props, prop));
 36     case TRANSF3:
 37         return (prop_get(((Transf3 *) p)->props, prop));
 38     }
 39     return (NULL);
 40 }
 41 
 42 void   *geom_prop_update_get(void *p, int *type, int prop)
 43 {
 44     int     stype = *type;
 45 
 46     /* BUGFIX JB 22/11/93 was    *type - prop; */
 47     *type = prop;
 48     switch (stype)
 49     {
 50     case SCALAR:
 51         return (prop_get(((Scalar *) p)->props, prop));
 52     case POINT2:
 53         return (prop_get(((Point2 *) p)->props, prop));
 54     case LINE2:
 55         return (prop_get(((Line2 *) p)->props, prop));
 56     case CONIC2:
 57         return (prop_get(((Conic *) p)->props, prop));
 58     case POINT3:
 59         return (prop_get(((Point3 *) p)->props, prop));
 60     case LINE3:
 61         return (prop_get(((Line3 *) p)->props, prop));
 62     case CONIC3:
 63         {
 64             Conic3 *con3 = p;
 65 
 66             if (con3->conic == NULL)
 67                 return (NULL);
 68             return (prop_get(con3->conic->props, prop));
 69         }
 70     case PLANE:
 71         return (prop_get(((Plane *) p)->props, prop));
 72     case TRANSF3:
 73         return (prop_get(((Transf3 *) p)->props, prop));
 74     }
 75     return (NULL);
 76 }
 77 
 78 void    geom_prop_add(void *geom, int type, void *prop, int prop_type, void (*freefunc) ( /* ??? */ ))
 79 {
 80     switch (type)
 81     {
 82         case SCALAR:
 83         {
 84             Scalar *s = (Scalar *) geom;
 85 
 86             s->props = proplist_add(s->props, (void *) prop, prop_type, freefunc);
 87             break;
 88         }
 89     case POINT2:
 90         {
 91             Point2 *p = (Point2 *) geom;
 92 
 93             p->props = proplist_add(p->props, (void *) prop, prop_type, freefunc);
 94             break;
 95         }
 96     case LINE2:
 97         {
 98             Line2  *l = (Line2 *) geom;
 99 
100             l->props = proplist_add(l->props, (void *) prop, prop_type, freefunc);
101             break;
102         }
103     case CONIC2:
104         {
105             Conic  *c = (Conic *) geom;
106 
107             c->props = proplist_add(c->props, (void *) prop, prop_type, freefunc);
108             break;
109         }
110     case POINT3:
111         {
112             Point3 *p = (Point3 *) geom;
113 
114             p->props = proplist_add(p->props, (void *) prop, prop_type, freefunc);
115             break;
116         }
117     case LINE3:
118         {
119             Line3  *l = (Line3 *) geom;
120 
121             l->props = proplist_add(l->props, (void *) prop, prop_type, freefunc);
122             break;
123         }
124     case CONIC3:
125         {
126             Conic  *c;
127 
128             if (((Conic3 *) geom)->conic == NULL)
129                 break;
130             c = ((Conic3 *) geom)->conic;
131             c->props = proplist_add(c->props, (void *) prop, prop_type, freefunc);
132             break;
133         }
134     case PLANE:
135         {
136             Plane  *p = (Plane *) geom;
137 
138             p->props = proplist_add(p->props, (void *) prop, prop_type, freefunc);
139             break;
140         }
141     case TRANSF3:
142         {
143             Transf3 *t = (Transf3 *) geom;
144 
145             t->props = proplist_add(t->props, (void *) prop, prop_type, freefunc);
146             break;
147         }
148     }
149 }
150 
151 void    geom_prop_addifnp(void *geom, int type, void *prop, int prop_type, void (*freefunc) ( /* ??? */ ), Bool dofree)
152 {
153     switch (type)
154     {
155         case SCALAR:
156         {
157             Scalar *s = (Scalar *) geom;
158 
159             s->props = proplist_addifnp(s->props, (void *) prop, prop_type, freefunc, dofree);
160             break;
161         }
162     case POINT2:
163         {
164             Point2 *p = (Point2 *) geom;
165 
166             p->props = proplist_addifnp(p->props, (void *) prop, prop_type, freefunc, dofree);
167             break;
168         }
169     case LINE2:
170         {
171             Line2  *l = (Line2 *) geom;
172 
173             l->props = proplist_addifnp(l->props, (void *) prop, prop_type, freefunc, dofree);
174             break;
175         }
176     case CONIC2:
177         {
178             Conic  *c = (Conic *) geom;
179 
180             c->props = proplist_addifnp(c->props, (void *) prop, prop_type, freefunc, dofree);
181             break;
182         }
183     case POINT3:
184         {
185             Point3 *p = (Point3 *) geom;
186 
187             p->props = proplist_addifnp(p->props, (void *) prop, prop_type, freefunc, dofree);
188             break;
189         }
190     case LINE3:
191         {
192             Line3  *l = (Line3 *) geom;
193 
194             l->props = proplist_addifnp(l->props, (void *) prop, prop_type, freefunc, dofree);
195             break;
196         }
197     case CONIC3:
198         {
199             Conic  *c;
200 
201             if (((Conic3 *) geom)->conic == NULL)
202                 break;
203             c = ((Conic3 *) geom)->conic;
204             c->props = proplist_addifnp(c->props, (void *) prop, prop_type, freefunc, dofree);
205             break;
206         }
207     case PLANE:
208         {
209             Plane  *p = (Plane *) geom;
210 
211             p->props = proplist_addifnp(p->props, (void *) prop, prop_type, freefunc, dofree);
212             break;
213         }
214     case TRANSF3:
215         {
216             Transf3 *t = (Transf3 *) geom;
217 
218             t->props = proplist_addifnp(t->props, (void *) prop, prop_type, freefunc, dofree);
219             break;
220         }
221     }
222 }
223 
224 void    geom_add_image_pos_prop(void *geom, int type, Mat3 * rect)
225 {
226     switch (type)
227     {
228         case LINE2:
229         {
230             Line2  *line;
231             Line2  *imline;
232 
233             line = (Line2 *) geom;
234             imline = line2_rectify(line, *rect);
235             line->props = proplist_addifnp(line->props, (void *) imline,
236                                IMPOS, (void (*) ()) line2_free, true);
237             break;
238         }
239     case CONIC2:
240         {
241             Conic  *conic;
242             Conic  *imcon;
243 
244             conic = (Conic *) geom;
245             imcon = conic_rectify(conic, *rect);
246             conic->props = proplist_addifnp(conic->props, (void *) imcon,
247                                IMPOS, (void (*) ()) conic_free, true);
248             break;
249         }
250     }
251 }
252 

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