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

Linux Cross Reference
Tina6/tina-libs/tina/geometry/geomPlane_gen.c

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

Diff markup

Differences between /tina-libs/tina/geometry/geomPlane_gen.c (Architecture i386) and /tina-libs/tina/geometry/geomPlane_gen.c (Architecture alpha)


  1 /**********                                         1 /**********
  2  *                                                  2  * 
  3  * This file is part of the TINA Open Source I      3  * This file is part of the TINA Open Source Image Analysis Environment
  4  * henceforth known as TINA                         4  * henceforth known as TINA
  5  *                                                  5  *
  6  * TINA is free software; you can redistribute      6  * TINA is free software; you can redistribute it and/or modify
  7  * it under the terms of the GNU General Publi      7  * it under the terms of the GNU General Public License as 
  8  * published by the Free Software Foundation.       8  * published by the Free Software Foundation.
  9  *                                                  9  *
 10  * TINA is distributed in the hope that it wil     10  * TINA is distributed in the hope that it will be useful,
 11  * but WITHOUT ANY WARRANTY; without even the      11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
 12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR     12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 13  * GNU General Public License for more details     13  * GNU General Public License for more details.
 14  *                                                 14  *
 15  * You should have received a copy of the GNU      15  * You should have received a copy of the GNU General Public License
 16  * along with TINA; if not, write to the Free      16  * along with TINA; if not, write to the Free Software Foundation, Inc., 
 17  * 59 Temple Place, Suite 330, Boston, MA  021     17  * 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 18  *                                                 18  *
 19  * ANY users of TINA who require exemption fro     19  * ANY users of TINA who require exemption from the existing licence must
 20  * negotiate a new licence with Dr. Neil.A.Tha     20  * negotiate a new licence with Dr. Neil.A.Thacker, the sole agent for
 21  * the University of Manchester.                   21  * the University of Manchester.
 22  *                                                 22  *
 23  **********                                        23  **********
 24  *                                                 24  * 
 25  * Program :    TINA                               25  * Program :    TINA
 26  * File    :  $Source: /home/tina/cvs/tina-lib     26  * File    :  $Source: /home/tina/cvs/tina-libs/tina/geometry/geomPlane_gen.c,v $
 27  * Date    :  $Date: 2005/01/09 17:49:25 $         27  * Date    :  $Date: 2005/01/09 17:49:25 $
 28  * Version :  $Revision: 1.2 $                     28  * Version :  $Revision: 1.2 $
 29  * CVS Id  :  $Id: geomPlane_gen.c,v 1.2 2005/     29  * CVS Id  :  $Id: geomPlane_gen.c,v 1.2 2005/01/09 17:49:25 paul Exp $
 30  *                                                 30  *
 31  * Notes : functions for manipulating 3D plane     31  * Notes : functions for manipulating 3D planes
 32  *                                                 32  *
 33  *********                                         33  *********
 34 */                                                 34 */
 35                                                    35 
 36                                                    36 
 37 #include "geomPlane_gen.h"                         37 #include "geomPlane_gen.h"
 38                                                    38 
 39 #if HAVE_CONFIG_H                                  39 #if HAVE_CONFIG_H
 40   #include <config.h>                              40   #include <config.h>
 41 #endif                                             41 #endif
 42                                                    42 
 43 #include <string.h>                                43 #include <string.h>
 44 #include <stdio.h>                                 44 #include <stdio.h>
 45 #include <math.h>                                  45 #include <math.h>
 46 #include <stdlib.h>                                46 #include <stdlib.h>
 47 #include <tina/sys/sysDef.h>                       47 #include <tina/sys/sysDef.h>
 48 #include <tina/sys/sysPro.h>                       48 #include <tina/sys/sysPro.h>
 49 #include <tina/math/mathDef.h>                     49 #include <tina/math/mathDef.h>
 50 #include <tina/math/mathPro.h>                     50 #include <tina/math/mathPro.h>
 51 #include <tina/geometry/geom_PlaneDef.h>           51 #include <tina/geometry/geom_PlaneDef.h>
 52 #ifdef _PCC                                        52 #ifdef _PCC
 53 #include <memory.h>                                53 #include <memory.h>
 54 #endif                                             54 #endif
 55                                                    55 
 56 Plane  *plane_alloc(unsigned int type)             56 Plane  *plane_alloc(unsigned int type)
 57 {                                                  57 {
 58     Plane  *plane = ts_ralloc(Plane);              58     Plane  *plane = ts_ralloc(Plane);
 59                                                    59 
 60     plane->type = type;                            60     plane->type = type;
 61     plane->label = new_label();                    61     plane->label = new_label();
 62     plane->p = vec3_zero();                        62     plane->p = vec3_zero();
 63     plane->n = vec3_ez();                          63     plane->n = vec3_ez();
 64     plane->props = NULL;                           64     plane->props = NULL;
 65     return (plane);                                65     return (plane);
 66 }                                                  66 }
 67                                                    67 
 68 Plane  *plane_make(Vec3 p, Vec3 n, int type)       68 Plane  *plane_make(Vec3 p, Vec3 n, int type)
 69 {                                                  69 {
 70     Plane  *plane = ts_ralloc(Plane);              70     Plane  *plane = ts_ralloc(Plane);
 71                                                    71 
 72     plane->type = type;                            72     plane->type = type;
 73     plane->label = new_label();                    73     plane->label = new_label();
 74     plane->p = p;                                  74     plane->p = p;
 75     plane->n = vec3_unit(n);                       75     plane->n = vec3_unit(n);
 76     plane->props = NULL;                           76     plane->props = NULL;
 77     return (plane);                                77     return (plane);
 78 }                                                  78 }
 79                                                    79 
 80 void    plane_free(Plane * plane)                  80 void    plane_free(Plane * plane)
 81 {                                                  81 {
 82     if (plane == NULL)                             82     if (plane == NULL)
 83         return;                                    83         return;
 84     proplist_freelist(plane->props);               84     proplist_freelist(plane->props);
 85     rfree((void *) plane);                         85     rfree((void *) plane);
 86 }                                                  86 }
 87                                                    87 
 88 Plane  *plane_copy(Plane * plane)                  88 Plane  *plane_copy(Plane * plane)
 89 {                                                  89 {
 90     Plane  *copy;                                  90     Plane  *copy;
 91     List   *proplist_copy();                       91     List   *proplist_copy();
 92                                                    92 
 93     if (plane == NULL)                             93     if (plane == NULL)
 94         return (NULL);                             94         return (NULL);
 95                                                    95 
 96     copy = ts_ralloc(Plane);                       96     copy = ts_ralloc(Plane);
 97     (void) memcpy((char *) copy, (char *) plan     97     (void) memcpy((char *) copy, (char *) plane, sizeof(Plane));
 98     copy->props = proplist_copy(plane->props);     98     copy->props = proplist_copy(plane->props);
 99     return (copy);                                 99     return (copy);
100 }                                                 100 }
101                                                   101 
102 int     plane_number(List * planes)               102 int     plane_number(List * planes)
103 {                                                 103 {
104     List   *lptr;                                 104     List   *lptr;
105     int     n = 0;                                105     int     n = 0;
106                                                   106 
107     for (lptr = planes; lptr != NULL; lptr = l    107     for (lptr = planes; lptr != NULL; lptr = lptr->next)
108         ((Plane *) (lptr->to))->label = n++;      108         ((Plane *) (lptr->to))->label = n++;
109     return(n);                                    109     return(n);
110 }                                                 110 }
111                                                   111 
112 Bool    plane_point_on_plane(Plane * plane, Ve    112 Bool    plane_point_on_plane(Plane * plane, Vec3 p, double thres)
113 {                                                 113 {
114     Vec3    dp = {Vec3_id};                       114     Vec3    dp = {Vec3_id};
115     double  dn;                                   115     double  dn;
116                                                   116 
117     dp = vec3_diff(p, plane->p);                  117     dp = vec3_diff(p, plane->p);
118     dn = vec3_dot(dp, plane->n);                  118     dn = vec3_dot(dp, plane->n);
119     return ((fabs(dn) < thres) ? true : false)    119     return ((fabs(dn) < thres) ? true : false);
120 }                                                 120 }
121                                                   121 

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