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

Linux Cross Reference
TINA5/tina-libs/tina/geometry/geomCurve_cone.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/geomCurve_cone.c,v $
 23  * Date    :  $Date: 2005/01/09 17:49:25 $
 24  * Version :  $Revision: 1.2 $
 25  * CVS Id  :  $Id: geomCurve_cone.c,v 1.2 2005/01/09 17:49:25 paul Exp $
 26  *
 27  * Author  : Legacy TINA
 28  *
 29  * Notes : functions for manipulating generic cones
 30  *
 31  *********
 32 */
 33 
 34 #include "geomCurve_cone.h"
 35 
 36 #if HAVE_CONFIG_H
 37   #include <config.h>
 38 #endif
 39 
 40 #include <math.h>
 41 #include <string.h>
 42 #include <tina/sys/sysDef.h>
 43 #include <tina/sys/sysPro.h>
 44 #include <tina/math/mathDef.h>
 45 #include <tina/math/mathPro.h>
 46 #include <tina/geometry/geom_CurveDef.h>
 47 #include <tina/geometry/geomCurve_conic3.h>
 48 #ifdef _PCC
 49 #include <memory.h>
 50 #endif
 51 
 52 Cone   *cone_alloc(int type)
 53 {
 54     Cone   *cone = ts_ralloc(Cone);
 55 
 56     cone->type = type;
 57     cone->label = new_label();
 58     cone->c1 = cone->c2 = NULL;
 59     cone->offset = 0;
 60     cone->props = NULL;
 61     return (cone);
 62 }
 63 
 64 Cone   *cone_make(Conic3 * c1, Conic3 * c2, double offset, int type)
 65 {
 66     Cone   *cone = ts_ralloc(Cone);
 67 
 68     cone->type = type;
 69     cone->label = new_label();
 70     cone->c1 = c1;
 71     cone->c2 = c2;
 72     cone->offset = offset;
 73     cone->props = NULL;
 74     return (cone);
 75 }
 76 
 77 void    cone_free(Cone * cone)
 78 {
 79     if (cone == NULL)
 80         return;
 81     proplist_freelist(cone->props);
 82     conic3_free(cone->c1);
 83     conic3_free(cone->c2);
 84     rfree((void *) cone);
 85 }
 86 
 87 Cone   *cone_copy(Cone * cone)
 88 {
 89     Cone   *copy;
 90     List   *proplist_copy();
 91 
 92     if (cone == NULL)
 93         return (NULL);
 94 
 95     copy = ts_ralloc(Cone);
 96     (void) memcpy((char *) copy, (char *) cone, sizeof(Cone));
 97     copy->c1 = conic3_copy(cone->c1);
 98     copy->c2 = conic3_copy(cone->c2);
 99     copy->props = proplist_copy(cone->props);
100     return (copy);
101 }
102 
103 Vec3    cone_point(Cone * cone, double u, double t)
104 
105 /* cone parameters */
106 {
107     Vec3    p1 = {Vec3_id};
108     Vec3    p2 = {Vec3_id};
109 
110     p1 = conic3_point(cone->c1, t);
111     p2 = conic3_point(cone->c2, t + cone->offset);
112 
113     return (vec3_sum(vec3_times(1 - u, p1), vec3_times(u, p2)));
114 }
115 

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