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

Linux Cross Reference
Tina4/src/vision/cone/cone.c

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

  1 /**@(#)
  2 **/
  3 /* cone.c functions for manipulating generic cones
  4  * 
  5  */
  6 
  7 #include <tina/sys.h>
  8 #include <tina/sysfuncs.h>
  9 #include <tina/math.h>
 10 #include <tina/mathfuncs.h>
 11 #include <tina/vision.h>
 12 #include <tina/visionfuncs.h>
 13 
 14 #ifdef _PCC
 15 #include <memory.h>
 16 #endif
 17 
 18 Cone   *cone_alloc(int type)
 19 {
 20     Cone   *cone = ts_ralloc(Cone);
 21 
 22     cone->type = type;
 23     cone->label = new_label();
 24     cone->c1 = cone->c2 = NULL;
 25     cone->offset = 0;
 26     cone->props = NULL;
 27     return (cone);
 28 }
 29 
 30 Cone   *cone_make(Conic3 * c1, Conic3 * c2, double offset, int type)
 31 {
 32     Cone   *cone = ts_ralloc(Cone);
 33 
 34     cone->type = type;
 35     cone->label = new_label();
 36     cone->c1 = c1;
 37     cone->c2 = c2;
 38     cone->offset = offset;
 39     cone->props = NULL;
 40     return (cone);
 41 }
 42 
 43 void    cone_free(Cone * cone)
 44 {
 45     if (cone == NULL)
 46         return;
 47     proplist_freelist(cone->props);
 48     conic3_free(cone->c1);
 49     conic3_free(cone->c2);
 50     rfree((void *) cone);
 51 }
 52 
 53 Cone   *cone_copy(Cone * cone)
 54 {
 55     Cone   *copy;
 56     List   *proplist_copy();
 57 
 58     if (cone == NULL)
 59         return (NULL);
 60 
 61     copy = ts_ralloc(Cone);
 62     (void) memcpy((char *) copy, (char *) cone, sizeof(Cone));
 63     copy->c1 = conic3_copy(cone->c1);
 64     copy->c2 = conic3_copy(cone->c2);
 65     copy->props = proplist_copy(cone->props);
 66     return (copy);
 67 }
 68 
 69 Vec3    cone_point(Cone * cone, double u, double t)
 70 
 71 /* cone parameters */
 72 {
 73     Vec3    p1 = {Vec3_id};
 74     Vec3    p2 = {Vec3_id};
 75 
 76     p1 = conic3_point(cone->c1, t);
 77     p2 = conic3_point(cone->c2, t + cone->offset);
 78 
 79     return (vec3_sum(vec3_times(1 - u, p1), vec3_times(u, p2)));
 80 }
 81 

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