00001 //=========================================================================== 00002 //= articulacion.h Septiembre de 1999 = 00003 //=-------------------------------------------------------------------------= 00004 //= Definiciones de la clase ARTICULACION = 00005 //=-------------------------------------------------------------------------= 00006 //= ADVERTENCIA: ESTE SOFTWARE NO ESTA CONCEBIDO NI DISENNADO PARA EL USO = 00007 //= EN EQUIPO DE CONTROL EN LINEA EN ENTORNOS PELIGROSOS QUE REQUIERAN UN = 00008 //= DESEMPENNO LIBRE DE FALLAS, COMO LA OPERACION DE PLANTAS NUCLEARES, = 00009 //= SISTEMAS DE NAVEGACION O COMUNICACION EN AVIONES, TRAFICO AEREO, = 00010 //= EQUIPO MEDICO DEL CUAL DEPENDAN VIDAS HUMANAS O SISTEMAS DE ARMAMENTO, = 00011 //= EN LOS CUALES UNA FALLA EN EL SOFTWARE PUEDA IMPLICAR DIRECTAMENTE LA = 00012 //= MUERTE, DANNOS PERSONALES O DANNOS FISICOS Y/O AMBIENTALES GRAVES = 00013 //= ("ACTIVIDADES DE ALGO RIESGO"). = 00014 //=-------------------------------------------------------------------------= 00015 //= Autor original: Oscar J. Chavarro G. A.K.A. JEDILINK. Copyright (c), = 00016 //= 1997 - 2003, oscarchavarro@hotmail.com = 00017 //= AQUYNZA es software libre, y se rige bajo los terminos de la licencia = 00018 //= LGPL de GNU (http://www.gnu.org). Para mayor informacion respecto a la = 00019 //= licencia de uso, consulte el archivo ./doc/LICENCIA en la distribucion. = 00020 //=========================================================================== 00021 00022 #ifndef __ARTICULACION__ 00023 #define __ARTICULACION__ 00024 00025 #include "jed_defs.h" // Incluir antes que nada, en ese modulo se definen 00026 // aspectos importantes para la portabilidad del sistema 00027 00028 #include "core/cosas/cosa.h" 00029 00030 #ifdef VEL_ROSITA 00031 #include "core/uniones/union.h" 00032 #endif 00033 00034 class ARTICULACION : public UNION { 00035 private: 00036 //- Variables fisicas de la articulacion --------------------------------- 00037 double ks; // Constante del ARTICULACION segun la ley de Hooke 00038 double kd; // Constante de amortiguamiento 00039 00040 //- Extremos de la articulacion ------------------------------------------ 00041 COSA *Extremo1; 00042 VECTOR posicion1; 00043 COSA *Extremo2; 00044 VECTOR posicion2; 00045 00046 //- Servicios privados -------------------------------------------------- 00047 int num_extremos; 00048 00049 BOOLEAN 00050 insertar_extremo(char *nombre, LISTA<COSA*> *Lista_cosas, VECTOR pos); 00051 public: 00052 ARTICULACION(); 00053 virtual ~ARTICULACION(); 00054 00055 //- Operaciones de simulacion ------------------------------------------- 00056 inline void actualizar(void); 00057 00058 //- Operaciones de consulta (visualizacion) ----------------------------- 00059 #ifdef GL_ENABLED 00060 void pintar_gl(CALIDAD_VISUAL *Calidad); 00061 #endif 00062 void pintar_povray(FILE *fd); 00063 00064 //- Operaciones de persistencia ----------------------------------------- 00065 BOOLEAN leer(TOKENIZADOR *Sabiondo, LISTA<COSA *> *Lista_cosas); 00066 }; 00067 00068 //=========================================================================== 00069 //= Operacione inline de la clase ARTICULACION = 00070 //=========================================================================== 00071 00072 inline void 00073 ARTICULACION::actualizar(void) 00078 { 00079 VECTOR f1, f2; 00080 VECTOR delta_x, delta_v; 00081 double absdx; 00082 00083 delta_x = Extremo1->posicion_absoluta(posicion1) - 00084 Extremo2->posicion_absoluta(posicion2); 00085 delta_v = Extremo1->velocidad_absoluta() - Extremo2->velocidad_absoluta(); 00086 00087 absdx = fabs(delta_x.norma()); 00088 00089 f1 = ( 00090 ( delta_x * (1/absdx) ) * 00091 ( ks*(absdx) + 00092 kd*delta_v.producto_punto(delta_x)/absdx 00093 ) 00094 ) * (-1); 00095 00096 f2 = f1 * (-1); 00097 00098 // OJO: Estaran bien las posiciones? (parece que no) 00099 Extremo1->anexar_fuerza(f1, Extremo1->posicion_absoluta(posicion1)); 00100 Extremo2->anexar_fuerza(f2, Extremo2->posicion_absoluta(posicion2)); 00101 } 00102 00103 #endif // __ARTICULACION__ 00104 00105 //=========================================================================== 00106 //= EOF = 00107 //=========================================================================== 00108