classify/fpoint.h

Go to the documentation of this file.
00001 
00019 #ifndef   FPOINT_H
00020 #define   FPOINT_H
00021 
00022 /* =================
00023           Include Files and Type Defines
00024  ==================== */
00025 #include "general.h"
00026 #include <stdio.h>
00027 #include <math.h>
00028 
00033 typedef struct
00034 {
00035   FLOAT32 x, y;
00036 } FPOINT;
00037 
00042 typedef FPOINT FVECTOR;
00043 
00044 /* =================
00045             Macros
00046  ==================== */
00048 #define Xof(P)      ( (P).x )
00049 #define Yof(P)      ( (P).y )
00050 #define XofP(P)     ((P)->x)
00051 #define YofP(P)     ((P)->y)
00052 #define FillPoint(P,X,Y)  ( Xof(P) = (X), Yof(P) = (Y) )
00053 #define CopyPoint(A,B)    ( Xof(B) = Xof(A), Yof(B) = Yof(A) )
00054 
00056 #define XDelta(A,B)   ( Xof(B) - Xof(A) )
00057 #define YDelta(A,B)   ( Yof(B) - Yof(A) )
00058 #define DistanceBetween(A,B)                 \
00059 (sqrt ((double) (XDelta(A,B) * XDelta(A,B) + YDelta(A,B) * YDelta(A,B))))
00060 
00061 #define SlopeFrom(A,B)    ( YDelta(A,B) / XDelta(A,B) )
00062 #define AngleFrom(A,B)     ( atan2((double) YDelta(A,B),    \
00063                (double) XDelta(A,B) ) )
00064 
00065 #define XIntersectionOf(A,B,X)  ( SlopeFrom(A,B) * ((X) - Xof(A)) + Yof(A))
00066 
00067 /*-------------------------------------------------------------------------
00068         Public Function Prototypes
00069 ---------------------------------------------------------------------------*/
00070 FLOAT32 NormalizedAngleFrom(FPOINT *Point1, FPOINT *Point2, FLOAT32 FullScale); 
00071 #endif

Generated on Wed Feb 28 19:49:10 2007 for Tesseract by  doxygen 1.5.1