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

Linux Cross Reference
Tina6/tina-libs/tina/geometry/geomSpline_knots.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/geomSpline_knots.c,v $
 27  * Date    :  $Date: 2005/01/09 17:49:25 $
 28  * Version :  $Revision: 1.2 $
 29  * CVS Id  :  $Id: geomSpline_knots.c,v 1.2 2005/01/09 17:49:25 paul Exp $
 30  *
 31  * Notes :
 32  *
 33  *********
 34 */
 35 
 36 
 37 #include "geomSpline_knots.h"
 38 
 39 #if HAVE_CONFIG_H
 40   #include <config.h>
 41 #endif
 42 
 43 #include <stdio.h>
 44 #include <math.h>
 45 #include <tina/sys/sysDef.h>
 46 #include <tina/sys/sysPro.h>
 47 #include <tina/math/mathDef.h>
 48 #include <tina/math/mathPro.h>
 49 #include <tina/geometry/geomDef.h>
 50 #include <tina/geometry/geom_SplineDef.h>
 51 
 52 /* get exactly n knots along string that references POS2 data */
 53 
 54 void    str2_get_knots(Tstring * es, int n, double *x, double *y)
 55 {
 56     List *ptr;
 57     int     i, j;
 58     double  l, dl=0.0;
 59 
 60     l = es->count;
 61     switch (es->type)
 62     {
 63     case STRING:
 64         dl = (l - 1.0) / (n - 1);
 65         break;
 66     case LOOP:
 67         dl = (l - 1.0) / n;
 68         break;
 69     }
 70 
 71     for (i = 0, j = 0, ptr = es->start; j < n; i++, ptr = ptr->next)
 72     {
 73         if (i >= j * dl || (es->type == STRING && ptr == es->end))
 74         {
 75             Vec2    v = {Vec2_id};
 76 
 77             DD_GET_POS2(ptr, v);
 78             x[j] = vec2_x(v);
 79             y[j] = vec2_y(v);
 80             j++;
 81         }
 82     }
 83 }
 84 
 85 
 86 /* get exactly n knots along string that references Vec3 data */
 87 
 88 void    str3_get_knots(Tstring * es, int n, double *x, double *y, double *z)
 89 {
 90     List *ptr;
 91     int     i, j;
 92     double  l, dl=0.0;
 93 
 94     l = es->count;
 95     switch (es->type)
 96     {
 97     case STRING:
 98         dl = (l - 1.0) / (n - 1);
 99         break;
100     case LOOP:
101         dl = (l - 1.0) / n;
102         break;
103     }
104 
105     for (i = 0, j = 0, ptr = es->start; j < n; i++, ptr = ptr->next)
106     {
107         if (i >= j * dl || (es->type == STRING && ptr == es->end))
108         {
109             Vec3   *v = (Vec3 *) ptr->to;
110 
111             x[j] = vec3_x(*v);
112             y[j] = vec3_y(*v);
113             z[j] = vec3_z(*v);
114             j++;
115         }
116     }
117 }
118 

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