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

Linux Cross Reference
Tina6/tina-libs/tina/geometry/geomPoint_2gen.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/geomPoint_2gen.c,v $
 27  * Date    :  $Date: 2005/01/09 17:49:25 $
 28  * Version :  $Revision: 1.2 $
 29  * CVS Id  :  $Id: geomPoint_2gen.c,v 1.2 2005/01/09 17:49:25 paul Exp $
 30  *
 31  * Notes : functions for manipulating 2D points
 32  *
 33  *********
 34 */
 35 
 36 
 37 #include "geomPoint_2gen.h"
 38 
 39 #if HAVE_CONFIG_H
 40   #include <config.h>
 41 #endif
 42 
 43 #include <stdio.h>
 44 #include <string.h>
 45 #include <math.h>
 46 #include <stdlib.h>
 47 #include <tina/sys/sysDef.h>
 48 #include <tina/sys/sysPro.h>
 49 #include <tina/math/mathDef.h>
 50 #include <tina/math/mathPro.h>
 51 #include <tina/geometry/geom_PointDef.h>
 52 #ifdef _PCC
 53 #include <memory.h>
 54 #endif
 55 
 56 
 57 Point2 *point2_alloc(unsigned int type)
 58 {
 59     Point2 *point = ts_ralloc(Point2);
 60 
 61     point->type = type;
 62     point->label = new_label();
 63     point->p = vec2_zero();
 64     point->props = NULL;
 65     return (point);
 66 }
 67 
 68 Point2 *point2_make(Vec2 p, unsigned int type)
 69 {
 70     Point2 *point = ts_ralloc(Point2);
 71 
 72     point->type = type;
 73     point->label = new_label();
 74     point->p = p;
 75     point->props = NULL;
 76     return (point);
 77 }
 78 
 79 void    point2_free(Point2 * point)
 80 {
 81     if (point == NULL)
 82         return;
 83     proplist_freelist(point->props);
 84     rfree((void *) point);
 85 }
 86 
 87 Point2 *point2_copy(Point2 * point)
 88 {
 89     Point2 *copy;
 90     List   *proplist_copy();
 91 
 92     if (point == NULL)
 93         return (NULL);
 94 
 95     copy = ts_ralloc(Point2);
 96     (void) memcpy((char *) copy, (char *) point, sizeof(Point2));
 97     copy->props = proplist_copy(point->props);
 98     return (copy);
 99 }
100 
101 int     point2_number(List * points)
102 {
103     List   *lptr;
104     int     n = 0;
105 
106     for (lptr = points; lptr != NULL; lptr = lptr->next)
107         ((Point2 *) (lptr->to))->label = n++;
108     return(n);
109 }
110 

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