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

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

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