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

Linux Cross Reference
Tina6/tina-libs/tina/geometry/geomGen_props.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/geomGen_props.c,v $
 27  * Date    :  $Date: 2002/12/09 11:51:23 $
 28  * Version :  $Revision: 1.1.1.1 $
 29  * CVS Id  :  $Id: geomGen_props.c,v 1.1.1.1 2002/12/09 11:51:23 cvstina Exp $
 30  *
 31  * Notes :
 32  *
 33  *********
 34 */
 35 
 36 
 37 #include "geomGen_props.h"
 38 
 39 #if HAVE_CONFIG_H
 40   #include <config.h>
 41 #endif
 42 
 43 #include <tina/sys/sysDef.h>
 44 #include <tina/sys/sysPro.h>
 45 #include <tina/math/mathDef.h>
 46 #include <tina/math/mathPro.h>
 47 #include <tina/geometry/geomDef.h>
 48 #include <tina/geometry/geom_PointDef.h>
 49 #include <tina/geometry/geom_LineDef.h>
 50 #include <tina/geometry/geom_LinePro.h>
 51 #include <tina/geometry/geom_CurveDef.h>
 52 #include <tina/geometry/geom_CurvePro.h>
 53 #include <tina/geometry/geom_PlaneDef.h>
 54 
 55 
 56 void   *geom_prop_get(void *p, int type, int prop)
 57 {
 58     switch (type)
 59     {
 60         case SCALAR:
 61         return (prop_get(((Scalar *) p)->props, prop));
 62     case POINT2:
 63         return (prop_get(((Point2 *) p)->props, prop));
 64     case LINE2:
 65         return (prop_get(((Line2 *) p)->props, prop));
 66     case CONIC2:
 67         return (prop_get(((Conic *) p)->props, prop));
 68     case POINT3:
 69         return (prop_get(((Point3 *) p)->props, prop));
 70     case LINE3:
 71         return (prop_get(((Line3 *) p)->props, prop));
 72     case CONIC3:
 73         {
 74             Conic3 *con3 = p;
 75 
 76             if (con3->conic == NULL)
 77                 return (NULL);
 78             return (prop_get(con3->conic->props, prop));
 79         }
 80     case PLANE:
 81         return (prop_get(((Plane *) p)->props, prop));
 82     case TRANSF3:
 83         return (prop_get(((Transf3 *) p)->props, prop));
 84     }
 85     return (NULL);
 86 }
 87 
 88 void   *geom_prop_update_get(void *p, int *type, int prop)
 89 {
 90     int     stype = *type;
 91 
 92     /* BUGFIX JB 22/11/93 was    *type - prop; */
 93     *type = prop;
 94     switch (stype)
 95     {
 96     case SCALAR:
 97         return (prop_get(((Scalar *) p)->props, prop));
 98     case POINT2:
 99         return (prop_get(((Point2 *) p)->props, prop));
100     case LINE2:
101         return (prop_get(((Line2 *) p)->props, prop));
102     case CONIC2:
103         return (prop_get(((Conic *) p)->props, prop));
104     case POINT3:
105         return (prop_get(((Point3 *) p)->props, prop));
106     case LINE3:
107         return (prop_get(((Line3 *) p)->props, prop));
108     case CONIC3:
109         {
110             Conic3 *con3 = p;
111 
112             if (con3->conic == NULL)
113                 return (NULL);
114             return (prop_get(con3->conic->props, prop));
115         }
116     case PLANE:
117         return (prop_get(((Plane *) p)->props, prop));
118     case TRANSF3:
119         return (prop_get(((Transf3 *) p)->props, prop));
120     }
121     return (NULL);
122 }
123 
124 void    geom_prop_add(void *geom, int type, void *prop, int prop_type, void (*freefunc) ( /* ??? */ ))
125 {
126     switch (type)
127     {
128         case SCALAR:
129         {
130             Scalar *s = (Scalar *) geom;
131 
132             s->props = proplist_add(s->props, (void *) prop, prop_type, freefunc);
133             break;
134         }
135     case POINT2:
136         {
137             Point2 *p = (Point2 *) geom;
138 
139             p->props = proplist_add(p->props, (void *) prop, prop_type, freefunc);
140             break;
141         }
142     case LINE2:
143         {
144             Line2  *l = (Line2 *) geom;
145 
146             l->props = proplist_add(l->props, (void *) prop, prop_type, freefunc);
147             break;
148         }
149     case CONIC2:
150         {
151             Conic  *c = (Conic *) geom;
152 
153             c->props = proplist_add(c->props, (void *) prop, prop_type, freefunc);
154             break;
155         }
156     case POINT3:
157         {
158             Point3 *p = (Point3 *) geom;
159 
160             p->props = proplist_add(p->props, (void *) prop, prop_type, freefunc);
161             break;
162         }
163     case LINE3:
164         {
165             Line3  *l = (Line3 *) geom;
166 
167             l->props = proplist_add(l->props, (void *) prop, prop_type, freefunc);
168             break;
169         }
170     case CONIC3:
171         {
172             Conic  *c;
173 
174             if (((Conic3 *) geom)->conic == NULL)
175                 break;
176             c = ((Conic3 *) geom)->conic;
177             c->props = proplist_add(c->props, (void *) prop, prop_type, freefunc);
178             break;
179         }
180     case PLANE:
181         {
182             Plane  *p = (Plane *) geom;
183 
184             p->props = proplist_add(p->props, (void *) prop, prop_type, freefunc);
185             break;
186         }
187     case TRANSF3:
188         {
189             Transf3 *t = (Transf3 *) geom;
190 
191             t->props = proplist_add(t->props, (void *) prop, prop_type, freefunc);
192             break;
193         }
194     }
195 }
196 
197 void    geom_prop_addifnp(void *geom, int type, void *prop, int prop_type, void (*freefunc) ( /* ??? */ ), Bool dofree)
198 {
199     switch (type)
200     {
201         case SCALAR:
202         {
203             Scalar *s = (Scalar *) geom;
204 
205             s->props = proplist_addifnp(s->props, (void *) prop, prop_type, freefunc, dofree);
206             break;
207         }
208     case POINT2:
209         {
210             Point2 *p = (Point2 *) geom;
211 
212             p->props = proplist_addifnp(p->props, (void *) prop, prop_type, freefunc, dofree);
213             break;
214         }
215     case LINE2:
216         {
217             Line2  *l = (Line2 *) geom;
218 
219             l->props = proplist_addifnp(l->props, (void *) prop, prop_type, freefunc, dofree);
220             break;
221         }
222     case CONIC2:
223         {
224             Conic  *c = (Conic *) geom;
225 
226             c->props = proplist_addifnp(c->props, (void *) prop, prop_type, freefunc, dofree);
227             break;
228         }
229     case POINT3:
230         {
231             Point3 *p = (Point3 *) geom;
232 
233             p->props = proplist_addifnp(p->props, (void *) prop, prop_type, freefunc, dofree);
234             break;
235         }
236     case LINE3:
237         {
238             Line3  *l = (Line3 *) geom;
239 
240             l->props = proplist_addifnp(l->props, (void *) prop, prop_type, freefunc, dofree);
241             break;
242         }
243     case CONIC3:
244         {
245             Conic  *c;
246 
247             if (((Conic3 *) geom)->conic == NULL)
248                 break;
249             c = ((Conic3 *) geom)->conic;
250             c->props = proplist_addifnp(c->props, (void *) prop, prop_type, freefunc, dofree);
251             break;
252         }
253     case PLANE:
254         {
255             Plane  *p = (Plane *) geom;
256 
257             p->props = proplist_addifnp(p->props, (void *) prop, prop_type, freefunc, dofree);
258             break;
259         }
260     case TRANSF3:
261         {
262             Transf3 *t = (Transf3 *) geom;
263 
264             t->props = proplist_addifnp(t->props, (void *) prop, prop_type, freefunc, dofree);
265             break;
266         }
267     }
268 }
269 
270 void    geom_add_image_pos_prop(void *geom, int type, Mat3 * rect)
271 {
272     switch (type)
273     {
274         case LINE2:
275         {
276             Line2  *line;
277             Line2  *imline;
278 
279             line = (Line2 *) geom;
280             imline = line2_rectify(line, *rect);
281             line->props = proplist_addifnp(line->props, (void *) imline,
282                                IMPOS, (void (*) ()) line2_free, true);
283             break;
284         }
285     case CONIC2:
286         {
287             Conic  *conic;
288             Conic  *imcon;
289 
290             conic = (Conic *) geom;
291             imcon = conic_rectify(conic, *rect);
292             conic->props = proplist_addifnp(conic->props, (void *) imcon,
293                                IMPOS, (void (*) ()) conic_free, true);
294             break;
295         }
296     }
297 }
298 

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