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

Linux Cross Reference
Tina6/tina-libs/tina/geometry/geomLine_2coln.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/geomLine_2coln.c,v $
 27  * Date    :  $Date: 2002/12/09 11:51:23 $
 28  * Version :  $Revision: 1.1.1.1 $
 29  * CVS Id  :  $Id: geomLine_2coln.c,v 1.1.1.1 2002/12/09 11:51:23 cvstina Exp $
 30  *
 31  * Notes :
 32  *
 33  *********
 34 */
 35 
 36 
 37 #include "geomLine_2coln.h"
 38 
 39 #if HAVE_CONFIG_H
 40   #include <config.h>
 41 #endif
 42 
 43 #include <stdio.h>
 44 #include <tina/sys/sysDef.h>
 45 #include <tina/sys/sysPro.h>
 46 #include <tina/math/mathDef.h>
 47 #include <tina/math/mathPro.h>
 48 #include <tina/geometry/geomDef.h>
 49 #include <tina/geometry/geom_LineDef.h>
 50 #include <tina/geometry/geom_LinePro.h>
 51 
 52 Line2  *colinear_2Dlines(List ** co_linelist, List ** lines, double co_thres)
 53 {
 54     List   *ptr1;
 55     List   *ptr2;
 56     List   *ptr2_next;
 57     Line2  *line1;
 58     Line2  *line2;
 59     Line2  *refline;
 60     double  dist1, dist2, dist3, dist4, vec2_perp_dist();
 61 
 62     refline = (*co_linelist)->to;
 63     for (ptr1 = *co_linelist; ptr1 != NULL; ptr1 = ptr1->next)
 64     {
 65         line1 = ptr1->to;
 66         if (line1->length > refline->length)
 67             refline = line1;
 68         for (ptr2 = *lines; ptr2 != NULL; ptr2 = ptr2_next)
 69         {
 70             line2 = ptr2->to;
 71             ptr2_next = ptr2->next;
 72 
 73             dist1 = vec2_perp_dist(line1->p, line1->v, line2->p1);
 74             dist2 = vec2_perp_dist(line1->p, line1->v, line2->p2);
 75             dist3 = vec2_perp_dist(line2->p, line2->v, line1->p1);
 76             dist4 = vec2_perp_dist(line2->p, line2->v, line1->p1);
 77             if (dist1 < co_thres && dist2 < co_thres && dist3 < co_thres && dist4 < co_thres)
 78             {
 79                 *lines = list_rm_el(*lines, ptr2, (void (*) ()) NULL);
 80                 (void) ref_addtoend(list_get_end(*co_linelist), (void *) line2, LINE2);
 81             }
 82         }
 83     }
 84     return (refline);
 85 }
 86 

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