Main Page   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members   File Members  

xymath.h

Go to the documentation of this file.
00001 //* Módulo   : xymath.h                                                          
00002 // _Desc_    : Define funções matemáticas genéricas.  
00003 // _Autores_ : Carlos Henrique Levy e Jaudênia Cavalcante.                       
00004 // _Data_    : 08 mar 96.                                                           
00005 
00006 #ifndef __XYMATH_H
00007 #define __XYMATH_H
00008 
00009 #include <math.h>
00010 #include "xybool.h"
00011 
00012 #ifndef MIN
00013 #define MIN(a, b) ((a) < (b) ? (a) : (b)) // mínimo entre dois valores
00014 #endif
00015 
00016 #ifndef MAX
00017 #define MAX(a, b) ((a) > (b) ? (a) : (b)) // máximo entre dois valores
00018 #endif
00019 
00020 // mínimo entre três valores
00021 #define MIN3(a, b, c) ((a) < (b) ? MIN(a, c) : MIN(b, c))
00022 // máximo entre três valores
00023 #define MAX3(a, b, c) ((a) > (b) ? MAX(a, c) : MAX(b, c))
00024 
00025 const double XY_PI   = 3.14159265359;
00026 
00027 // define tolerancia global
00028 double mtTolerance(double v);
00029 
00030 // verifica se v1 e v2 são iguais, usa tolerancia global
00031 xybool mtEqual(double v1, double v2);
00032 // verifica se v1 e v2 são iguais na tolerancia tol
00033 xybool mtEqual(double v1, double v2, double tol);
00034 
00035 // verifica se v1 é menor ou igual a v2 numa tolerância
00036 xybool mtLessEqual(double v1, double v2);
00037 
00038 // retorna a distância entre os pontos (x0, y0) e (x1, y1)
00039 double mtDistance(double x0, double y0, double x1, double y1);
00040 
00041 // retorna a distância entre os pontos (x0, y0) e (x1, y1)
00042 double mtDistance(int x0, int y0, int x1, int y1);
00043 
00044 // faz a rotação no ponto (xi, yi) de um certo ângulo, resultando (xr, yr)
00045 void mtRotate(double xi, double yi, double angle, double* xr, double* yr);      
00046 
00047 // faz a rotação no ponto (xi, yi) de um certo ângulo, resultando (xr, yr)
00048 void mtRotate(int xi, int yi, double angle, int* xr, int* yr);  
00049 
00050 // verifica a interseção entre áreas
00051 xybool mtIntercept(double xmin1, double ymin1, double xmax1, double ymax1,
00052                 double xmin2, double ymin2, double xmax2, double ymax2);
00053 
00054 // verifica a interseção entre áreas
00055 xybool mtIntercept(int xmin1, int ymin1, int xmax1, int ymax1,
00056                 int xmin2, int ymin2, int xmax2, int ymax2);
00057 
00058 // verifica a inclusão entre duas áreas
00059 xybool mtInclude(double xmin1, double ymin1, double xmax1, double ymax1,
00060               double xmin2, double ymin2, double xmax2, double ymax2);
00061 
00062 // verifica a inclusão entre duas áreas
00063 xybool mtInclude(int xmin1, int ymin1, int xmax1, int ymax1,
00064               int xmin2, int ymin2, int xmax2, int ymax2);
00065 
00066 // verifica se o ponto está no retângulo
00067 xybool mtPointInRect(int px, int py, int x1, int y1, int x2, int y2);
00068 
00069 // verifica se o ponto está no retângulo
00070 xybool mtPointInRect(double px, double py, double x1, double y1,double x2, double y2);
00071 
00072 // verifica se o ponto está sobre a linha
00073 xybool mtPointInLine(double px, double py, double x1, double y1,double x2, double y2);
00074 
00075 // verifica se o ponto está sobre a linha (+ robusto)
00076 xybool mtPointInLineEx(double px, double py, double x1, double y1,double x2, double y2);
00077 
00078 // verifica se o ponto está sobre uma marca
00079 xybool mtPointInMark(int px, int py, int x1, int y1, int tol);
00080 
00081 // verifica se ponto está sobre um círculo
00082 xybool mtPointInCircle (int px, int py, int x0, int y0, int x1, int y1);
00083 
00084 // verifica se ponto está dentro um círculo
00085 xybool mtPointInsideCircle (int px, int py, int cx, int cy, int radius);
00086 
00087 int mtDecade( double val );
00088 
00089 #endif
00090 

XY
Tecgraf / PUC-Rio - Computer Graphics Technology Group