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

Linux Cross Reference
Tina4/src/vision/point2/point2.c

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

  1 /**@(#)
  2 **/
  3 /* point.c functions for manipulating 2D points
  4  * 
  5  * typedef struct point2 { int type; int label; struct vec2 p; struct list
  6  * *props; } Point2;
  7  * 
  8  */
  9 
 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 #ifdef _PCC
 17 #include <memory.h>
 18 #endif
 19 
 20 
 21 Point2 *point2_alloc(unsigned int type)
 22 {
 23     Point2 *point = ts_ralloc(Point2);
 24 
 25     point->type = type;
 26     point->label = new_label();
 27     point->p = vec2_zero();
 28     point->props = NULL;
 29     return (point);
 30 }
 31 
 32 Point2 *point2_make(Vec2 p, unsigned int type)
 33 {
 34     Point2 *point = ts_ralloc(Point2);
 35 
 36     point->type = type;
 37     point->label = new_label();
 38     point->p = p;
 39     point->props = NULL;
 40     return (point);
 41 }
 42 
 43 void    point2_free(Point2 * point)
 44 {
 45     if (point == NULL)
 46         return;
 47     proplist_freelist(point->props);
 48     rfree((void *) point);
 49 }
 50 
 51 Point2 *point2_copy(Point2 * point)
 52 {
 53     Point2 *copy;
 54     List   *proplist_copy();
 55 
 56     if (point == NULL)
 57         return (NULL);
 58 
 59     copy = ts_ralloc(Point2);
 60     (void) memcpy((char *) copy, (char *) point, sizeof(Point2));
 61     copy->props = proplist_copy(point->props);
 62     return (copy);
 63 }
 64 
 65 int     point2_number(List * points)
 66 {
 67     List   *lptr;
 68     int     n = 0;
 69 
 70     for (lptr = points; lptr != NULL; lptr = lptr->next)
 71         ((Point2 *) (lptr->to))->label = n++;
 72     return(n);
 73 }
 74 

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