avr/modules_avr/asserv/eirbot/vect2/vect2.h

Go to the documentation of this file.
00001 /*  
00002  *  Copyright Droids Corporation, Microb Technology, Eirbot (2005)
00003  * 
00004  *  This program is free software; you can redistribute it and/or modify
00005  *  it under the terms of the GNU General Public License as published by
00006  *  the Free Software Foundation; either version 2 of the License, or
00007  *  (at your option) any later version.
00008  *
00009  *  This program is distributed in the hope that it will be useful,
00010  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
00011  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00012  *  GNU General Public License for more details.
00013  *
00014  *  You should have received a copy of the GNU General Public License
00015  *  along with this program; if not, write to the Free Software
00016  *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
00017  *
00018  *  Revision : $Id: vect2.h,v 1.2 2005/02/14 23:43:29 zer0 Exp $
00019  *
00020  */
00021 
00022 #ifndef _REFERENTIEL_
00023 #define _REFERENTIEL_
00024 
00025 #include <utils/utils.h>
00026 
00027 #include <math.h>
00028 
00056 // dans config à terme ?
00057 // pas vraiment utile tant qu'il n'existe qu'un seul type de flottants
00058 typedef double vect2_distance;
00059 typedef double vect2_angle_absolu; // obsolete
00060 typedef double vect2_angle_relatif; // obsolete
00061 typedef double vect2_angle;
00062 
00063 
00064 // types de vecteurs
00065 #define VECT2_ANGLE_K2PI_PRES 1 // option a ajouter
00066 
00067 #define VECT2_CARTESIEN 0
00068 #define VECT2_POLAIRE 2
00069 
00070 struct vect2_cart
00071 {
00072   u08                type;
00073 
00074   vect2_distance       x;
00075   vect2_distance       y;
00076 };
00077 typedef struct vect2_cart vect2_cart;
00078 
00079 struct vect2_pol
00080 {
00081   u08                type;
00082 
00083   vect2_distance       u;
00084   vect2_angle_absolu   teta;
00085 };
00086 typedef struct vect2_pol vect2_pol;
00087 
00088 
00106 union vect2
00107 {
00108   vect2_cart cart;
00109   vect2_pol  pol;
00110 };
00111 typedef union vect2 vect2;
00112 
00113 
00114 /* types de repere : il n en existe qu un pour le moment */
00115 #define REP2_ORTHO_ANGLE 1
00116 
00128 struct rep2_ortho_angle
00129 {
00130   u08 type;
00131 
00132   vect2 origine;
00133   vect2 x;
00134   vect2_angle_absolu   angle_max_fils; // unite d angle, 2*PI pour des radians, 360 pour des degrés, constant et egal a 2*PI
00135   vect2_angle_absolu   angle_max_pere; // pour le repere pere
00136 };
00137 typedef struct rep2_ortho_angle rep2_ortho_angle;
00138 
00139 typedef rep2_ortho_angle rep2; // pareil// a defaut de mieux pour le moment
00140 
00141 
00142 
00143 
00144 
00147 void vect2_mod1_angle(vect2_angle * dest, vect2_angle_absolu angle_max );
00149 void vect2_mod2_angle(vect2_angle * dest, vect2_angle_absolu angle_max );
00150 
00152 void vect2_2pol(vect2 * dest, vect2_angle_absolu angle_max);
00153 void vect2_2cart(vect2 * dest, vect2_angle_absolu angle_max);
00154 void vect2_2type(u08 type, vect2 * dest, vect2_angle_absolu angle_max);
00155 
00163 void vect2_add(vect2 * dest, vect2 * src, vect2_angle_absolu angle_max);
00164 void vect2_sub(vect2 * dest, vect2 * src, vect2_angle_absolu angle_max);
00165 
00167 void vect2_homotetie(vect2_distance rapport, vect2 * dest);
00168 
00169 
00170 
00172 void vect2_angle_to_rep(vect2_angle_absolu * angle, rep2 * repere);
00173 void vect2_angle_from_rep(vect2_angle_absolu * angle, rep2 * repere);
00174 
00175 
00179 void vect2_vect_to_rep(vect2 * dest, rep2 * repere);
00180 void vect2_vect_from_rep(vect2 * dest, rep2 * repere);
00181 
00182 
00190 void vect2_point_to_rep(vect2 * dest, rep2 * repere);
00191 
00196 void vect2_point_from_rep(vect2 * dest, rep2 * repere);
00197 
00198 
00199 #endif

Generated on Fri Nov 11 06:44:22 2005 for AVR by  doxygen 1.4.5