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

Linux Cross Reference
Tina4/src/vision/spline/knots.c

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

  1 /**@(#)
  2 **/
  3 #include <math.h>
  4 #include <tina/sys.h>
  5 #include <tina/sysfuncs.h>
  6 #include <tina/math.h>
  7 #include <tina/mathfuncs.h>
  8 #include <tina/vision.h>
  9 #include <tina/visionfuncs.h>
 10 
 11 /* get exactly n knots along string that references POS2 data */
 12 
 13 void    str2_get_knots(Tstring * es, int n, double *x, double *y)
 14 {
 15     List *ptr;
 16     int     i, j;
 17     double  l, dl;
 18 
 19     l = es->count;
 20     switch (es->type)
 21     {
 22     case STRING:
 23         dl = (l - 1.0) / (n - 1);
 24         break;
 25     case LOOP:
 26         dl = (l - 1.0) / n;
 27         break;
 28     }
 29 
 30     for (i = 0, j = 0, ptr = es->start; j < n; i++, ptr = ptr->next)
 31     {
 32         if (i >= j * dl || (es->type == STRING && ptr == es->end))
 33         {
 34             Vec2    v = {Vec2_id};
 35 
 36             DD_GET_POS2(ptr, v);
 37             x[j] = vec2_x(v);
 38             y[j] = vec2_y(v);
 39             j++;
 40         }
 41     }
 42 }
 43 
 44 
 45 /* get exactly n knots along string that references Vec3 data */
 46 
 47 void    str3_get_knots(Tstring * es, int n, double *x, double *y, double *z)
 48 {
 49     List *ptr;
 50     int     i, j;
 51     double  l, dl;
 52 
 53     l = es->count;
 54     switch (es->type)
 55     {
 56     case STRING:
 57         dl = (l - 1.0) / (n - 1);
 58         break;
 59     case LOOP:
 60         dl = (l - 1.0) / n;
 61         break;
 62     }
 63 
 64     for (i = 0, j = 0, ptr = es->start; j < n; i++, ptr = ptr->next)
 65     {
 66         if (i >= j * dl || (es->type == STRING && ptr == es->end))
 67         {
 68             Vec3   *v = (Vec3 *) ptr->to;
 69 
 70             x[j] = vec3_x(*v);
 71             y[j] = vec3_y(*v);
 72             z[j] = vec3_z(*v);
 73             j++;
 74         }
 75     }
 76 }
 77 

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