calcul.h
1/***************************************************/
2/* Last Revised:
3$Id$
4*/
5/***************************************************/
6/*
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 2 of the License, or
10 * (at your option) any later version.
11 *
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with this program; if not, write to the Free Software
19 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
20 *
21 */
22#ifndef Calcul
23#define Calcul
24
25#include <stdio.h>
26#include <math.h>
27#include "TData.h"
28
29#ifdef __cplusplus
30extern "C" {
31#endif
32
33/*
34 Este fichero tiene operaciones de transformacion de sistemas de referencia,
35 transformaciones de puntos entre sistemas, de paso de coordenadadas polares,
36 a cartesianas y de corte de segmentos
37
38*/
39
40/* --------------------------------------------------------------------------------------- */
41/* TRANSFORMACIONES DE PUNTO DE UN SISTEMA DE REFERENCIA A OTRO */
42/* --------------------------------------------------------------------------------------- */
43
44/* --------------------------------------------------------------------------------------- */
45/* transfor_directa_p */
46/* .... Hace la transformacion directa de un punto a un sistema a otro */
47/* .... In: (x,y) las coordenadas del punto, sistema es el sistema de referencia */
48/* .... Out: en sol se devuelve las coordenadas del punto en el nuevo sistema */
49
50void transfor_directa_p ( float x, float y, Tsc *sistema, Tpf *sol );
51
52/* --------------------------------------------------------------------------------------- */
53/* transfor_directa_p */
54/* .... Hace la transformacion directa de un punto a un sistema a otro */
55/* .... La diferencia es que aqui el punto de entrada es el (0,0) (optimiza la anterior) */
56/* .... In: (x,y) las coordenadas del punto, sistema es el sistema de referencia */
57/* .... Out: en sol se devuelve las coordenadas del punto en el nuevo sistema */
58
59void transfor_directa_pt0(float x, float y,
60 Tsc *sistema, Tpf *sol);
61
62/* --------------------------------------------------------------------------------------- */
63/* transfor_inversa_p */
64/* .... Hace la transformacion inversa de un punto a un sistema a otro */
65/* .... In: (x,y) las coordenadas del punto, sistema es el sistema de referencia */
66/* .... Out: en sol se devuelve las coordenadas del punto en el nuevo sistema */
67
68void transfor_inversa_p ( float x, float y, Tsc *sistema, Tpf *sol );
69
70/* --------------------------------------------------------------------------------------- */
71/* TRANSFORMACIONES DE COMPOSICION E INVERSION DE SISTEMAS DE REFERENCIA */
72/* --------------------------------------------------------------------------------------- */
73
74/* --------------------------------------------------------------------------------------- */
75/* composicion_sis */
76/* .... Realiza la composicion de sistemas de referencia en otro sistema */
77/* .... In: compone sis1 y sis2 */
78/* .... Out: la salida sisOut es el resultado de la composicion de los sistemas */
79/* .... Nota: resulta muy importante el orden de las entradas en la composicion */
80
81void composicion_sis(Tsc *sis1,Tsc *sis2,Tsc *sisOut);
82
83/* --------------------------------------------------------------------------------------- */
84/* inversion_sis */
85/* .... Realiza la inversion de un sistema de referencia */
86/* .... In: sisIn es el sistema a invertir */
87/* .... Out: sisOut es el sistema invertido */
88
89void inversion_sis(Tsc *sisIn, Tsc *sisOut);
90
91/* --------------------------------------------------------------------------------------- */
92/* TRANSFORMACIONES DE PUNTO DE UN SISTEMA DE REFERENCIA A OTRO */
93/* --------------------------------------------------------------------------------------- */
94
95/* --------------------------------------------------------------------------------------- */
96/* car2pol */
97/* .... Transforma un punto de coordenadas cartesianas a polares */
98/* .... In: el punto en coordenadas cartesianas a transformar */
99/* .... Out: el punto salida en coordenadas polares */
100
101void car2pol(Tpf *in, Tpfp *out);
102
103/* --------------------------------------------------------------------------------------- */
104/* pol2car */
105/* .... Transforma un punto de coordenadas polares a cartesianas */
106/* .... In: el punto entrada en coordenadas polares a transformar */
107/* .... Out: el punto en coordenadas cartesianas transformado */
108
109void pol2car(Tpfp *in, Tpf *out);
110
111/* --------------------------------------------------------------------------------------- */
112/* TRANSFORMACIONES DE PUNTO DE UN SISTEMA DE REFERENCIA A OTRO */
113/* --------------------------------------------------------------------------------------- */
114
115/* --------------------------------------------------------------------------------------- */
116/* corte_segmentos */
117/* .... Calcula el punto de corte entre dos segmentos */
118/* .... In: las coordenadas de los puntos extremos (x1,y1)-(x2,y2) y (x3,y3)-(x4,y4) */
119/* .... Out: sol son las coordenadas del punto de corte. return --> 1 si hay corte. -->0 no */
120
121int corte_segmentos ( float x1, float y1, float x2, float y2,
122 float x3, float y3, float x4, float y4,
123 Tpf *sol );
124
125
126/* Normaliza el angulo entre [-PI, PI] */
127float NormalizarPI(float ang);
128
129#ifdef __cplusplus
130}
131#endif
132
133#endif
Definition TData.h:41
Definition TData.h:47
Definition TData.h:57